Fix lazy chunk reload crash classification
Description
Fixes the report-01 crash bucket from windows-renderer-crashes-2026-06-30/01-renderer-killed-surenge (report 9b46af08-2f01-4652-9e1d-3827280090b7).
The crash bundle showed a lazy_chunk_reload breadcrumb for a recovered dynamic-import parse failure (Unexpected identifier 'as'), followed by a fresh renderer bootstrap, then the old renderer's render-process-gone event as killed (1). That sequence means recovery worked, but main did not know the renderer teardown was expected, so the intentional reload could still be surfaced as a crash.
This PR adds a preload IPC signal for lazy chunk recovery. Before window.location.reload(), the renderer marks its current webContents as an expected reload in main, then records the existing breadcrumb and reloads.
ELI5
When Orca sees that one of its downloaded app pieces is stale or broken, it intentionally refreshes the window to get a clean copy. On Windows, that refresh can look like "the renderer was killed" from the outside. Now the renderer tells the main process "I am about to refresh on purpose" before it does, so Orca does not mistake its own recovery refresh for a scary crash.
Evidence
- Crash-bundle diagnosis:
01-renderer-killed-surengehadlazy_chunk_reload-> new renderer bootstrap -> old rendererkilled (1), matching intentional lazy chunk recovery rather than a native crash. - Head tested:
92d75cfe8f3ffe0f7e771277bf50da949b231cbe. pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/lazy-with-retry.test.ts src/main/ipc/crash-reporting.test.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts-> 3 files / 305 tests passed.pnpm run typecheck-> node, cli, and web TypeScript checks passed.- Pre-commit hooks ran
oxlint,oxlint --config config/oxlint-react-doctor.json, andoxfmt --writeon staged files. - GitHub checks passed on the updated PR head:
verifyandwayland terminal input. - Windows Electron smoke via CDP on port 9336 with isolated profile:
- Verified app identity for this worktree/branch.
- Added disposable Git repo with 8 external worktrees under
%TEMP%, including paths with spaces, dirty tracked files, untracked files, and ignored files. - Made external worktrees visible, opened Source Control, and activated all 9 checkouts across 3 rounds.
- Ran 27 status refresh cycles using
git.status({ includeIgnored: true }), ignored-path checks, diffs for changed files, upstream probes, and worktree rediscovery. - Kept a real browser webview open (
https://example.com/) during the smoke. - Final visible UI showed
repro/worktree-8selected with Source Control open and 80 changed files rendered. - CDP target list still had both the Orca page and the browser webview; smoke marker stayed alive; no Playwright page crash/pageerror events; logs had no process-gone/OOM/fatal lines.
Tradeoffs
- The new expected-reload marker is best-effort. If IPC is unavailable or races with teardown, recovery still reloads, and classification falls back to existing behavior.
- This only marks the lazy-chunk recovery reload path. Native renderer crashes, OOMs, GPU crashes, and unrelated kills still go through normal crash reporting.
- The web preload implementation is a no-op because web builds do not have Electron
webContentsprocess-gone classification.
📝 Walkthrough
Walkthrough
This change adds a markExpectedRendererReload signal across preload, main IPC, and renderer reload recovery paths. The main process now forwards the signal through crash-reporting handlers and calls it during relaunch after preserving agent auth. The renderer calls the signal before its guarded reload path and records breadcrumbs afterward. Web preload exposes a no-op version, and tests cover the IPC handler and reload ordering.
Changes
| Area | Change |
|---|---|
| Main process | onBeforeRelaunch calls markExpectedRendererReload after auth preservation |
| Main IPC | registerCrashReportingHandlers accepts options with markExpectedRendererReload callback; new IPC listener forwards sender.id |
| Core handlers | CoreHandlerLifecycleOptions gains markExpectedRendererReload callback, wired to crash-reporting registration |
| Preload | PreloadApi type and Electron preload implementation add crashReports.markExpectedRendererReload() |
| Renderer | lazy-with-retry.ts calls markExpectedRendererReload() before guarded reload/breadcrumb |
| Web preload | No-op markExpectedRendererReload added |
| Tests | New/updated tests for IPC handler and reload recovery ordering |
Sequence Diagram(s)
sequenceDiagram
participant Renderer
participant Preload
participant MainIPC
participant LifecycleOptions
Renderer->>Preload: crashReports.markExpectedRendererReload()
Preload->>MainIPC: send crashReports:markExpectedRendererReload
MainIPC->>LifecycleOptions: markExpectedRendererReload(sender.id)
Renderer->>Renderer: recordBreadcrumb + window.location.reload()
Related PRs: None identified from the provided information.
Suggested labels: none identified
Suggested reviewers: none identified
Poem: A marker sent before the spin,
then reload starts from deep within.
IPC, preload, and main align,
to mark the reload as by design.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | ⚠️ Warning | The PR description is informative, but it misses the required template sections for Summary, Screenshots, AI Review Report, Security Audit, and Notes. | Rewrite the description to follow the repo template and add the missing sections, especially screenshot status, AI review details, security audit, and notes. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title matches the main change: marking lazy chunk recovery reloads as expected to avoid crash misclassification. |
| 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-03T06:39:53Z; 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.