Repository navigation
fix(app): show a recovery screen instead of a blank window when a render throws - #4697
Conversation
…der throws
React unmounts the whole tree when a render throws, and the renderer had no
boundary above the routes — only LexicalErrorBoundary in the composer and the
tool-part boundary in components/chat/message-list.tsx. That second one already
documents this failure mode in its own comment ("without this boundary a single
bad part unmounts the entire app (white screen). Seen in production on v0.15.3").
The same shape reaches the whole app from route-level render work. #3372 is a
current example: a local MCP server configured with a string `command` throws
`config.command?.some is not a function` inside a `useMemo` in settings-route,
and the user gets a blank window with nothing to report.
This adds a last-resort boundary around the tree that shows the error, its
stack, a Reload button, and Copy details. It renders plain elements and does not
call `t()` on purpose: locale init runs before the tree mounts and has itself
been a startup failure (#2767), so the screen that reports a crash must not
depend on it.
This does not fix any individual crash — it stops them presenting as a blank
window.
Co-Authored-By: Claude <[email protected]>
…throws Extend the app-level error boundary from #3402 so a render throw above the routes (including inside providers or the activation gate) shows a recovery screen instead of an empty #root. The boundary wraps every provider in index.react.tsx and reads no React context. - Show the thrown message and stack. - Copy details puts message, stack, app version and distribution flavor on the clipboard; nothing is sent over the network. - Open logs folder reveals the server log through the existing __revealItemInDir bridge; hidden on the web and before activation where the bridge refuses the call. - Reload. - Dev-only eval.app.render_throw control action and a journey spec that drives the real desktop through the crash and back. Co-authored-by: pranshu26 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Passed · 1/1 tests · 2/2 assertions · 0 images Commit |
Warden review summary — ClearNative findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (35277 ms), confidentiality-review (49150 ms), spec-provenance-review (52466 ms), desktop-den-sync-review (55216 ms). Blockers
Advisories
Needs recheck
Observed review-thread metrics
Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority. |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (9e9ad071dffc1c1168b00797e145a49ba64a2d1b). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Match the disclosure shape used by session error cards and the boot-failure screen: headline, plain guidance and Reload first; the raw message, stack, Copy details and Open logs folder open on demand. Follow-up to #4697.
…catches the crash (#4699) #4697 mounted a root error boundary, so a first-launch render crash now renders "OpenWork hit an unexpected error" instead of unmounting the tree. React reports caught errors through console.error, not Runtime.exceptionThrown, so packaged-first-launch no longer stopped on the crash: it waited the full 60 s for the gate heading and failed with a timeout whose message buried the cause in the last-value dump. Treat the recovery heading as a terminal state, assert it is absent by name, and check for it instead of the stale "Something went wrong" text. Local lane, macOS arm64, electron-builder.enterprise.yml --mac --dir: - dev: passed (11.2 s) - dev with providers.tsx reverted to pre-#4696: failed in 8.0 s, "the root error boundary caught a first-launch render crash ... Local context is missing" (before this change: failed after 65.8 s with "Timed out waiting for enterprise first-launch gate")
Summary
Last-resort React error boundary around the whole desktop/web app. A throw during render — including inside
AppProvidersor the activation gate — now shows a recovery screen instead of an empty#root.Supersedes #3402 by @pranshu26 (rebased onto current
dev, boundary and test kept; recovery actions and journey proof added). Co-authored-by trailer is on the commit.Why
React unmounts the entire tree when a render throws. Until now the only boundaries were
LexicalErrorBoundaryand the tool-part boundary incomponents/chat/message-list.tsx; nothing sat above the routes. A pre-activation crash in an enterprise install is also invisible to telemetry by design (desktop Sentry only sends after a signed-in user/org), so the recovery screen must work with no network and no providers mounted. The provider-composition bug that surfaced this is fixed separately in #4606; this PR changes what any such crash looks like, not the individual cause.What changed
apps/app/src/react-app/shell/app-error-boundary.tsx— the boundary and its recovery screen. Sits above every provider inindex.react.tsx, reads no React context, not()(locale init has itself been a startup failure), no network.Errorthrows are stringified).OpenWork <version> (<deployment>, <flavor>), message, stack.openworkServerInfo+__revealItemInDirbridge. Hidden on the web and before enterprise activation, where the bridge refuses the call (and no server log exists yet).apps/app/src/index.react.tsx— wrap the tree insideStrictMode, outsideQueryClientProvider.apps/app/src/react-app/shell/app-root.tsx— dev-onlyeval.app.render_throwcontrol action (gated onimport.meta.env.DEV, next toeval.app.relaunch) so a journey spec can make the real app throw during render.apps/app/tests/app-error-boundary.test.tsx— unit coverage for the state transition, fallback markup, non-Error throws, and the exact copy payload.evals/specs/app-render-crash-recovery.e2e.test.ts+renderCrashWorldinevals/worlds/first-run.ts— journey spec.Proof
Journey spec:
pnpm evals:e2e app-render-crash-recovery—placement: daytona (daytona CLI authenticated), checkout9e9ad071dffc, 1 passed / 0 failed / 0 skipped, verdictpassed. Steps: app healthy with no recovery screen →eval.app.render_throwlands on the recovery screen showing the message, a stack naming the throwing component, Reload / Copy details / Open logs folder → Copy details flips to "Copied" and the clipboard holdsOpenWork <version> (desktop, public|enterprise), the message, and the stack → Reload restores the app and the recovery screen is gone.Also:
pnpm --filter @openwork/app typecheckexit 0;bun test --isolate tests/app-error-boundary.test.tsx7 pass / 0 fail; boundary and channel ratchets report nothing for the new spec.Evidence comment follows via
pnpm evals:e2e --publish.Rollback
Revert the commit — remove the wrapper in
index.react.tsx, the eval hook inapp-root.tsx, and the new files. Nothing else imports the boundary.