fix(windows): stop the service wrapper killer using the argv Bun rejects - #1944
fix(windows): stop the service wrapper killer using the argv Bun rejects#1944lidge-jun wants to merge 1 commit into
Conversation
src/service.ts spawned PowerShell with "-WindowStyle", "Hidden" as argv elements. src/codex/user-identity.ts:222-224 already forbids exactly that: Bun 1.3.14 can fail the direct CLI pair before the command runs (#1589), and the process-level windowsHide flag is what actually suppresses the window. The call is not decorative. stopServiceIfInstalled() uses it because schtasks /end can leave the wscript.exe/cmd.exe wrapper alive to respawn the proxy, and it ignores spawnSync's exit status. Under #1589 wrapper termination silently does nothing, so ocx stop, restart and update report success without sticking. The invariant survived as prose plus a single-file assertion: tests/windows-deploy-close-regressions.test.ts:43 pins the argv only for src/update/job.ts (the variable is bound at line 13), so service.ts was never covered. Replaced with a sweep over every src/**/*.ts, which found exactly one offender. The sweep matches the argv form only. Six call sites legitimately pass -WindowStyle Hidden inside a PowerShell script string handed to Start-Process (windows-elevation.ts 622/660/687/736, tray/windows.ts:489, update/job.ts:574); Bun never parses those. A second test pins that discrimination in both directions so the sweep cannot quietly become vacuous or start failing correct code. Driven red first: the sweep reported ["service.ts"] before the fix. Verification: bun test tests/windows-popup-fix.test.ts (7 pass), bun test tests/service.test.ts tests/windows-deploy-close-regressions.test.ts (131 pass), bun run typecheck clean.
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe Windows service-wrapper cleanup command removes the Bun-incompatible ChangesWindows PowerShell cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized Windows fix prevents the service wrapper from being invoked with rejected arguments and adds coverage for the affected behavior; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
src/service.tsspawned PowerShell with"-WindowStyle", "Hidden"as argv elements.src/codex/user-identity.ts:222-224already forbids exactly that: Bun 1.3.14 can fail the direct CLI pair before the command runs ([Bug] Windows PowerShell-WindowStyle Hiddencauses EACLIDENTITY under Bun #1589), and the process-levelwindowsHideflag is what actually suppresses the window.stopServiceIfInstalled()uses it becauseschtasks /endcan leave thewscript.exe/cmd.exewrapper alive to respawn the proxy, and it ignoresspawnSync's exit status. Under [Bug] Windows PowerShell-WindowStyle Hiddencauses EACLIDENTITY under Bun #1589 wrapper termination silently does nothing, soocx stop, restart and update report success without sticking.tests/windows-deploy-close-regressions.test.ts:43pins the argv only forsrc/update/job.ts(the variable is bound at line 13), soservice.tswas never covered. Replaced with a sweep over everysrc/**/*.ts, which found exactly one offender.-WindowStyle Hiddeninside a PowerShell script string handed toStart-Process(windows-elevation.ts622/660/687/736,tray/windows.ts:489,update/job.ts:574); Bun never parses those. A second test pins that discrimination in both directions so the sweep cannot quietly become vacuous or start failing correct code.First of a stacked chain implementing
devlog/_plan/260817_windows_stability_program/(phase010). This one targetsdev.Verification
["service.ts"]before the fix.bun test tests/windows-popup-fix.test.ts— 7 passbun test tests/service.test.ts tests/windows-deploy-close-regressions.test.ts— 131 passbun run typecheck— cleanChecklist
Summary by CodeRabbit
Bug Fixes
Tests