Skip to content

Load a part of the app that didn't download again, and show OpenBot's error screen - #2092

Merged
davidmckayv merged 2 commits into
mainfrom
fix/chunk-load-recovery
Nov 23, 2026
Merged

davidmckayv merged 2 commits into
mainfrom
fix/chunk-load-recovery

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

What happened

In OpenBot Desktop's window on OpenBot Cloud, coming back to a conversation showed the router's own error screen in the pane: "Something went wrong!" and, behind Show Error, WebKit's "Importing a module script failed." The sidebar stayed. The pane stayed dead.

Why

The build splits the app into files fetched the first time a screen or a part of one is drawn: a route's component (TanStack Router's code splitting) and parts a dependency loads lazily, such as Streamdown's code block. OpenBot serves only the files of the build it runs and answers 404 for any other. A page left open across a release asks for a file the new release no longer has, and the import fails.

Nothing recovered from that:

  • A part loaded with React's lazy keeps its failure for good and throws it to the route's error boundary.
  • TanStack Router's own reload for a route's file is remembered per error message for the whole session. In WebKit the message is the same for every file, so it reloads at most once per window. A second release in the same Desktop window lands on the error screen.
  • The router's error component (ReportedErrorComponent, app/src/lib/error-reporting.tsx) fell through to TanStack's default ErrorComponent.
  • Once an import of a file failed, Chromium and WebKit fail every later import of it in the same page without asking the network again, so retrying in place can't work. Loading the page again is the only retry.

The fix

  • app/src/lib/chunk-recovery.ts: tells a failed chunk import apart (Chromium, Firefox, WebKit and Vite's words). It asks OpenBot which build it serves now (/, never cached), up to three times over a few seconds. With an answer, the page loads again by itself, once, and gets the build OpenBot serves. A session-storage guard allows this once per build per ten minutes, so a file that is gone for good, or a stale cache in front of OpenBot, ends on the error screen and never loops. With no answer (OpenBot out of reach) it does not reload into the browser's own "can't connect".
  • app/src/components/layout/route-error.tsx: OpenBot's own error screen for any route error, in the frame the sign-in and no-organization screens use. It says plainly what failed and offers Reload. It shows the error's details (what failed, page, release and build, app, browser, time, stack) with Copy details for a bug report, and in OpenBot Desktop it offers Open log folder, the same action Settings has. Nothing is drawn while a page recovers, so a page that loads again never flashes an error.
  • ReportedErrorComponent draws it in place of the router's default. Reporting is unchanged.

No server change. The server's no-store 404 for a file it doesn't have is what lets the page recover, and keeping a previous build's files would need storage shared across releases. Loading the page again to the served build is the standard answer, and Vite's docs recommend it for vite:preloadError.

Tests

  • app/tests/chunk-recovery.test.tsx, real browser, Chromium and WebKit, light and dark (added to the WebKit job, which runs both): code split into real files behind the app's error screen, served per build with 404 for other builds' files. A release loads the new build once, for a lazily loaded part and for a route across two releases in one window. A file that failed once is fetched again. A file that stays missing ends on OpenBot's error screen after one reload, with no loop, and the details are on screen and on the clipboard. A stale cache loads again only once. With OpenBot out of reach the page stays. In Desktop's window, Open log folder asks the desktop app. Before the fix 17 of 18 fail, including the WebKit second-release case that matches the report. After the fix all pass.
  • app/tests/chunk-recovery-rules.test.ts: the engines' real messages and the reload guard.
  • Checked on the real Vite build of the app, signed in, served as the server serves app/dist, opening Routines after a release while a conversation is open. Before the fix WebKit showed exactly the reported screen. After it, the page loads the new build and shows Routines. With the file gone for good it shows the new error screen in the pane.

… error screen

Back in a conversation after another one, OpenBot Desktop's window showed
the router's own "Something went wrong!" with WebKit's "Importing a module
script failed." in the pane, and stayed there. A file of the app's code
was asked for after a release had replaced the build that named it, and
the OpenBot answered 404. A part loaded with React's lazy keeps that
failure for good, TanStack Router's own reload is remembered per message
for the session (one message for every file in WebKit), and the route's
error component fell through to the router's default screen.

A failed chunk import now asks the OpenBot which build it serves, up to
three times, and loads the page again once to get it, guarded per build
for ten minutes so it never loops. Loading again is the only retry: the
browsers fail every later import of a file whose import failed. With no
answer, or after that, the route shows OpenBot's own error screen: what
failed, Reload, the details to copy into a bug report, and in OpenBot
Desktop its log folder.
@davidmckayv
davidmckayv force-pushed the fix/chunk-load-recovery branch from 7e58dca to ee6216c Compare November 23, 2026 22:21
@davidmckayv
davidmckayv merged commit 95c68a1 into main Nov 23, 2026
35 checks passed
@davidmckayv
davidmckayv deleted the fix/chunk-load-recovery branch November 23, 2026 22:30
davidmckayv added a commit that referenced this pull request Nov 24, 2026
davidmckayv added a commit that referenced this pull request Nov 24, 2026
davidmckayv added a commit that referenced this pull request Nov 24, 2026
…candidate (#2077)

* Bring release/1.2 to main at 0e04d18 for the next 1.2.0 candidate

* Changelog and upgrade policy for 1.2.0-rc.4

* Changelog: organization owners and Members' Remove for 1.2.0-rc.4

* Changelog: connecting from Browse apps also comes back where Connect was pressed

* Changelog: Add server offered only to an admin, for 1.2.0-rc.4

* Changelog: a Bot puts up the card of an app it doesn't hold first, for 1.2.0-rc.4

* Changelog: no more Agents pages and starter avatar colors under Unreleased; 1.1.3's Agents entry as released

* Changelog: one press of Connect on an app's card, for 1.2.0-rc.4

* Changelog: the move's one figure and the stuck window's alert (#2085), for 1.2.0-rc.4

* Changelog: a part of the app that didn't download loads again (#2092), for 1.2.0-rc.4

* Changelog: a Bot's answer reads as written after switching conversations (#2091), for 1.2.0-rc.4

* Changelog: on Windows, WSL 1 stays the default, for 1.2.0-rc.4

* Changelog: long names in member rows (#2082), for 1.2.0-rc.4

* Changelog: reconnecting an app after a move takes one press, for 1.2.0-rc.4

* About OpenBot says OpenBot (Self-Contained) or OpenBot Cloud, and as whom (#2090)

Nothing in OpenBot Desktop said which of the two it ran, or which account it used on OpenBot Cloud. About OpenBot now says where OpenBot runs above the build, on macOS and Windows alike, beside the version it already showed. On OpenBot Cloud (or another OpenBot the app is connected to) it names the email the app is signed in with, asked of that OpenBot once the sign-in is live with the same question the move to OpenBot Cloud asks (move_to_cloud::Api::account).

* Changelog: one connect card per app, for 1.2.0-rc.4
davidmckayv added a commit that referenced this pull request Nov 24, 2026
davidmckayv added a commit that referenced this pull request Nov 24, 2026
davidmckayv added a commit that referenced this pull request Nov 26, 2026
* Release v1.2.0-rc.1 (#2023)

Co-authored-by: davidmckayv <[email protected]>

* Bring release/1.2 to main at 76c07bc for the next 1.2.0 candidate (#2040)

Carries main's tree at 76c07bc, keeping the release lines at 1.2.0-rc.1: package.json, the desktop Cargo version, backend-images.env and release-policy.json's version.

* Bring release/1.2 to main at 043cc67 for the next 1.2.0 candidate (#2042)

Carries main's tree at 043cc67, keeping the release lines at 1.2.0-rc.1: package.json, the desktop Cargo version, backend-images.env and release-policy.json's version.

* Release v1.2.0-rc.2 (#2043)

Co-authored-by: davidmckayv <[email protected]>

* Bring release/1.2 to main at acfcabc for the next 1.2.0 candidate (#2053)

Carries main's tree at acfcabc, keeping the release lines at 1.2.0-rc.2: package.json, the desktop Cargo version, backend-images.env and release-policy.json's version.

* Release v1.2.0-rc.3 (#2054)

Co-authored-by: davidmckayv <[email protected]>

* Bring release/1.2 to main at 0e04d18, with #2090, for the next 1.2.0 candidate (#2077)

* Bring release/1.2 to main at 0e04d18 for the next 1.2.0 candidate

* Changelog and upgrade policy for 1.2.0-rc.4

* Changelog: organization owners and Members' Remove for 1.2.0-rc.4

* Changelog: connecting from Browse apps also comes back where Connect was pressed

* Changelog: Add server offered only to an admin, for 1.2.0-rc.4

* Changelog: a Bot puts up the card of an app it doesn't hold first, for 1.2.0-rc.4

* Changelog: no more Agents pages and starter avatar colors under Unreleased; 1.1.3's Agents entry as released

* Changelog: one press of Connect on an app's card, for 1.2.0-rc.4

* Changelog: the move's one figure and the stuck window's alert (#2085), for 1.2.0-rc.4

* Changelog: a part of the app that didn't download loads again (#2092), for 1.2.0-rc.4

* Changelog: a Bot's answer reads as written after switching conversations (#2091), for 1.2.0-rc.4

* Changelog: on Windows, WSL 1 stays the default, for 1.2.0-rc.4

* Changelog: long names in member rows (#2082), for 1.2.0-rc.4

* Changelog: reconnecting an app after a move takes one press, for 1.2.0-rc.4

* About OpenBot says OpenBot (Self-Contained) or OpenBot Cloud, and as whom (#2090)

Nothing in OpenBot Desktop said which of the two it ran, or which account it used on OpenBot Cloud. About OpenBot now says where OpenBot runs above the build, on macOS and Windows alike, beside the version it already showed. On OpenBot Cloud (or another OpenBot the app is connected to) it names the email the app is signed in with, asked of that OpenBot once the sign-in is live with the same question the move to OpenBot Cloud asks (move_to_cloud::Api::account).

* Changelog: one connect card per app, for 1.2.0-rc.4

* An admin gives a Bot an app from its card in one press (#2095) (#2102)

Cherry-picked from main (ba3e930) for the next 1.2.0 candidate. The
release notes entry is the release's own, so CHANGELOG.md is left as
release/1.2 has it.

An admin asked a Bot to connect Notion. The card told them "Only an admin
can give it", and Give it answered "Notion has no tools to give yet". The
admin's press now turns the app on, gives it, and opens their sign-in or the
key form; where the app lists nothing until they sign in, the card gives it
once they're connected, with no second press. The card and a Bot's Apps row
shown to an admin say what is missing, never to ask an admin.

* One press of Reconnect connects the app (release/1.2) (#2107)

Cherry-pick of #2101 (75fde91) onto release/1.2, without its CHANGELOG line.

* Show an app's Connect card once in a conversation (#2100) (#2110)

A reply that called two tools of an app the person hadn't connected was refused twice, and each refusal drew the app's card, so the same card showed twice. Only a repeated show_app_access was left out before. Now every card-bearing step is counted: the first card a reply draws for an app (per Bot) stays, later ones in that reply are left out, and when a later reply draws the app's card again, the earlier one goes.

(cherry picked from commit 359c50b)

* Find, connect and remove any app from Connections in the team edition (release/1.2) (#2113)

#2106, picked onto release/1.2 for 1.2.0-rc.4. Connections in the team edition has Browse apps and a search that reaches the whole directory; an owner or admin adds and connects an app in one press and removes it from its own page; a member asks an admin to add it.

* Connectors: the allowlist's switches say what each app can do (release/1.2) (#2109) (#2114)

* Connectors: the allowlist's switches say what each app can do

The MCP servers section on Admin, Apps is now called Connectors, and its
switches match what happens.

- Off, every app can be used, so each app's switch reads on and can't be
  changed. Switching one did nothing before.
- Turning Only approved connectors on approves every app already added, so
  nothing in use is cut off. The admin turns off the ones they don't want.
- Routines and OpenBot settings read on, can't be switched, and say "Always on,
  for every Bot.". The allowlist never holds them back.
- Turning one app off no longer takes every other app off the list with it.
  Two apps with no address compared as equal, so every id entry was removed.
- The count reads the apps approved, not the entries on the list.
- An app added, connected or given to a Bot refreshes the section, since an
  admin's add approves it while the list is on.

The section title, its description, the switch, the address row and dialog,
the Admin overview line and the settings card all say connector. The layout is
unchanged.

Tests: app/tests/admin-connectors-section.test.tsx draws the section against
the API's answers and drives both states; the refresh tests now expect the
section's refresh beside the plugin screens'.

* Type what a refusal refetches in the refresh test

* Changelog for the 1.2.0-rc.4 picks (#2104)

* Changelog: an app's own sign-in instead of a key, for 1.2.0-rc.4

* Changelog: an admin gives a Bot an app from its card in one press (#2095), for 1.2.0-rc.4

* Changelog: client-document sign-in and tool search at scale, for 1.2.0-rc.4

* Changelog: Connections leads to every app on OpenBot Cloud, for 1.2.0-rc.4

* Changelog: Only approved servers starts from the apps you added, for 1.2.0-rc.4

* Changelog: the MCP servers section is now Connectors, for 1.2.0-rc.4

* Changelog: one press of Reconnect in the move entry, and turning an app off from Connections, for 1.2.0-rc.4

* Changelog: tool search as it shipped, for 1.2.0-rc.4

* Changelog: OpenBot Cloud prefers the client document, for 1.2.0-rc.4

* Changelog: Connectors as it shipped, for 1.2.0-rc.4

* Changelog: the built-in vendor apps are no longer offered, for 1.2.0-rc.4

* Changelog: vendor sign-in as the code resolves it, for 1.2.0-rc.4

* Changelog: Anthropic's prompt cache and OpenAI's tool search, for 1.2.0-rc.4 (#2116)

* Release v1.2.0-rc.4 (#2117)

Co-authored-by: davidmckayv <[email protected]>

* Bring release/1.2 to main at a9ba3fe for 1.2.0-rc.5 (#2181)

release/1.2 takes main's tree at a9ba3fe, keeping the release lines at 1.2.0-rc.4 (package.json, the desktop Cargo version, backend-images.env and release-policy.json's version). Create release PR then moves them to 1.2.0-rc.5.

* Release v1.2.0-rc.5 (#2183)

Co-authored-by: davidmckayv <[email protected]>

* Bring release/1.2 to main at 238b165 for 1.2.0 (#2205)

release/1.2 takes main's tree at 238b165, keeping the release lines at 1.2.0-rc.5 (package.json, the desktop Cargo version, backend-images.env and release-policy.json's version). Create release PR then moves them.

* Release v1.2.0-rc.6 (#2207)

Co-authored-by: davidmckayv <[email protected]>

* Release v1.2.0 (#2210)

Co-authored-by: davidmckayv <[email protected]>

* Put release/1.2 back to 1.2.0-rc.6 after the 1.2.0 final stopped at its checks (#2217)

Release v1.2.0 (#2210) merged, but Publish release stopped in its checks before tagging or publishing anything: three client-version tests read a fixture that names 1.2.0 as a minimum newer than the app, which no longer holds once the app is 1.2.0. This puts the tree back to exactly v1.2.0-rc.6 (package.json, the desktop Cargo version, backend-images.env, release-policy.json's version and the changelog's Unreleased), so the test fix can land and become 1.2.0-rc.7, the candidate the final is cut from.

* Client version tests: keep the raised minimums above this release (#2219) (#2220)

The shared client-version fixture raised every app to 1.2.0 in its `raised`, `next` and
`security` answers, as a minimum newer than this app. The web app's and the phone app's tests
run those answers as the tree's own release, so on a tree whose package.json says 1.2.0 the app
is no longer below the minimum and three tests failed in the 1.2.0 release run.

The raised minimums are now 9.0.0, above any release of this line, and the tests that name the
minimum follow. The cases decide the same: below the minimum is refused, at it is served.

* Release v1.2.0-rc.7 (#2222)

Co-authored-by: davidmckayv <[email protected]>

* Release v1.2.0 (#2223)

Co-authored-by: davidmckayv <[email protected]>

* Keep main's own backend-images.env

* Start CI for the 1.2.0 merge-back

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: davidmckayv <[email protected]>
Co-authored-by: David McKay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant