Skip to content

windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919

Closed

Description

@amrmelsayed

Problem

On native Windows a black console window flashes into view for a split second, repeatedly, while an agent is working in a Codev terminal in VS Code. It stops when the agent finishes its reply, and stops entirely when VS Code is closed. Reported by the owner 2026-11-18 on Windows 11, codev 3.3.7.

Cause (read from source; the flash itself not yet reproduced under instrumentation)

Tower is started detached, so it has no console. Any console program it starts without windowsHide: true gets a new visible console window for as long as it runs.

The chain that matches the report:

  1. Each agent tool call posts to Tower (lifecycle reporter), which broadcasts an overview-changed SSE event (coalesced to about one per 500 ms).
  2. The VS Code Team view refreshes on every SSE event, with no filter, debounce or visibility check: apps/vscode/src/views/team.ts:11.
  3. Each refresh calls GET /api/team, which calls getRepoInfo, which runs execFileAsync('git', ['remote','get-url','origin'], { cwd }) with no windowsHide: packages/codev/src/lib/team-github.ts:58.

That explains all three observations: only while the agent is processing (tool calls drive the events), only with VS Code open (the extension's Team view drives the requests), a black console window (git.exe's).

Other unhidden spawn sites found in the same sweep

  • packages/codev/src/agent-farm/servers/tower-cron.ts:286: exec(command) through cmd.exe; a 1-2 s window at each cron run.
  • tower-routes.ts:4047: execAsync('git status --porcelain'), polled every 5 s by the dashboard FileTree (apps/web/src/components/FileTree.tsx:153) while a dashboard tab is open.
  • lib/github.ts:288 (gh api rate_limit), tower-routes.ts:2904 (codev init), tower-instances.ts:523 (npx codev adopt), tower-utils.ts:251 (ps, unguarded on Windows).
  • Children of CLIs the extension launches detached (apps/vscode/src/commands/spawn.ts:46, tower-starter.ts:48): agent-farm/utils/shell.ts:24,85,143, spawn-worktree.ts:791, utils/config.ts:44.
  • Extension-host spawns: apps/vscode/src/clipboard-image.ts:56/59, commands/view-diff.ts, commands/press-cursor-ref.ts:49, review-queue/store.ts:236, commands/approve.ts:360, commands/cleanup.ts:51.

Line numbers are from a sweep and should be re-verified; the Team view chain and the cron site were checked against the files.

Fix shape

  1. Add windowsHide: true, or route through commandLaunch() (packages/codev/src/lib/platform/windows/command-launch.ts), at every production spawn site reachable from console-less Tower or from the VS Code extension host.
  2. Stop the Team view refreshing on every SSE event: filter to relevant events and/or debounce, and skip when the view is not visible. Consider caching getRepoInfo per workspace.
  3. Add a guard test so a new unhidden spawn in Tower or the extension fails CI (windows-shell-spawns.test.ts is the likely home).

Acceptance

  • No console window appears while an agent works in a Codev terminal in VS Code on Windows, with the Team view both visible and collapsed.
  • No console window at a cron run or with a dashboard tab open.
  • POSIX behaviour unchanged.

Related: Spec 1658 (scenario 15 "no console windows flash" covered start Tower, spawn, open terminal and reveal file only; finding M4 is the same mechanism in the codev-ide launcher).

Activity

  1. added
    area/cross-cutting
    on Nov 17, 2026
  2. amrmelsayed commented on Nov 17, 2026

    @amrmelsayed
    CollaboratorAuthor

    On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).

  3. added 16 commits that reference this issue on Nov 18, 2026
  4. added a commit that references this issue on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cross-cutting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions