Fail e2e on abnormal Electron shutdown
## Description
- Make the shared Electron e2e shutdown helper fail when Electron has already exited with a non-zero code or signal.
- Keep the existing cleanup tolerance for close failures/timeouts where the process is still alive and the helper needs to force-kill it.
- Add unit coverage for clean shutdown, Windows native crash exit code
3221225477(0xC0000005), signal exits, and the existing close-failure cleanup tolerance.
Evidence
Crash-pass context: while restoring the Windows worktree-switch smoke, one local run had passing Playwright assertions but forwarded this Electron process exit:
exit: code=3221225477 signal=null
That unsigned Windows value is the same access-violation status family as the original renderer crash code -1073741819 (0xC0000005). The exit did not reproduce in the next four smoke runs and left no recent Application Error / Windows Error Reporting event, so this PR does not claim a product crash root cause. It does fix the test blind spot: an abnormal Electron exit during e2e shutdown should fail the run instead of only appearing in forwarded logs.
Validation run on Windows:
pnpm exec vitest run --config config/vitest.config.ts tests/e2e/helpers/electron-process-shutdown.unit.test.ts
pnpm exec oxlint tests/e2e/helpers/electron-process-shutdown.ts tests/e2e/helpers/electron-process-shutdown.unit.test.ts
pnpm exec oxfmt --check tests/e2e/helpers/electron-process-shutdown.ts tests/e2e/helpers/electron-process-shutdown.unit.test.ts
pnpm run typecheck
Result: all passed.
ELI5
If the app crashes right as a test is closing it, the test should not smile and say everything passed. This makes the test notice that bad exit code and fail loudly.
Tradeoffs
- A real abnormal Electron shutdown will now fail e2e teardown, so this can expose existing native shutdown flakiness that was previously hidden.
- Forced cleanup after a close timeout is still tolerated to avoid turning already-known teardown cleanup races into a broader behavior change.
📝 Walkthrough
Walkthrough
Changes
This change adds abnormal-exit detection to the Electron process shutdown test helper. A new internal function classifies process termination as clean or abnormal based on exit code and signal. The shutdown function now force-kills on timeout with early return, throws on detected abnormal exit, and in its catch block recomputes the abnormal-exit state, force-kills the process if present, and rethrows an error preserving the original as its cause. A new unit test file covers clean shutdown, native crash exit codes, signal-based exits, and tolerance of exceptions thrown during app close.
Sequence Diagram(s)
Included in the hidden review stack artifact above.
Estimated code review effort: 3/5
Related PRs: None identified.
Suggested labels: tests, e2e
Suggested reviewers: None identified.
Poem: A rabbit watched the process die, checking codes with a careful eye. Signal or crash, timeout or not, force-kill quick before it's caught. Now every exit tells its tale — tests confirm the whole safety rail. 🐇
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | ⚠️ Warning | The description explains the change and testing, but it omits required template sections like Screenshots, AI Review Report, Security Audit, and Notes. | Add the missing template sections, or explicitly mark screenshots as no visual change and include AI review, security audit, and notes details. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title accurately summarizes the main change: failing e2e when Electron exits abnormally. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
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 @coderabbitai help to get the list of available commands.
Moving this PR to draft because it has been untouched for more than 80 days (latest recorded PR activity or commit timestamp: 2026-07-03T08:24:46Z; checked on 2026-10-27). This keeps the review queue focused on active work while preserving the proposal. Please mark it ready for review when work resumes.