Skip to content

fix(hooks): hide console windows for detached hook child processes - #506

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
flowjzh:fix/windows-hide-detached-spawns
Sep 11, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
flowjzh:fix/windows-hide-detached-spawns

Conversation

@flowjzh

@flowjzh flowjzh commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

detached: true without windowsHide: true gives the child process its own console window on Windows. Every hook dispatch from a GUI host therefore flashed a transient console window: WorkBuddy fires hook-dispatch on session start, the parent spawns the background-only child (which re-runs npm-registry checks), and a "npm" console window pops up and vanishes on the user's desktop.

This sets windowsHide: true on both detached spawn sites:

  • src/hook-dispatch-cli.ts - the background-only dispatch child (--bg-only)
  • src/local-agent.ts - the plugin reconcile worker

Zero behavior change otherwise: same stdio configuration, same unref, same error swallowing.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Test Plan

  • npx tsc --noEmit passes
  • npx vitest run on macOS: full suite green; Windows: no new failures vs. pre-existing platform failures
  • Verified in a 20-member Windows-only WorkBuddy fleet: session-start hook chains no longer flash any console window

Notes for Reviewers

  • Same class as the existing windowsHide on the cmd /c plugin exec in local-agent.ts - this covers the remaining detached sites (2/2; a tree-wide search finds no other detached: spawn).
  • Follow-up idea: a shared spawnDetached() helper in src/utils/ would make hidden-launch a property of the infrastructure instead of a per-site option to remember; happy to do that if preferred.

detached: true without windowsHide: true gives the child its own console
window on Windows — every hook dispatch flashed a transient "npm" window
when WorkBuddy (a GUI host) fired session hooks. Set windowsHide: true on
both detached spawn sites (hook-dispatch background child and the
local-agent plugin reconcile worker).
@jeff-r2026
jeff-r2026 self-requested a review September 11, 2026 06:23
@jeff-r2026
jeff-r2026 merged commit bdc59f3 into Tencent:main Sep 11, 2026
7 checks passed
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
)

detached: true without windowsHide: true gives the child its own console
window on Windows — every hook dispatch flashed a transient "npm" window
when WorkBuddy (a GUI host) fired session hooks. Set windowsHide: true on
both detached spawn sites (hook-dispatch background child and the
local-agent plugin reconcile worker).

Co-authored-by: flowjzh <[email protected]>
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.

2 participants