Skip to content

fix(agent-core): hide console window when running hooks on Windows - #1466

Merged
liruifengv merged 2 commits into
mainfrom
fix-hooks-spawn
Jul 7, 2026
Merged

fix(agent-core): hide console window when running hooks on Windows#1466
liruifengv merged 2 commits into
mainfrom
fix-hooks-spawn

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Related Issue

Relates to #1298.

Problem

On Windows, every hook command spawned a visible console window (mintty / Git Bash) that briefly stole foreground focus. This is the same root cause reported in #1298, but in the hook runner path, which the earlier fix did not cover. The Bash tool path was already hardened with windowsHide: true; the hook runner's process spawn was missing the windowsHide flag, even though its own taskkill helper already passed it.

What changed

Pass windowsHide: true when spawning the hook process, so hooks run silently without flashing a console window on Windows. The spawn options were extracted into a pure builder so the flag can be covered by a regression test, mirroring the existing KAOS spawn-options regression test.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update. (No doc update needed — a bug fix restoring expected behavior.)

Pass windowsHide:true when spawning the hook process so a visible console
no longer flashes and steals focus on Windows. The Bash-tool path was
already hardened (KAOS buildLocalSpawnOptions); the hook runner missed the
flag even though its own taskkill helper already set it.

Extract the spawn options into a pure builder and add a regression test
asserting windowsHide, mirroring the existing KAOS spawn-options test.

Relates to #1298.
@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bc268e8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 7, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@bc268e8
npx https://pkg.pr.new/@moonshot-ai/kimi-code@bc268e8

commit: bc268e8

@liruifengv
liruifengv merged commit 063bce2 into main Jul 7, 2026
10 checks passed
@liruifengv
liruifengv deleted the fix-hooks-spawn branch July 7, 2026 07:55
@github-actions github-actions Bot mentioned this pull request Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant