Skip to content

fix(workers): pass windowsHide to inner CLI spawns so no console window pops on Windows#256

Open
efenocchi wants to merge 2 commits into
mainfrom
fix/wiki-worker-windowshide
Open

fix(workers): pass windowsHide to inner CLI spawns so no console window pops on Windows#256
efenocchi wants to merge 2 commits into
mainfrom
fix/wiki-worker-windowshide

Conversation

@efenocchi

@efenocchi efenocchi commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

Users reported a bare claude.exe console window flashing up at session end on Windows.

The wiki worker and skillify gate worker are themselves spawned detached and console-less (spawn-detached.ts already sets windowsHide on the worker process). But the inner execFileSync that runs the summarizer CLI (claude -p / codex exec / cursor --print / pi --print / hermes -z) did not pass windowsHide, so Windows allocated a fresh visible console window titled after the CLI executable.

Fix

Add windowsHide: true (maps to CREATE_NO_WINDOW; a no-op on POSIX) to every inner CLI spawn:

  • both branches of buildClaudeInvocation / buildTrailingPromptInvocation in src/hooks/wiki-worker-spawn.ts (covers the claude/codex/cursor/pi wiki workers)
  • the hermes wiki worker's direct execFileSync (src/hooks/hermes/wiki-worker.ts)
  • the skillify gate-runner's CLI spawn (src/skillify/gate-runner.ts)

Tests

  • Unit assertions on every invocation-builder branch (tests/claude-code/wiki-worker-windows.test.ts)
  • Source-level guards for the hermes worker and the gate-runner — their dispatch tests exec a real binary and cannot observe the options object (tests/hermes/hermes-wiki-worker-source.test.ts, tests/claude-code/skillify-gate-runner.test.ts)
  • Full suite: tsc --noEmit clean, npm run build clean, 4415/4415 tests passing

Follow-up to #250, which fixed summary generation itself on Windows; this removes the remaining visible-console regression reported there.

Session Context

Session transcripts (investigation + PR creation)

Summary by CodeRabbit

  • Bug Fixes

    • Suppressed visible Windows console windows when spawning background worker and agent processes (Hermes, agent/Claude, and detached skill runner), improving a cleaner, non-disruptive user experience.
  • Tests

    • Added tests to verify console-window suppression across multiple invocation paths and platforms.

…ow pops on Windows

The wiki worker and skillify gate worker are spawned detached and
console-less (spawn-detached.ts already sets windowsHide on the worker
itself). But the INNER execFileSync that runs the summarizer CLI
(claude -p / codex exec / cursor --print / pi --print / hermes -z) did
not pass windowsHide, so Windows allocated a fresh visible console
window titled after the CLI exe — users reported a bare "claude.exe"
window appearing at session end.

Add windowsHide: true (CREATE_NO_WINDOW, no-op on POSIX) to:
- both branches of buildClaudeInvocation / buildTrailingPromptInvocation
  (covers the claude/codex/cursor/pi wiki workers)
- the hermes wiki worker's direct execFileSync
- the skillify gate-runner's CLI spawn

Tests: unit assertions on every builder branch, plus source-level
guards for the hermes worker and gate-runner (their dispatch tests exec
a real binary and cannot observe the options object).
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2922f7a7-7afc-46fe-8e36-eefd550fa584

📥 Commits

Reviewing files that changed from the base of the PR and between 2549b25 and 1aa65ef.

📒 Files selected for processing (2)
  • tests/claude-code/skillify-gate-runner.test.ts
  • tests/hermes/hermes-wiki-worker-source.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/hermes/hermes-wiki-worker-source.test.ts
  • tests/claude-code/skillify-gate-runner.test.ts

📝 Walkthrough

Walkthrough

Adds windowsHide: true to execFileSync spawn options in Hermes wiki-worker, Claude invocation builders, and skillify gate-runner to prevent visible Windows console windows; tests added to assert the option exists across all spawn paths.

Changes

Windows console suppression across worker spawns

Layer / File(s) Summary
Worker and runner spawn updates
src/hooks/hermes/wiki-worker.ts, src/hooks/wiki-worker-spawn.ts, src/skillify/gate-runner.ts
Hermes wiki-worker, buildClaudeInvocation, buildTrailingPromptInvocation, and gate-runner runGate() now include windowsHide: true in execFileSync options to suppress Windows console windows for spawned child processes.
Spawn options test coverage
tests/claude-code/skillify-gate-runner.test.ts, tests/claude-code/wiki-worker-windows.test.ts, tests/hermes/hermes-wiki-worker-source.test.ts
New Vitest assertions validate windowsHide: true is present in Hermes worker source, Claude invocation builders across shell/non-shell/platform branches, and gate-runner spawn options.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • activeloopai/hivemind#250: Introduced the shell/stdin routing logic in buildClaudeInvocation and buildTrailingPromptInvocation that this PR extends with the windowsHide: true option.

Suggested reviewers

  • khustup2
  • kaghni

Poem

🐇 I tiptoe past the Windows glare,
Spawned processes hush without a sound,
No console window snaps the air,
Silent workers all around,
Hooray — the rabbit's code is proud.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: adding windowsHide to inner CLI spawns to prevent console windows on Windows.
Description check ✅ Passed The description provides comprehensive context (problem, fix, tests), but the template requires a version bump section which is missing from the PR description.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wiki-worker-windowshide

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Scope: files changed in this PR. Enforced threshold: 90% per metric (per file via vitest.config.ts).

Status Category Percentage Covered / Total
🟢 Lines 93.91% (🎯 90%) 108 / 115
🟢 Statements 91.80% (🎯 90%) 112 / 122
🟢 Functions 93.75% (🎯 90%) 15 / 16
🔴 Branches 82.80% (🎯 90%) 77 / 93
File Coverage — 3 files changed
File Stmts Branches Functions Lines
src/hooks/hermes/wiki-worker.ts 🟢 90.8% 🔴 89.7% 🟢 90.0% 🟢 92.6%
src/hooks/wiki-worker-spawn.ts 🟢 100.0% 🟢 100.0% 🟢 100.0% 🟢 100.0%
src/skillify/gate-runner.ts 🟢 92.8% 🔴 76.0% 🟢 100.0% 🟢 96.3%

Generated for commit 3a87288.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/claude-code/skillify-gate-runner.test.ts`:
- Around line 12-13: The test currently only checks for the substring
"windowsHide: true" which can be false-positive; update the assertion to scope
the check to the actual spawn call by either (a) using a focused regex that
matches the call structure (e.g. a regex that finds execFileSync(...) or
runChildProcess(...) whose options object contains windowsHide:\s*true) or (b)
parsing the file with an AST parser (e.g. `@babel/parser`) and asserting that a
CallExpression with callee name execFileSync or runChildProcess has an options
ObjectExpression containing a Property with key "windowsHide" and value true;
replace the expect(src).toContain(...) with the scoped regex or AST-based
assertion so the test only passes when windowsHide is set inside the actual
spawn call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 086f8883-4f93-4e3b-b11f-cc945b42c2a7

📥 Commits

Reviewing files that changed from the base of the PR and between a54660f and 2549b25.

📒 Files selected for processing (6)
  • src/hooks/hermes/wiki-worker.ts
  • src/hooks/wiki-worker-spawn.ts
  • src/skillify/gate-runner.ts
  • tests/claude-code/skillify-gate-runner.test.ts
  • tests/claude-code/wiki-worker-windows.test.ts
  • tests/hermes/hermes-wiki-worker-source.test.ts

Comment thread tests/claude-code/skillify-gate-runner.test.ts Outdated
Substring toContain could false-positive if the token appeared anywhere
in the file. Tie the assertion to the runChildProcess / execFileSync
call structure ([^)]* = no closing paren between call open and the
option) per CodeRabbit review.
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