Repository navigation
test(e2e): prove the terminal daemon survives a main-process crash on Windows (#7742) - #9311
Conversation
… Windows (#7742) Add a win-crash-survival e2e harness (sibling to win-update-e2e) that force-kills ONLY the packaged app's real Electron main (resolved via app.evaluate -> process.pid, /F no /T) and asserts the detached orca-terminal-daemon.exe plus its ConPTY shell survive with no pwsh 0xE9 FailFast, then that a relaunch re-adopts the SAME daemon and the reattached UI binds to the SAME survivor shell (proved via a per-shell env sentinel read back through the restored terminal). This guards the #7742 fix (standalone relocated daemon that outlives main death) against regression. A directional `--expect orphaned` profile fails on a fixed build, keeping the survival assertions honest. Windows-only; reuses win-update-e2e app-driver/daemon-process modules.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a Windows-only crash-survival E2E harness that forcefully terminates Orca’s Electron main process, checks daemon and shell survival, scans PowerShell event logs, and verifies relaunch reattachment through a sentinel and PID. It includes CLI parsing, assertion profiles, documentation, an npm script, scoped teardown, and shared E2E driver cleanup. A GitHub Actions workflow builds and installs the Windows app, runs the harness, and uploads logs and diagnostics. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
There was a problem hiding this comment.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6febb287-9092-4387-a57f-430adc046057
📒 Files selected for processing (10)
.github/workflows/win-crash-survival-e2e.ymlpackage.jsontools/win-crash-survival-e2e/README.mdtools/win-crash-survival-e2e/cli-args.mjstools/win-crash-survival-e2e/crash-assertions.mjstools/win-crash-survival-e2e/crash-step.mjstools/win-crash-survival-e2e/run.mjstools/win-update-e2e/README.mdtools/win-update-e2e/app-driver.mjstools/win-update-e2e/assertions.mjs
…h-restart-orphans-open-terminal-pty
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d8acc54e-f62b-40a4-941d-325f7037fca1
📒 Files selected for processing (7)
.github/workflows/win-crash-survival-e2e.ymlconfig/reliability-gates.jsoncconfig/scripts/win-crash-survival-e2e.test.mjstools/win-crash-survival-e2e/README.mdtools/win-crash-survival-e2e/reattach-proof.mjstools/win-crash-survival-e2e/run.mjstools/win-update-e2e/app-driver.mjs
🚧 Files skipped from review as they are similar to previous changes (4)
- config/reliability-gates.jsonc
- .github/workflows/win-crash-survival-e2e.yml
- tools/win-crash-survival-e2e/README.md
- tools/win-crash-survival-e2e/run.mjs
…h-restart-orphans-open-terminal-pty # Conflicts: # config/reliability-gates.jsonc
… Windows (stablyai#7742) (stablyai#9311) * test(e2e): prove the terminal daemon survives a main-process crash on Windows (stablyai#7742) Add a win-crash-survival e2e harness (sibling to win-update-e2e) that force-kills ONLY the packaged app's real Electron main (resolved via app.evaluate -> process.pid, /F no /T) and asserts the detached orca-terminal-daemon.exe plus its ConPTY shell survive with no pwsh 0xE9 FailFast, then that a relaunch re-adopts the SAME daemon and the reattached UI binds to the SAME survivor shell (proved via a per-shell env sentinel read back through the restored terminal). This guards the stablyai#7742 fix (standalone relocated daemon that outlives main death) against regression. A directional `--expect orphaned` profile fails on a fixed build, keeping the survival assertions honest. Windows-only; reuses win-update-e2e app-driver/daemon-process modules. * test(e2e): harden Windows crash-survival proof * test(ci): keep crash survival gate durable * test(e2e): tolerate restart hydration navigation * test(e2e): prove exact shell input after crash * perf(ci): avoid crash harness installer rebuilds * test(ci): harden crash survival evidence and cost * test(e2e): fail closed on authoritative crash target * test(e2e): fail closed on crash liveness evidence --------- Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
What & why
Adds a packaged Windows crash-survival E2E for #7742. It force-kills Orca's real Electron main and proves the detached terminal daemon, its ConPTY shell, and the UI binding all survive intact.
The review hardened the proof so missing or ambiguous evidence fails closed, fixed an existing Windows restart hydration flake exposed by the new gate, and removed avoidable installer rebuilds for harness-only changes. There are no production-path changes in this PR.
Reliability contract
terminal-session.windows-main-crash-survival— a packaged Windows main-process crash preserves the exact userData-scoped daemon and interactive shell; relaunch adopts that daemon and reattaches the same shell without a PowerShell0xE9FailFast.taskkill /F /PIDit without/Tand require that PID to die.$PIDthrough it. A respawned or unrelated shell cannot pass.terminal-session.windows-main-crash-survivalinconfig/reliability-gates.jsonc.Review hardening
Final evidence
Final SHA:
653b37c1501585dde550f5b8a339ce118f161f0f6428died5548survived and was adopted unchanged4780survived0xE9events after crash and reattach inputPerformance and scope
No production code runs any new work. The harness uses bounded 500 ms evidence polls, one 8 second soak, a 5 second failure-only authoritative-PID deadline, and a 30 second failure-only reattach deadline; the successful packaged run completed the same-shell probe on attempt 1 in a ~49-second harness run. Successful operations clear their deadline timers, and failure diagnostics run only on failure. The production-input cache key avoids repeated installer builds for harness/test/metadata edits while still invalidating on source, packaging, native, resource, lockfile, or build-config changes.
Windows local daemon + ConPTY + PowerShell is covered live. WSL-backed shells, concurrent live restoration across the user's multi-terminal/multi-worktree layout, standalone daemon self-crash, and a retained pre-relocation packaged red fixture remain explicit gaps. SSH/remote-runtime/mobile are outside this Windows relocated-host contract and are not changed.
Relates to #7742.
Made with Orca 🐋