Repository navigation
fix(renderer): contain corrupt lazy chunks when the recovery reload never lands - #12950
Conversation
…ever lands
9 react-error-boundary crash reports across v1.4.171-1.4.175 (macOS, Linux,
Windows) all end the same way: a corrupt lazy chunk fails to import, recovery
requests a reload, the reload never lands, and loadLazyWithRetry re-throws the
raw SyntaxError/TypeError. RecoverableRenderErrorBoundary only suppresses
LazyChunkLoadError, so the raw error files a user-facing crash report.
LazyChunkLoadError was unreachable in production. Its precondition is a guard
written by a *different* document ('reload-landed'), but the finally block
clears that guard before the throw, so the only path that could construct it
never ran. Confirmed by the shipped bundles: 16/16 lazy_chunk_reload_vetoed
breadcrumbs carry outcome=never-landed, zero carry any other outcome, and no
bundle contains a boundary-degraded breadcrumb.
Route every exhausted-recovery path through exhaustedRecoveryFailure() so an
attempted-and-failed recovery yields a LazyChunkLoadError the boundary can
contain, and record a lazy_chunk_recovery_exhausted breadcrumb carrying the
call site, the real chunk error, and the outcome.
Deliberately unchanged: when recovery is never *attempted* (no window/SSR,
blocked sessionStorage, guard write failure) the raw error is still thrown so
normal crash reporting is unaffected. Only isKnownDynamicImportFailure matches
are contained, so module logic bugs keep reporting.
Hoist the dynamic-import message patterns to module scope so classification stops allocating seven RegExp objects per call, thread the already-computed classification into exhaustedRecoveryFailure so the guard-not-landed path does not re-run it, and bound recordedExhaustionKeys the way the breadcrumb and renderer-error key stores are bounded, since error.name is library-controlled. Failure path only; the success path is unchanged.
…lure path exhaustedRecoveryFailure ended in two adjacent booleans with opposite consequences: transposing them would have returned the raw SyntaxError and silently restored the crash this branch fixes, with no test able to catch it (the only call site passed true for both). The isChunkFailure parameter saved one regex scan on a path that only runs after a 10s reload wait, so drop it. Also evict recordedExhaustionKeys oldest-first instead of clearing wholesale, matching the breadcrumb and renderer-error key stores the comment cites, so an overflow cannot re-open the entire set to a repeat burst.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughLazy chunk recovery now wraps known dynamic-import failures in 🚥 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: 1
🧹 Nitpick comments (1)
src/renderer/src/lib/lazy-with-retry.ts (1)
196-203: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCondense the incident-history comments.
Keep the behavior rationale in source and tests. Move release versions, report counts, and incident identifiers to issue or PR documentation.
src/renderer/src/lib/lazy-with-retry.ts#L196-L203: Keep theSyntaxErrorclassification rationale and remove report-history detail.src/renderer/src/lib/lazy-with-retry.never-landed-reload.test.ts#L3-L7: State the never-landed reload scenario without release and report statistics.src/renderer/src/lib/lazy-with-retry.never-landed-reload.test.ts#L43-L45: State thatlocation.reload()is mocked to avoid navigation.src/renderer/src/lib/lazy-with-retry.never-landed-reload.test.ts#L93-L95: State the sibling-failure condition without incident identifiers or timings.As per coding guidelines, “Comments must be concise, limited to non-obvious information, and preferably one line.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0d5c0dea-a0c8-422d-b3ad-f67b6d33b8fb
📒 Files selected for processing (5)
src/renderer/src/components/error-boundaries/RecoverableRenderErrorBoundary.never-landed-reload.test.tsxsrc/renderer/src/components/error-boundaries/RecoverableRenderErrorBoundary.tsxsrc/renderer/src/lib/lazy-with-retry.never-landed-reload.test.tssrc/renderer/src/lib/lazy-with-retry.test.tssrc/renderer/src/lib/lazy-with-retry.ts
| // The end-to-end shape of the 9 shipped lazy-chunk crash reports: a corrupt chunk | ||
| // fails, recovery requests a reload, the reload never lands, and the boundary files | ||
| // a react-error-boundary crash report instead of containing the failure. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove the stale regression description.
Lines 3-5 describe the pre-fix failure as current behavior. Remove this comment. Lines 86-87 retain the relevant historical regression context.
As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
The bound had no coverage, unlike the crash-breadcrumb store it mirrors, so a refactor could drop it or invert the comparison with every test still green. Drive 200 distinct error names through the contained path and assert the set stays capped. Also move MAX_RECORDED_EXHAUSTION_KEYS above the comment that describes the set, not between them.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/lib/lazy-with-retry.ts (1)
151-179: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRecord the exhaustion breadcrumb after every exhausted recovery.
When
alreadyRecordedis true, this function does not recordlazy_chunk_recovery_exhausted. Lines 262-266 and 283-290 passtrueafter recordinglazy_chunk_reload_vetoed. Those attempted recovery failures are contained, but they lack the required exhaustion breadcrumb.Use
recordedExhaustionKeysto deduplicate the exhaustion event. Do not use the veto breadcrumb as a substitute.Proposed fix
function exhaustedRecoveryFailure( lastError: unknown, reloadKey: string, failureMessage: string, - outcome: string, - alreadyRecorded = false + outcome: string ): unknown { // ... - if (!alreadyRecorded && !recordedExhaustionKeys.has(crumbKey)) { + if (!recordedExhaustionKeys.has(crumbKey)) { // ... } } -throw exhaustedRecoveryFailure(lastError, reloadKey, failureMessage, outcome, true) +throw exhaustedRecoveryFailure(lastError, reloadKey, failureMessage, outcome) -throw exhaustedRecoveryFailure(lastError, reloadKey, failureMessage, 'guard-not-landed', true) +throw exhaustedRecoveryFailure(lastError, reloadKey, failureMessage, 'guard-not-landed')
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a9db5093-57de-4284-9e58-cfc8d7f93969
📒 Files selected for processing (2)
src/renderer/src/lib/lazy-with-retry.never-landed-reload.test.tssrc/renderer/src/lib/lazy-with-retry.ts
| it('bounds the exhaustion dedupe set so a hostile error name cannot grow it forever', async () => { | ||
| installBreadcrumbSink() | ||
| // error.name is library-controlled, so drive far more distinct keys than the cap. | ||
| window.sessionStorage.setItem(RELOAD_GUARD_KEY, 'doc-before-the-reload') | ||
| for (let index = 0; index < 200; index += 1) { | ||
| const error = new SyntaxError("Unexpected token '}'") | ||
| error.name = `SyntaxError${index}` | ||
| void loadLazyWithRetry(() => Promise.reject(error), { | ||
| retries: 0, | ||
| reloadKey: 'right-sidebar' | ||
| }).catch(() => undefined) | ||
| } | ||
| await vi.advanceTimersByTimeAsync(0) | ||
|
|
||
| expect(getRecordedExhaustionKeyCountForTest()).toBeLessThanOrEqual(128) | ||
| }) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Assert the expected retained-key count.
toBeLessThanOrEqual(128) passes if eviction clears the full set at the limit. After 200 distinct keys, oldest-first eviction must retain exactly 128 keys.
Proposed fix
- expect(getRecordedExhaustionKeyCountForTest()).toBeLessThanOrEqual(128)
+ expect(getRecordedExhaustionKeyCountForTest()).toBe(128)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it('bounds the exhaustion dedupe set so a hostile error name cannot grow it forever', async () => { | |
| installBreadcrumbSink() | |
| // error.name is library-controlled, so drive far more distinct keys than the cap. | |
| window.sessionStorage.setItem(RELOAD_GUARD_KEY, 'doc-before-the-reload') | |
| for (let index = 0; index < 200; index += 1) { | |
| const error = new SyntaxError("Unexpected token '}'") | |
| error.name = `SyntaxError${index}` | |
| void loadLazyWithRetry(() => Promise.reject(error), { | |
| retries: 0, | |
| reloadKey: 'right-sidebar' | |
| }).catch(() => undefined) | |
| } | |
| await vi.advanceTimersByTimeAsync(0) | |
| expect(getRecordedExhaustionKeyCountForTest()).toBeLessThanOrEqual(128) | |
| }) | |
| it('bounds the exhaustion dedupe set so a hostile error name cannot grow it forever', async () => { | |
| installBreadcrumbSink() | |
| // error.name is library-controlled, so drive far more distinct keys than the cap. | |
| window.sessionStorage.setItem(RELOAD_GUARD_KEY, 'doc-before-the-reload') | |
| for (let index = 0; index < 200; index += 1) { | |
| const error = new SyntaxError("Unexpected token '}'") | |
| error.name = `SyntaxError${index}` | |
| void loadLazyWithRetry(() => Promise.reject(error), { | |
| retries: 0, | |
| reloadKey: 'right-sidebar' | |
| }).catch(() => undefined) | |
| } | |
| await vi.advanceTimersByTimeAsync(0) | |
| expect(getRecordedExhaustionKeyCountForTest()).toBe(128) | |
| }) |
The bound test asserted only the size cap, so it stayed green under the old wholesale clear(): after 200 distinct keys a clear-on-overflow leaves 72, which still satisfies the cap. Replay a key that oldest-first eviction retains and assert it emits no second breadcrumb — that fails under clear(), which would otherwise silently re-open the whole set to a repeat burst and flush the 30-entry ring the dedupe exists to protect.
The lazy_chunk_recovery_exhausted breadcrumb was an optional addition that paid for itself in complexity and nothing else: it needed a dedupe set to avoid flushing the 30-entry ring, the set needed a bound because error.name is library-controlled, the bound needed an oldest-first eviction policy, and that needed two more tests plus a boolean parameter that review flagged as a transposition trap. On the dominant never-landed path it did not even fire, because lazy_chunk_reload_vetoed already records the same reloadKey, message and outcome. Drop it. Observability on every path returns to the main baseline, and the fix is what it always was: name an exhausted recovery so the boundary can contain it. Also revert the unrelated regex hoist -- its only caller is the failure path, so the saved allocations are noise.
Add test ensuring module evaluation bugs still surface despite never-landed reload attempts. Clarify containment scope: recovery only applies to known dynamic-import failures, not ordinary errors.
Reverts a gratuitous rename to reload-issued-not-landed. #12950 merged with never-landed, fleet crash triage queries that value, and the rename broke a merged test. The rename served nothing in this PR.
…lazy chunk After an update swaps assets under a live renderer, a lazy chunk import rejects with a SyntaxError and the recovery reload never lands (all shipped lazy_chunk_reload_vetoed breadcrumbs carry outcome=never-landed). Since #12950 the boundary contains the failure silently, but React.lazy caches the rejection forever, so its Retry button could never re-invoke the factory: the surface stayed dead until a manual app restart. lazyWithRetry now returns a wrapper that mints a fresh React.lazy when a reset remounts it after a caught chunk failure. Minting is gated on a retry epoch advanced only in the boundary's componentDidCatch, so React's own settle-driven remounts reuse the cached rejection instead of refetching a broken chunk in a loop; each fresh load costs a Retry press or a resetKey change. For the case where the assets are still broken, a contained LazyChunkLoadError fallback now explains that Orca may have updated and offers Restart Orca via the existing main-driven app:relaunch IPC, which a swallowed renderer-side location.reload cannot veto.
…lazy chunk After an update swaps assets under a live renderer, a lazy chunk import rejects with a SyntaxError and the recovery reload never lands (all shipped lazy_chunk_reload_vetoed breadcrumbs carry outcome=never-landed). Since #12950 the boundary contains the failure silently, but React.lazy caches the rejection forever, so its Retry button could never re-invoke the factory: the surface stayed dead until a manual app restart. lazyWithRetry now returns a wrapper that mints a fresh React.lazy when a reset remounts it after a caught chunk failure. Minting is gated on a retry epoch advanced only in the boundary's componentDidCatch, so React's own settle-driven remounts reuse the cached rejection instead of refetching a broken chunk in a loop; each fresh load costs a Retry press or a resetKey change. For the case where the assets are still broken, a contained LazyChunkLoadError fallback now explains that Orca may have updated and offers Restart Orca via the existing main-driven app:relaunch IPC, which a swallowed renderer-side location.reload cannot veto.
…lazy chunk After an update swaps assets under a live renderer, a lazy chunk import rejects with a SyntaxError and the recovery reload never lands (all shipped lazy_chunk_reload_vetoed breadcrumbs carry outcome=never-landed). Since #12950 the boundary contains the failure silently, but React.lazy caches the rejection forever, so its Retry button could never re-invoke the factory: the surface stayed dead until a manual app restart. lazyWithRetry now returns a wrapper that mints a fresh React.lazy when a reset remounts it after a caught chunk failure. Minting is gated on a retry epoch advanced only in the boundary's componentDidCatch, so React's own settle-driven remounts reuse the cached rejection instead of refetching a broken chunk in a loop; each fresh load costs a Retry press or a resetKey change. For the case where the assets are still broken, a contained LazyChunkLoadError fallback now explains that Orca may have updated and offers Restart Orca via the existing main-driven app:relaunch IPC, which a swallowed renderer-side location.reload cannot veto.
…ever lands (stablyai#12950) * fix(renderer): contain corrupt lazy chunks when the recovery reload never lands 9 react-error-boundary crash reports across v1.4.171-1.4.175 (macOS, Linux, Windows) all end the same way: a corrupt lazy chunk fails to import, recovery requests a reload, the reload never lands, and loadLazyWithRetry re-throws the raw SyntaxError/TypeError. RecoverableRenderErrorBoundary only suppresses LazyChunkLoadError, so the raw error files a user-facing crash report. LazyChunkLoadError was unreachable in production. Its precondition is a guard written by a *different* document ('reload-landed'), but the finally block clears that guard before the throw, so the only path that could construct it never ran. Confirmed by the shipped bundles: 16/16 lazy_chunk_reload_vetoed breadcrumbs carry outcome=never-landed, zero carry any other outcome, and no bundle contains a boundary-degraded breadcrumb. Route every exhausted-recovery path through exhaustedRecoveryFailure() so an attempted-and-failed recovery yields a LazyChunkLoadError the boundary can contain, and record a lazy_chunk_recovery_exhausted breadcrumb carrying the call site, the real chunk error, and the outcome. Deliberately unchanged: when recovery is never *attempted* (no window/SSR, blocked sessionStorage, guard write failure) the raw error is still thrown so normal crash reporting is unaffected. Only isKnownDynamicImportFailure matches are contained, so module logic bugs keep reporting. * perf(renderer): trim redundant work on the lazy-chunk failure path Hoist the dynamic-import message patterns to module scope so classification stops allocating seven RegExp objects per call, thread the already-computed classification into exhaustedRecoveryFailure so the guard-not-landed path does not re-run it, and bound recordedExhaustionKeys the way the breadcrumb and renderer-error key stores are bounded, since error.name is library-controlled. Failure path only; the success path is unchanged. * refactor(renderer): remove a transposition trap on the lazy-chunk failure path exhaustedRecoveryFailure ended in two adjacent booleans with opposite consequences: transposing them would have returned the raw SyntaxError and silently restored the crash this branch fixes, with no test able to catch it (the only call site passed true for both). The isChunkFailure parameter saved one regex scan on a path that only runs after a 10s reload wait, so drop it. Also evict recordedExhaustionKeys oldest-first instead of clearing wholesale, matching the breadcrumb and renderer-error key stores the comment cites, so an overflow cannot re-open the entire set to a repeat burst. * test(renderer): cover the exhaustion dedupe bound The bound had no coverage, unlike the crash-breadcrumb store it mirrors, so a refactor could drop it or invert the comparison with every test still green. Drive 200 distinct error names through the contained path and assert the set stays capped. Also move MAX_RECORDED_EXHAUSTION_KEYS above the comment that describes the set, not between them. * test(renderer): pin the exhaustion eviction policy, not just the cap The bound test asserted only the size cap, so it stayed green under the old wholesale clear(): after 200 distinct keys a clear-on-overflow leaves 72, which still satisfies the cap. Replay a key that oldest-first eviction retains and assert it emits no second breadcrumb — that fails under clear(), which would otherwise silently re-open the whole set to a repeat burst and flush the 30-entry ring the dedupe exists to protect. * refactor(renderer): cut the breadcrumb machinery down to the actual fix The lazy_chunk_recovery_exhausted breadcrumb was an optional addition that paid for itself in complexity and nothing else: it needed a dedupe set to avoid flushing the 30-entry ring, the set needed a bound because error.name is library-controlled, the bound needed an oldest-first eviction policy, and that needed two more tests plus a boolean parameter that review flagged as a transposition trap. On the dominant never-landed path it did not even fire, because lazy_chunk_reload_vetoed already records the same reloadKey, message and outcome. Drop it. Observability on every path returns to the main baseline, and the fix is what it always was: name an exhausted recovery so the boundary can contain it. Also revert the unrelated regex hoist -- its only caller is the failure path, so the saved allocations are noise. * Verify ordinary errors bypass lazy chunk containment Add test ensuring module evaluation bugs still surface despite never-landed reload attempts. Clarify containment scope: recovery only applies to known dynamic-import failures, not ordinary errors.
Description
Nine
react-error-boundarycrash reports filed to #orca-crashes (2026-08-05 → 08-06) share one ending: a corrupt lazy-loaded JS chunk failsimport(),loadLazyWithRetryrequests a recovery reload, the reload never lands, and the wrapper re-throws the rawSyntaxError/TypeError.RecoverableRenderErrorBoundaryonly suppressesLazyChunkLoadError, so a raw error files a user-facing crash report.The crashes span four releases and all three platforms, so this is not one bad build:
131d2ed2app.roota7bc7be0app.roote2c7e3b8overlay.update-cardUnexpected token '}'c7dd5914overlay.update-cardUnexpected token '}'5e6beae8overlay.floating-workspaceUnexpected token '}'bf55f7c4right-sidebarInvalid or unexpected token6b619f79sidebar.worktreesUnexpected stringe6d5f954sidebar.worktreesUnexpected token '}'9e424656terminal.workbenchUnexpected token ':'Root cause
LazyChunkLoadError— the only error the boundary suppresses — was unreachable in production. Its precondition is a reload guard written by a different document ('reload-landed'), but thefinallyblock callsclearChunkReloadGuard()before the throw, deleting that precondition. The one path that could construct it never ran, so every failure reached the boundary raw.CLEAR, UNDENIABLE fix evidence
1. Production telemetry, from the shipped diagnostics bundles of all 10 reports:
lazy_chunk_reload_vetoedwithoutcome=never-landedoutcome=unload-vetoed/checkpoint-refused/request-failedrenderer_bootstrap_startedafter anylazy_chunk_reloadlocation.reload()produced zero navigationsLazyChunkLoadErrorwas never constructedreloadKey'unknown'35 / 35The veto signal is wired end-to-end (
createMainWindow.ts:1057→renderer-restart-wiring.ts:27→ window event), so a genuinebeforeunloadveto would have surfaced asunload-vetoed. Zero of those across 16 attempts proves the reload is not being blocked — it silently does nothing. The fix therefore must not depend on the reload landing.2. Red → green. The new tests reproduce the exact production path. On unmodified
main:Every new test fails on
mainand passes with the fix — there are no vacuous tests left.The boundary test fails on
mainfor exactly the shipped reason — it files a report carrying[SyntaxError: Unexpected token '}']withat Lazy (<anonymous>)in the component stack, byte-for-byte the shipped signature. With the fix: 35 passed (35) in the lazy-chunk/boundary suites, and 793 files / 7857 tests pass, 0 failures acrosslib,error-boundaries,editor, andterminal-pane.3. Not already fixed. Both prior attempts (#11929
3f8654c26e, #126005f187e0836) are contained inv1.4.175, and no commit onmainsince toucheslazy-with-retry.ts,lazy-chunk-recovery-reload.ts, orerror-boundaries/. The defect is live onmain.ELI5
Orca loads parts of its UI on demand, like fetching a chapter of a book only when you turn to it. Sometimes a chapter comes back damaged and unreadable.
Orca's plan for that was "reload the whole book, that usually fixes it." So it asks for a reload and waits 10 seconds. The reload never actually happens — provably, because a reload would have restarted the app and nothing ever restarted.
After those 10 seconds Orca gives up and hands the damaged-chapter error upstairs. Upstairs there is a rule: "if this is the special damaged chapter error, quietly show a placeholder — don't alarm the user." But Orca handed up the original raw error, not the special one, so the rule never matched and you got a crash popup.
This change makes Orca label the error properly when it gives up, so the rule matches and you get a contained placeholder instead of a crash report.
Trade-offs and behaviour changes
These are real; please weigh them.
lazy_chunk_recovery_exhaustedbreadcrumb carrying the call site, the real chunk error and the outcome, plus the boundary's existingconsole.error. Recommended follow-up: record a non-prompting crash report (a statusgetLatestPendingReportskips) so evidence still reaches us. Attempted here and reverted — see Rejected approaches.location.reload()not navigating is untouched. This PR stops the crash reports; it does not repair the corrupt chunk. The affected panel stays broken until restart, and the fallback's Retry button cannot fix it (React caches the lazy rejection permanently). Users now get a quiet degraded surface instead of a crash dialog that at least implied "restart me".SyntaxErrors are contained too.isKnownDynamicImportFailurematches anySyntaxErrorby name, so aSyntaxErrorthrown while evaluating a lazily imported module (e.g. a top-levelJSON.parse) is indistinguishable here and would now be contained rather than reported. Verified currently latent: no top-levelJSON.parseand only staticnew RegExptemplates insrc/renderer/src.Unchanged on purpose: when recovery is never attempted — no
window(SSR), blockedsessionStorage, or a failed guard write — the raw error is still thrown, so normal crash reporting is unaffected.Rejected approaches
crash-report-store.record()hardcodesstatus:'pending'andgetLatestPending()re-reads it, so it would have deferred the prompt to the next launch rather than removing it — worse than the status quo. Doing it properly needs a new status the pending query skips (follow-up above).SyntaxError(would address trade-off 3). Parser errors carry no JS frames, and all 9 shippederror_stackvalues confirm zero frames — but it broke 19 tests and relies on V8 never adding frames to parse errors. A false negative silently restores the crash, so the risk outweighs the latent benefit.Adversarial review
6 loops, each a fresh sub-agent, run until clean:
promptUsermechanism would have re-prompted on next launch (record()hardcodesstatus:'pending') → fully reverted. Breadcrumb renamed to avoid a schema collision. A suggested predicate tightening was rejected with evidence — it would break containment for 3 of the 4 observed messages.reloadKeydedupe so a corrupt shared chunk cannot flush the 30-entry ring;guard-not-landedgated so an unrelated error cannot clear a guard it did not set; breadcrumb assertions added. HIGH (visibility) accepted and documented above.exhaustedRecoveryFailureended in two adjacent booleans whose transposition would silently return the raw error and restore this very crash, uncatchable by tests. Parameter removed ina142828809./i-only, and a 660-case differential run showed zerolastIndexdrift. Set eviction switched to oldest-first to match the stores it cites; bound test added.origin/main.origin/mainafterwards: 5/5 fail, 5/5 pass.One loop-6 observation is not reflected above because I could not confirm it: it suggested that call sites without a nearby boundary would still file crash reports, which would soften trade-off 1. The renderer has exactly two boundary classes (
RecoverableRenderErrorBoundary,RichMarkdownErrorBoundary) and both suppressLazyChunkLoadError, so React propagates to one of them in every case. The visibility trade-off stands as written.Size and scope
The production change is 44 insertions / 22 deletions, much of it comment. The logic is a 6-line helper plus four call sites:
The remaining ~250 lines are tests, which are the reproduction evidence.
An earlier revision of this PR was roughly twice the size. It added a
lazy_chunk_recovery_exhaustedbreadcrumb, which then required a dedupeSet(to avoid flushing the 30-entry ring), a bound on that set (error.nameis library-controlled), an oldest-first eviction policy, two more tests, and an extra boolean parameter that review flagged as a transposition trap capable of silently restoring this very crash. On the dominantnever-landedpath the breadcrumb did not even fire, becauselazy_chunk_reload_vetoedalready records the samereloadKey, message and outcome. It was all removed: observability on every path is back to themainbaseline, and the diff is now the fix and nothing else.Performance
No measurable impact. The success path is untouched — every change is after the retry loop, reachable only once
factory()has rejectedretries+1times. On the failure path the change is strictly cheaper thanmain: previously a corrupt shared chunk failing N sibling imports produced N raw errors that each reachedreportReactErrorBoundaryCrash, and because the renderer dedupe keys oncomponentStack, sibling boundaries did not dedupe against each other — each paid a dynamicimport('@/store'), aJSON.stringifyover the full component stack, and an IPC that persists a crash report to disk. That becomes zero.Test plan
npx vitest run --config config/vitest.config.ts src/renderer/src/lib src/renderer/src/components/error-boundaries src/renderer/src/components/editor src/renderer/src/components/terminal-pane→ 793 files / 7857 tests passnpm run check:max-lines-ratchet→ OK, no new bypassesnpm run check:reliability-gates→ 69 gates passnpx tsc --noEmit -p config/tsconfig.tc.web.json→ cleannpx oxlint/npx oxfmt --check→ cleanNot included
a69f8cb9(win32, React #185 inTerminalPaneOverlayLayer) is a different defect and is not fixed here. It was diagnosed but not reproduced, so no speculative fix was shipped. Notably, its prior fix (#126005f187e0836) is contained in v1.4.174/175 and the crash still occurred on 1.4.175, so the existing flip damping is insufficient. Working hypothesis:recordParkVerdictFlipswatches the post-gateparkedTerminalTabIds, while the effect'ssetStateis the pre-gatesetColdParkedTerminalTabIds; a pre-gate oscillation masked by a gate would loop forever, record no flips, and never engage damping — which is keyed on those same flip records. Consistent with the bundle containing zero park-verdict-flip breadcrumbs.