Repository navigation
Give Windows taskkill a 5s budget to reduce flaky tree cleanup - #28577
Conversation
On busy Windows machines, `taskkill` could take longer than the 2s budget used for other subprocesses. Tree termination then gave up before the process tree was confirmed gone. The taskkill timeout is now 5s, matching the other Windows tree-cleanup paths. Tests cover a slow taskkill that still verifies termination, and a hung taskkill that is bounded and falls back to SIGKILL. The batch-shim recovery test gets a longer hang and a 30s timeout so it has room on slow runners.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
- Expose the injected `now` clock to the structured agent session option writer, so timestamps come from the same source as the rest of the context. - Update the main and renderer layout-writer baselines to match the reduced line counts in `src/main/ipc/session.ts` and the removed `set-active-folder-workspace.ts` entry.
Problem
On Windows, Orca sometimes stops a program's leftover child processes by running
taskkill. It only gave that command 2 seconds. On a busy CI runner,taskkillcan take longer than that. Orca then gives up and reports the cleanup as unverified, and the related Windows test times out.Solution
Give
taskkill5 seconds, the same budget the other Windows cleanup paths already use. The Windows batch-launcher test also gets more room on slow runners. This is a partial fix. It makes slow runners less likely to time out, but iftaskkilltruly hangs, Orca still gives up after 5 seconds and reports the cleanup as unverified.ELI5
When Orca shuts down a program and its helpers on Windows, it waited too short a time for the shutdown command to finish. On a slow computer, it gave up too early and reported a failure. Now it waits a bit longer. If the command is truly stuck, it still gives up.
What Changed
process-tree-termination.ts: the Windowstaskkilltimeout goes from 2 seconds to 5 seconds (WINDOWS_TASKKILL_TIMEOUT_MS). The POSIX and other paths keep their existing timing.process-tree-termination.test.ts: new tests check that a slowtaskkill(3 seconds) still verifies tree termination, and that a hungtaskkillis cut off at 5 seconds and reported as unverified.preflight-runnable-local-cli.test.ts: the hung-launcher test's child runs for 60 seconds instead of 30, and its timeout goes from 15 to 30 seconds, so the probe, cleanup deadline, and recovery probe fit on a busy runner.Why
The 2-second limit was shorter than the other Windows cleanup paths already allow, so it failed on slow runners even when the cleanup would have worked. Matching the 5-second budget keeps the behavior consistent. Alternatives considered: removing the timeout (a truly hung
taskkillwould block forever) and retrying (more complexity for the same effect). Neither was chosen.Linked Issue
If you do not have one and are an outside contributors, your PR wiil be ignored. Refs is not sufficient. Link an actual issue
Fixes #
Visual Proof
N/A. This change touches only process-termination timing and tests. It has no UI or visible behavior change.
Testing
Added unit tests for the slow and hung
taskkillcases inprocess-tree-termination.test.ts, and updated the Windows batch-launcher test timing. Not yet run locally; the Windows-only tests need a Windows runner.AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)