Repository navigation
[PIR #1919] Windows: hide child-process console windows; throttle Team view refresh - #1932
Merged
Merged
Conversation
Tower runs detached with no console, so every unhidden console child (git, gh, cmd.exe for cron, codev init/adopt) opened a visible window. Add windowsHide to each site reachable from Tower and from the console-less afx spawn. Cache getRepoInfo per workspace for 5 minutes; it ran git on every Team view refresh. sessionHasLiveHolder no longer runs ps on Windows when no detector is given (no production caller relies on that default).
The extension host has no console. Hide its git and powershell spawns. porch approve and afx cleanup now go through execCodevCli, the shim resolver spawnCodevCli already uses: bare execFile cannot run an npm .cmd shim on Windows.
… 30s Tower broadcasts an SSE event for nearly every agent tool call; the Team view fetched /api/team on each one. Fetch immediately on reveal, connect and manual refresh; never overlap fetches.
…be hidden Walks the import graph from Tower, afx spawn, afx tower start and the extension host; every child_process use must pass windowsHide or carry a windows-console: annotation (POSIX-only branches are annotated).
… document guard limits
Collaborator
Author
Architect integration reviewVerdict: changes requested, all small; fix in this PR. The shape is right (per-site Review coverage, stated plainly: one working model lane (Claude, integration review, HIGH confidence) plus my own read of Fix before merge
Follow-up issue (not this PR)
Noted, no change needed
|
…ve origin cache, literal windowsHide: true
Collaborator
Author
|
Follow-up filed: #1933 (guard: detect new console-less entry points instead of a hand-maintained list). |
amrmelsayed
added a commit
that referenced
this pull request
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PIR Review: Windows console window flashes while an agent works
Fixes #1919
Summary
On native Windows a console window flashed about twice a second while an agent worked in a VS Code Codev terminal. Tower, started detached, has no console, so every console program it spawned without
windowsHidegot a visible window of its own. The VS Code Team view refreshed on every Tower SSE event (about one per agent tool call), and each refresh made Tower run an unhiddengit remote get-url origin. This PR hides every spawn reachable from Tower,afx spawn/afx towerand the extension host, makes the Team view fetch on SSE only while visible and at most every 30 s, caches the origin lookup, and adds a guard test that fails CI on any new unhidden spawn in those import graphs.Files Changed
apps/vscode/src/__tests__/cli-process.test.ts(+32 / -3)apps/vscode/src/__tests__/team-view-refresh.test.ts(+161 / -0)apps/vscode/src/activity-hooks.ts(+1 / -0)apps/vscode/src/cli-process.ts(+29 / -1)apps/vscode/src/clipboard-image.ts(+3 / -1)apps/vscode/src/commands/approve.ts(+2 / -5)apps/vscode/src/commands/cleanup.ts(+2 / -5)apps/vscode/src/commands/press-cursor-ref.ts(+1 / -1)apps/vscode/src/commands/view-diff.ts(+7 / -7)apps/vscode/src/extension.ts(+6 / -1)apps/vscode/src/review-queue/store.ts(+1 / -1)apps/vscode/src/views/team.ts(+100 / -3)codev/plans/1919-windows-console-window-flashes.md(+216 / -0)codev/projects/1919-windows-console-window-flashes/status.yaml(porch state)codev/resources/arch.md(Platform Layer: console windows)codev/resources/lessons-learned.md(Debugging: reproduce through the user's launch path)codev/reviews/1919-windows-console-window-flashes.md(this file)codev/state/pir-1919_thread.md(+15 / -0)packages/codev/src/__tests__/issue-1919-hidden-spawns.test.ts(+98 / -0)packages/codev/src/__tests__/windows-console-spawn-guard.test.ts(+264 / -0)packages/codev/src/agent-farm/__tests__/tower-cron.test.ts(+3 / -1)packages/codev/src/agent-farm/commands/spawn-worktree.ts(+1 / -0)packages/codev/src/agent-farm/commands/tower.ts(+3 / -0)packages/codev/src/agent-farm/servers/architect-session-holder.ts(+1 / -0)packages/codev/src/agent-farm/servers/ide-server.ts(+1 / -0)packages/codev/src/agent-farm/servers/tower-cron.ts(+3 / -0)packages/codev/src/agent-farm/servers/tower-instances.ts(+1 / -0)packages/codev/src/agent-farm/servers/tower-routes.ts(+2 / -0)packages/codev/src/agent-farm/servers/tower-utils.ts(+9 / -0)packages/codev/src/agent-farm/utils/config.ts(+1 / -0)packages/codev/src/agent-farm/utils/shell.ts(+3 / -0)packages/codev/src/commands/porch/artifacts.ts(+6 / -2)packages/codev/src/lib/github.ts(+1 / -1)packages/codev/src/lib/platform/posix/command-launch.ts(+6 / -0)packages/codev/src/lib/platform/posix/processes.ts(+3 / -0)packages/codev/src/lib/team-github.ts(+31 / -3)packages/codev/src/terminal/session-manager.ts(+1 / -0)Commits
cb9ed631b[PIR windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919] Plan draft02069be72[PIR windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919] Hide Tower and afx spawn child processes on Windows2d962115f[PIR windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919] Hide extension-host child processes on Windows2d1717a1f[PIR windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919] Team view: fetch on SSE only while visible, at most every 30scfe9dc873[PIR windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919] Guard: spawns reachable from a console-less process must be hiddenf46988d00[PIR windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919] Thread: implement phase0bb21438fMerge origin/main (5bce030) into builder/pir-1919, no conflicts543bc21e4[PIR windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919] Review + retrospectivegit fetch(consultation finding)Test Results
npm run build: ✓ passnpm test(packages/codev, native Windows, run alone): ✓ 402 files / 8035 tests passed, 247 skipped, 0 failed. Porch's tests check passed at dev-approval (130 s).windows-console-spawn-guard.test.ts(6: the graph guard plus scanner fixtures),issue-1919-hidden-spawns.test.ts(6),team-view-refresh.test.ts(7), 2 newcli-processtests;tower-cron.test.tsassertswindowsHide.apps/vscodecheck-types: ✓ clean.tower-lifecycle.windowsscenario 5,read ECONNRESET, Node 24 only; the same flaky file seen on Fix #1922: full suite on native Windows no longer stops the live Tower; fix EPERM at its cause #1926 and [PIR #1920] Tower PTYs get TERM=xterm-256color; claude gate accepts the ASCII-fallback > marker #1928). Re-run oneba684309: https://github.com/cluesmith/codev/actions/runs/44259502725, all jobs passed.Architecture Updates
COLD
codev/resources/arch.md, Platform Layer: new Console windows bullet. A detached Tower has no console; every spawn reachable from Tower,afx spawn/afx towerand the extension host passeswindowsHideor carries a// windows-console: <reason>comment, enforced by the guard test; the extension spawns CLIs throughcli-process.ts. Not HOT: it governs spawn sites, not every change.Lessons Learned Updates
COLD
codev/resources/lessons-learned.md, Debugging: reproduce through the user's launch path. Spec 1658's check passed because a Tower started from inside a codev session inherits a hidden console through the CIM launch path; a user's Tower has none. How a process was launched decides what its children inherit, and a static guard beats a manual check that depends on it.Things to Look At During PR Review
sessionHasLiveHolderon Windows skips thepsprobe and returns false when no detector is injected (tower-utils.ts). The architect asked to prefer the process census; I did not, because the census is async and the function sits under the synchronousresolveArchitectLaunch. What returning false changes for architect launch: nothing in production. Every production caller passes its own detector: bothtower-instances.tscall sites pass the census-backedreconcileArchitectSessionHolder, andresolveArchitectRestartpasses() => false. Only tests reached the defaultpspath, and on Windows it ran apsthat does not exist there.apps/vscode/src/views/team.ts). It fetches immediately when it becomes visible, on connect while visible, and on manual refresh. SSE-driven fetches happen only while visible, throttled to one per 30 s with a trailing fetch, and never two at once. The Team view now usescreateTreeView(so it can see visibility) instead ofregisterTreeDataProvider.getRepoInfocaches the origin for 5 minutes per cwd; a missing origin (or a transient git failure) only for 45 s, so a workspace that gainsoriginshows Team data soon. Expired entries are deleted. The cache registers a reset (registerTestResetinlib/test-env.ts) that the sharedvitest-setup.tsruns before every test, so cached origins cannot leak between tests.windows-console-spawn-guard.test.ts) uses the TypeScript compiler API. It walks relative imports fromtower-server.ts,commands/spawn.ts,commands/tower.tsandapps/vscode/src/extension.ts, and checks everychild_processcall (named imports, dynamic-import destructuring,promisifyaliases, same-file object literals) forwindowsHideor a// windows-console:comment. It cannot see spawns through an injected function (for exampleclipboard-image.ts'sdeps.spawn), so those carry the comment by hand.execFile('porch'|'afx'), which cannot run npm.cmdshims on Windows. They now use the newexecCodevCli, which resolves the shim and hides the window.lib/platform/posix/*, theps/pgrep/tailsites,activity-hooks.ts): those calls never run on Windows and carry a// windows-console:comment for the guard. No behaviour change.git fetchinGitRefResolver(artifacts.ts). Hiding it meant a Git Credential Manager prompt could no longer be seen or answered, and the fetch had no timeout, so it could hang porch. It now runs withGIT_TERMINAL_PROMPT=0,GCM_INTERACTIVE=neverand a 60 s timeout; a failed or timed-out fetch falls into the existing warning and the locally cached ref is read. Raised by the Claude consultation; regression test inissue-1919-hidden-spawns.test.ts.porchandafx cleanupnow run hidden from the extension (execCodevCli), so their graphs (commands/porch/index.ts,agent-farm/commands/cleanup.ts) are guard entry points. That surfacedporch'snotify.ts(afx sendafterporch approve),checks.ts(git branch),state.ts(git add/commit/pushof status.yaml) andcleanup.ts's POSIXps; all now hidden or annotated. The status push also setsGIT_TERMINAL_PROMPT=0, so it fails instead of waiting on a prompt no one can see.windowsHide: true(notfalse, a variable or a shorthand).GIT_FETCH_TIMEOUT_MSmoved aboveGitRefResolver's doc comment.agynot installed). Claude's other non-blocking notes: the guard's limits are now stated in its header;spawnDetached'swindowsHideis a no-op next todetachedand now says so;getRepoInfohas no in-flight dedupe and caches a missing origin for 5 minutes (accepted);TeamProvider.dispose()is untested (accepted); a Windows cron command that deliberately opens a window now runs hidden (intended: cron runs unattended).How to Test Locally
afx dev pir-1919afx tower start), so it has no console.Flaky Tests
None seen on the final runs. An earlier
porch donetests check failed while it overlapped another builder's full-suite run; porch truncated the output, so the failing tests are unknown. The solo re-run passed in full. Known load-dependent Windows failures are tracked in #1923.packages/codev/src/__tests__/tower-lifecycle.windows.test.ts, scenario 5 ("a row whose shellper pid was reused is refused and removed"):read ECONNRESETon the Windows workflow, Node 24, run 44258108002; passed on Node 22 and on the re-run.