Repository navigation
fix(orcad): Windows orcad stops cleanly when its Electron browser sidecar's profile is still locked - #29562
Merged
Conversation
… orcad's stop on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On a Windows machine that also has the Orca desktop app installed, the headless Orca server (orcad) borrows that app as its browser. When orcad stopped, it tried to delete the borrowed browser's scratch folder right after killing it, but Windows was still holding the folder for a moment. That delete failed, and orcad treated the whole stop as failed: it exited with an error and kept its instance lock. Now a scratch folder that won't delete just gets a warning, and the stop still succeeds.
Separately, the CI test that checks orcad's stop timed out on Windows ARM runners. orcad itself stopped fine there. The test's cleanup (deleting its temp folder) was simply slower than its 60-second allowance.
What Changed
src/main/orcad/electron-serve-browser-process.ts:stop()now removes the sidecar's temporary profile with the sharedremoveTreehelper (Node's Windows retry policy) and only logs a failure instead of throwing it. Before: on Windows, orcad's stop could fail withEBUSY ... orcad-browser-XXXXand exit 1 without releasing its instance lock. After: orcad exits 0 and releases the lock. At worst a throwaway temp folder is left behind.src/main/orcad/orcad-stop-request-shutdown.integration.test.ts: theafterEachteardown gets 180 s instead of Vitest's default 60 s.Why
windows-11-arm, instrumented runs at current main and at 7005af3 alike took 14–22 s to delete the test's freshly written slot and runtime, even with no process left under the root. Under full-suite load, that went past 60 s. The 64 s failures (about 4 s of test body plus exactly 60 s of hook) match this. This isn't a regression from fix(ssh): agents on a managed SSH host can drive the desktop Orca browser again, behind the per-host switch #29384: the same timings show up at 7005af3 and with that change reverted.Linked Issue
Linear STA-10787
Visual Proof
N/A: no UI change. These are orcad shutdown and test-teardown changes.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New unit test:
electron-serve-browser-process.test.ts"still stops cleanly when the sidecar profile stays locked after the process exits". It fails before the fix (stop rejects with EBUSY) and passes after.Windows x64 (
awin, Orca desktop installed, test pinned to 1 CPU): before, the stop-request integration test failed 5/6 on main and 4/4 at 7005af3 with orcad exiting 1 onEBUSY orcad-browser-*. After the fix, orcad exited 0 every time.With the installed app hidden from the test, main and 7005af3 both passed 8/8 at 1 CPU and 11/11 unconstrained. macOS passes too.
windows-11-armdispatch runs at main, at main with the fix(ssh): agents on a managed SSH host can drive the desktop Orca browser again, behind the per-host switch #29384 lifecycle lines reverted, and at 7005af3 all passed with an instrumented, longer hook timeout. They show where the teardown time goes.AI Disclosure
Review
Codex review (gpt-6.1-sol, high): no findings.
Agent skill upstream boundary
Notes
Cross-platform:
removeTreeadds retries only on Windows. On macOS and Linux the behavior is unchanged except that a failed delete no longer fails the stop. SSH: this is the execution host's own orcad stop. No wire change.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)