Skip to content

fix: give the restarted windows gateway a hidden console - #32087

Merged
bolichen97 merged 1 commit into
mainfrom
fix/27775-restart-no-window
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/27775-restart-no-window

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: After kirocrew restart on Windows, the programs the gateway starts stop opening visible console windows.

After kirocrew restart on Windows the replacement gateway has no console. Every console program it later starts with only CREATE_NEW_PROCESS_GROUP (the update check's git, script hooks, app backends, frontend builds) gets a new, visible console window.

Why it matters

Every Windows user who runs kirocrew restart sees black console windows flash or stay open on their desktop for as long as that gateway runs.

Not a goal

  • Adding CREATE_NO_WINDOW at each child spawn site.
  • The desktop-supervised gateway.
  • dev_fleet's own child (apps/builtins/dev_fleet/gateway_service.py).

What changed (motivation → approach → change)

On Windows the restarted gateway now owns one hidden console, so the console programs it starts share it and open no window. POSIX is unchanged.

The respawn in cli_server_restart.py passed DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP. DETACHED_PROCESS gives the gateway no console at all, so Windows makes a new visible one for each console child. The respawn now passes CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP: the gateway gets a console with no window, and its children inherit it. It still runs in its own process group and outlives the terminal that ran the restart.

The rule comments in platform_compat_native.py and the respawn bullet in docs/system-specs/modules/cli.md state the new flags.

Backwards compatibility

Compatible: only the Windows creation flags of the restarted gateway change; the command, its output and POSIX behaviour stay the same.

Removes nothing: no path, record, key or function is taken away; the DETACHED_PROCESS constant stays for its other caller.

Tests

  • test_spawn_detached_gateway_uses_kirocrew_bin now runs on every OS. It pins the three Windows flag values and asserts creationflags == 0x08000200 (CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP); main passes 0x208. The POSIX start_new_session check stays.

Proof: PROVEN test/test_cli_restart.py::TestRestart::test_spawn_detached_gateway_uses_kirocrew_bin (head b812b8b)

Determinism: 20 runs at -n0, 10 runs at -n 4 --dist loadgroup beside test_platform_compat_coverage.py and test_windows_spawn_off_loop.py, and the whole test_cli_restart.py in a shuffled order (seed 27775, 42 ids): all green.

Targeted tests: every test file that names cli_server_restart, platform_compat_native or _SUBPROCESS_NO_WINDOW (1071 passed, 196 skipped). One failure, test_stdlib_shadow.py::TestDetection::test_remedy_is_shell_safe_or_absent, fails the same way on main on this Windows host and does not touch this code.

Manual verification

Real kirocrew restart on native Windows Server (Python 3.12), scratch KIROCREW_HOME, port 6927. Terminal A (classic console) ran kirocrew gateway; terminal B (another classic console) ran kirocrew restart. Then each process under the new gateway was listed with its console and console window, terminal B was closed with WM_CLOSE (what the X button sends), and kirocrew status was run 30 s later.

check main this branch
new gateway owns a conhost no yes, one
console window in gateway tree yes, child made its own none
children share gateway console no yes
alive 30 s after B closed yes yes
kirocrew status running running

On main the first console program the gateway started (the venv python.exe) made its own new console and window. On the branch no process in the tree owns a console window.

Not run here: Windows Terminal as terminal B, one tab or one of two tabs. This host has no signed-in desktop session, and Windows Terminal refuses to start (Access is denied). The issue's stand-in check already covers a CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP child surviving its Windows Terminal window closing, 3 of 3.

Related Issues

Closes #27775

Sibling sweep

Swept: git grep -nE "DETACHED_PROCESS" -- src/
Sibling: src/kiro_crew/apps/builtins/dev_fleet/gateway_service.py:731 -- not affected -- dev_fleet starts its own child, out of scope per the issue triage

Pattern harvest

Not generalizable: the respawn is the one place the product makes a long-lived, console-less Windows parent of console children.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested a review from a team as a code owner November 7, 2026 04:22
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision cb8a0e9e326364d962670df65f57064eabfdba31 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of cb8a0e9e326364d962670df65f57064eabfdba31 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns. The fix fixes the cause: the respawned gateway had no console because of DETACHED_PROCESS. It was tested by hand on a real Windows host.

Notes

  • The respawn now reads platform_compat._SUBPROCESS_NO_WINDOW, a private name, from a second module. A public CREATE_NO_WINDOW alias in platform_compat would make the cross-module contract explicit.

[DESIGN-REVIEWED] cb8a0e9

Description read

[DESCRIPTION-READ] 296bafda1b1823fcbc57202da910ba50b5d4ee7e47614610fcad113d6b849ccb

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of cb8a0e9e326364d962670df65f57064eabfdba31 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. This is a one-flag fix for the cause, with an issue behind it (#27775). The test pin it rewrites is named in the description, along with the old value ("main passes 0x208").

Not checked: whether the gateway outlives its window closing in Windows Terminal. The author also could not run that case.

What this change ships

Inventory (4 items) — 4 justified

Intent: stop console windows popping up for programs the gateway starts after kirocrew restart on Windows. This is a FIX.

  1. On Windows, the restarted gateway starts with a hidden console instead of none, so the console programs it starts open no window. — justified
  2. The restart spec bullet in cli.md now names the new flags and explains the hidden console. — justified
  3. The rule comments in platform_compat_native.py now recommend _SUBPROCESS_NO_WINDOW over DETACHED_PROCESS for a detached child. — justified
  4. The restart flag test now runs on every OS and checks the exact flag value. — justified

[FIRST-PRINCIPLES-REVIEWED] cb8a0e9

Description read

[DESCRIPTION-READ] 5ac533bcb95c45e34a5786edefae84064bf59eadebcedf76ac63f521410fe796

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed cb8a0e9e326364d962670df65f57064eabfdba31 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] cb8a0e9

Verdict parsed from the review's SHA-scoped output markers for commit cb8a0e9e326364d962670df65f57064eabfdba31.

False positive or not applicable? A repository writer can comment:
/ai-review override fable cb8a0e9e326364d962670df65f57064eabfdba31 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of cb8a0e9e326364d962670df65f57064eabfdba31 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] cb8a0e9

False positive or not applicable? A repository writer can comment:
/ai-review override gpt cb8a0e9e326364d962670df65f57064eabfdba31 false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 04:43
@bolichen97
bolichen97 force-pushed the fix/27775-restart-no-window branch from 3b925e9 to 0eadf00 Compare November 7, 2026 05:17
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/ (acp-client.md, artifacts.md, computer-use.md, messaging.md, metrics.md, platform-context.md, session.md) and src/kiro_crew/edition_locks.py since this head went green (2552c90 -> 464b547); CI re-running. [operator: bolichen97]

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 7, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/cli.md and neighbouring docs/system-specs/modules/ and src/kiro_crew/ files since this head went green (464b547 -> b247a22); CI re-running. [operator: bolichen97]

@bolichen97
bolichen97 force-pushed the fix/27775-restart-no-window branch from 0eadf00 to c3550e9 Compare November 7, 2026 06:02
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 7, 2026
@bolichen97

bolichen97 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/cli_server_restart.py and docs/system-specs/modules/cli.md (#31425, #31602, other hunks) since this head went green (b247a22 -> b65af1a); CI re-running. [operator: bolichen97]

@bolichen97
bolichen97 force-pushed the fix/27775-restart-no-window branch from c3550e9 to b812b8b Compare November 7, 2026 07:15
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 7, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] The red Backend Tests shard 2 (Linux, Windows, macOS) is test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget, which this PR does not touch. It is main's red, and #32183 fixes it. This PR will rebase onto main once #32183 merges.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 7, 2026
@bolichen97
bolichen97 force-pushed the fix/27775-restart-no-window branch from b812b8b to cb8a0e9 Compare November 7, 2026 13:00
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/ and docs/system-specs/modules/ since this head's CI ran, and main now carries the line-budget fix #32252 that the red Backend Tests shard 2 (Linux, Windows, macOS) and Coverage Gate were waiting on (b65af1a -> 1ab5673); CI re-running. [operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved: PR Readiness passed on cb8a0e9, and all five review lanes (Opus 5.5, GPT 6.1, Design, UX, First Principles) report no blocking finding on this head. No conflict and no open change request.

@bolichen97
bolichen97 merged commit 430c260 into main Nov 7, 2026
106 of 135 checks passed
@bolichen97
bolichen97 deleted the fix/27775-restart-no-window branch November 7, 2026 19:47
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
buluoray pushed a commit that referenced this pull request Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants