Repository navigation
v1.91.193.0 fix(browse): spawn the real bun.exe for the terminal agent on Windows (#2295, port of #3357) - #3388
Conversation
Under the Node polyfill a bare 'bun' resolved (via cross-spawn) to npm's bun.cmd shim and ran as `cmd.exe /c bun run terminal-agent.ts`. windowsHide only hid cmd.exe, and the detached cmd.exe had no console, so bun.exe allocated a visible one that stole focus on every spawn. proc.pid was cmd.exe's, so the agent's startup check (record.pid === process.pid) never matched; it exited after 2s and the 60s watchdog respawned it (#2295). resolveBunExecutable() finds the real bun.exe (own execPath under bun, BUN_INSTALL, PATH, the npm-global node_modules layout, ~/.bun) and falls back to 'bun'. POSIX is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd the native cookie-import worker (#2295) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… port of #3357) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
…le() (#3357) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
E2E Evals: ✅ PASS3 executed, 0 reused rule/judge records | 0 manual accepted (unscored; no score-cache credit) | $.17 rule/judge cost | reconcile exit: 0 Profile: pr / mode Rule and judge shards
Fail-closed reconciliationSliced lane: planner → duration-packed executors → fail-closed report. Behavior cases run a pre-registered 3-trial panel (PASS at 2/3 with no contract violation); a PASS 2/3 is shown with its failed trial, never as a clean pass. Reused results retain their original provenance and expiry. Dispatched narrow screen (gstack-ship-queue ready --screen) of merge commit |
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Port of #3357 by @adammartin0087 (Adam Martin), with authorship kept. Addresses #2295; we'll ask the reporter to confirm before closing it.
Why
The sidebar terminal agent was spawned as a bare
bun. With Bun fromnpm install -g bun, that resolves to npm'sbun.cmdshim and runs ascmd.exe /c bun …:windowsHidehides only cmd.exe while bun.exe opens a visible console, and the recorded pid is cmd.exe's. The agent's startup check never matches, it exits after 2 s, and the watchdog respawns it every 60 s.What changed
Before: spawnTerminalAgent passes a bare 'bun' (main source), and the new test can't import the shared lookup.
After: the spawn goes through resolveBunExecutable(), backed by the one shared findWindowsBunExe() lookup; 10 tests pass.
spawnTerminalAgentspawnsresolveBunExecutable(): on Windows the running bun.exe, thenBUN_INSTALL\bin, each absolutePATHentry (and thenode_modules\bun\bin\bun.exenext to an npmbun.cmd), thenUSERPROFILE\.bun\bin, elsebun. macOS and Linux unchanged.findWindowsBunExe()inbun-child-config.ts, and the Windows native cookie-import worker uses it instead of its own copy, so it also finds an npm-global Bun. This changes the source hash of the native cookie-import inputs (NATIVE_CODE_INPUTSincludes both files); the qualification list is empty today, so no receipt is invalidated.browse/test/sidebar-tabs.test.tspinned the old bare'bun'spawn literal; the pin now expectsresolveBunExecutable()in that slot, so it still fails if a barebunreturns.Known red, same as main:
browse/test/cookie-import-native.test.ts> "production Node Playwright worker > real synthetic Playwright pipe smoke uses no TCP and leaves no browser" fails on this machine with a missingcookie_readstage. Its normalized output is byte-identical on origin/main and this branch, so it is environmental, not caused by this PR.Not verified here: real Windows behaviour. The contributor tested on Windows 11, and
windows-free-testsruns the new unit tests.Review (CREW rules 3 and 18): file-system probing only (
existsSyncon candidate paths); no egress, credential, dependency or CI-permission change, and no test weakened.Approvals
Evidence
browse/test/terminal-agent-bun-exe.test.ts10 pass (on main a module-load failure).bun run typecheck0 errors,typecheck:testno new diagnostics, spawnSync-timeout tripwire, module-size ratchet and bun-entry isolation 17 pass,gstack-pregate sealedclean, preflight pass.e6e3a43dd164(46 passed, 0 failed). READY sent unstamped; screen--screen(narrow, 3 cases + 1 judge), run 40140044423.Paid selection: browse-basic, browse-snapshot, diagram-triplet and the browse/SKILL.md judge; 14 browse and QA cases deferred to broad.
Co-authored-by: Adam Martin [email protected]