fix(coding-agent): Windows support for kernel bootstrap and console-less daemon spawns - #825
Conversation
…ess daemon spawns On Windows, prime-agent's daemon and session workers run without a console. Every child_process spawn from those processes made Windows allocate a fresh console window, producing visible cmd window flashes at startup and every ~15s (git footer/context polling) and on every tool call. Additionally, the IPython kernel bootstrap hardcoded the POSIX venv interpreter path (bin/python), which does not exist in Windows venvs (Scripts/python.exe), so first-time setup deleted and rebuilt the venv in an endless failure loop. - Add windowsHide to all background child_process call sites (git polling, footer branch resolution, session-lease PowerShell queries, config/package-manager command probes, bash tool, exec, autonomous runner, kernel/fork-server/bootstrap spawns, daemon catalog process, fd autocomplete search, trash, gh, tar, clipboard helpers, rpc client) - Resolve the kernel venv interpreter as Scripts/python.exe on Windows (bin/python on POSIX) in bootstrap.ts - Tolerate directory fsync failures in the command recovery journal (Windows raises EPERM); the atomic rename still protects readers, matching the existing pattern in cron-jobs.ts
|
Thanks |
|
Real-user confirmation that this PR fixes all three Windows issues, tested on v0.7.1 (Windows 10 IoT Enterprise LTSC 2021):
I applied the equivalent changes to the installed v0.7.1 bundle and verified end-to-end on Windows: fresh daemon + real The PR is currently mergeable but blocked on review (no conflicts, untouched since Aug 7). It covers the scope of #660, #666, and #670 in one change, so a review/merge here would unblock the most-reported Windows issues at once. Happy to help with rebasing or additional testing if anything is needed. |
|
Thank you for the report and proposed work. This root cause is now covered by maintainer-owned stacked PR #1163, authored independently from We did not inspect or reuse this PR's diff, branch, commits, implementation code, or tests; its public description/comments were used only as a bug report. To keep one review surface, this PR is superseded by #1163 and is being closed. The complete review stack is #1158–#1165. It is being left unmerged for human review after CI and review-bot findings are cleared. |
Summary
On Windows, prime-agent's daemon and session workers run console-less. Every
child_processspawn from those processes makes Windows allocate a fresh console window, which users see as cmd windows flashing at startup, every ~15s (git footer/context polling), and on every agent tool call. Separately, the IPython kernel bootstrap hardcodes the POSIX venv interpreter path (bin/python), which doesn't exist in Windows venvs (Scripts/python.exe), so first-time setup on Windows deleted and rebuilt the kernel venv in an endless failure loop ("kernel is still bootstrapping... let me retry").Changes
core/kernel/bootstrap.ts): resolve the venv interpreter asScripts/python.exeon Windows,bin/pythonon POSIX, via a newvenvPythonPath()helper used by bothbootstrapVenv()andensureKernelPythonUncached().windowsHide: trueto all background child_process call sites that can run inside console-less daemon/worker processes: git context/branch polling (utils/git.ts,footer-data-provider.ts), session-lease PowerShell queries, config and package-manager command probes, bash tool,exec.ts, autonomous runner, kernel/fork-server/bootstrap spawns, daemon catalog process, fd autocomplete search (packages/tui), session trash,ghshare commands, tar/--version probes, clipboard helpers, rpc client. Interactive spawns (owned session worker with inherited stdio, external editors, self-update) and already-detachedspawns (which get no console on Windows) are intentionally left untouched.fsyncfailures (Windows raisesEPERM), matching the existing tolerant pattern incron-jobs.ts— the atomic rename still protects readers. This was spammingEPERM: operation not permitted, fsyncwarnings on every journal compaction.Testing
git.exespawn creating a newconhost.exe+OpenConsole.exepair (the visible flashes); after the fix, none are created.ipykernel,prime-agent-runtime,dilland default packages import correctly.biome check,tsgo --noEmit, installer and browser-smoke pre-commit checks all pass.test/kernel-bootstrap.test.ts,test/session-lease.test.tsandtest/ipython-provisioner.test.tsfail on Windows, but they fail identically on the pristine tree (they use POSIX shell-script fake executables) — pre-existing, not caused by this change.Note
Fix Windows support in coding-agent by hiding console windows and resolving venv Python paths
windowsHide: trueto allspawn/spawnSync/execFilecalls across the coding-agent and TUI packages so child processes no longer flash a console window on Windows.venvPythonPath()in bootstrap.ts to return the correct Python interpreter path per platform (Scripts/python.exeon Windows,bin/pythonon POSIX), replacing hardcodedbin/pythonpaths used during venv bootstrapping and kernel readiness checks.fsyncin a try/catch in command-recovery-journal.ts so journal writes succeed on filesystems that don't supportfsync(e.g. Windows NTFS), while still completing via atomic rename.Macroscope summarized 0df7848.