Repository navigation
feat(web): run sidebar instance upgrades in the background - #2291
Conversation
The sidebar's upgrade arrow opened a dialog that stayed locked until the upgrade finished and then reloaded the page. A row under the logo now carries the whole upgrade: offer, confirm, updating, a failure with Retry, and "updated · Reload", which waits for the viewer to reload so unsent drafts survive. A missing code-split chunk after an upgrade loads the page once more instead of breaking the navigation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zoolsher
left a comment
There was a problem hiding this comment.
Design & Alternatives review: 💬 COMMENT
Problem: When a guardian or visitor starts an upgrade from the sidebar, Rome is unusable for minutes and then reloads on its own, dropping unsent work. The cause is that useSystemUpgrade ran the whole upgrade inside a locked dialog and called location.reload() when it finished.
Goals: run the sidebar upgrade in the background. Show its progress, a failure with Retry, and "updated · Reload" in a row under the logo, and let the viewer choose when to reload. Keep a tab on the old bundle working after the server has swapped to a build whose hashed chunks are different.
Non-goals:
- The Settings Version flow, which still reloads at the end.
- Showing the upgrade in other tabs or on other devices.
- Detecting a rollback early (a failure only shows after the 40-minute timeout).
- Any core or wire change.
PR approach:
- A
finish: "reload" | "report"option on the shared hook, plusretry, which checks build-info before posting again. - A row component (
UpgradeIndicator), moved out of the logo row so it stays mounted when names are shown or hidden. - A drop-in
lazy(lib/lazy-with-reload.ts). When a chunk fails to load, it waits while the server is down, then reloads the same URL once, using a per-URL guard in sessionStorage.
I checked whether anything already handles this. The app has no route-level error boundary; the only boundary is components/chat/entries/widget-ui/CardBoundary.tsx. So before this PR, a route chunk that failed to load on an old tab broke the whole page. With the page no longer reloading, that becomes the normal state after an upgrade, so some chunk recovery is required.
Alternatives considered:
- A. Do nothing about chunks (plain
React.lazy). Not viable: once the upgrade finishes, opening any page that hasn't loaded yet breaks the app until the viewer reloads. - B. The PR's approach, but reload only where the viewer acted. Keep the wrapper for routes (
App.tsx, the dev routes) and for click-opened modals (ai-tools-panel.tsx,FileView.tsx). LeaveWidgetUiCardinrender.tsxandQuestionCard.tsxon plainReact.lazy;CardBoundaryalready wraps them for exactly the case of "a tab left open across an update whose old chunk is gone". - C. A route-level error boundary that spots chunk errors and either reloads or points to the row. This is structurally different: no wrapper around
lazy. But it adds a new boundary, can't easily wait out a restart, and a reload inside it re-renders the error first. - D. Keep old chunks on the server across upgrades. Not feasible here: the container image is replaced, and it would need core or storage changes that the PR rules out.
- E. Minor simplification: have the hook always report, and let
system-upgrade-section.tsxcallreload()whenupgradedTois set. That removes thefinishbranches. Optional.
| Approach | Added complexity | Correctness / completeness | Blast radius | Reversibility | Maintenance | Effort |
|---|---|---|---|---|---|---|
| PR as is | Medium (hook mode, row, wrapper) | Fixes the locked dialog. But a chat card mounting from a live event can still reload the page unprompted | Every lazy surface | Revert undoes it | Low | Done |
| A. No chunk handling | None | Broken page after any background upgrade | Routes | Revert undoes it | — | — |
| B. PR, without wrapping chat cards | Same as the PR, minus 2 imports | Reloads only after a navigation or click. Cards fall back to the existing CardBoundary until Reload |
Routes and modals | Revert undoes it | Low | ~2 lines |
| C. Route error boundary | Medium (new boundary, no server wait) | Weaker: no wait during the restart | Routes | Revert undoes it | Medium | Medium |
| D. Keep old chunks on the server | High (core, storage) | Best UX | Core | Hard to undo (persisted asset layout) | High | High |
There are no public API, schema or wire-format commitments: core is unchanged and no endpoints are added. The PR is reversible throughout.
Recommendation: The PR's approach is the right fit: a background hook mode, a row that stays mounted, and a guarded reload for chunks that fail to load. The one change I'd make is B: don't route the two in-chat WidgetUiCard lazies through the reloading wrapper. They mount without any user action, so the wrapper there undoes the PR's own goal of letting the viewer choose when to reload. E is an optional tidy-up.
Verdict: COMMENT — The background upgrade row and the chunk-reload wrapper are the right overall design, but the wrapper is also applied to chat cards that mount without any user action. On those surfaces it brings back the unprompted reload this PR sets out to remove. Narrowing it is a small change that a revert can undo.
1 finding(s) posted as inline comments below.
| Severity | Category | File | Title |
|---|---|---|---|
| P2 | design | packages/web/src/components/chat/entries/render.tsx |
The reload wrapper on chat cards brings back unprompted reloads |
Automated review by RomeOS Code Review · commit d00c63d · Full review history
| @@ -1,4 +1,5 @@ | |||
| import { createContext, lazy, Suspense, useContext } from "react"; | |||
| import { createContext, Suspense, useContext } from "react"; | |||
| import { lazy } from "@/lib/lazy-with-reload"; | |||
There was a problem hiding this comment.
[P2] design — The reload wrapper on chat cards brings back unprompted reloads
The PR's goal is that "the viewer picks the moment" to reload. But WidgetUiCard (here and in QuestionCard.tsx) loads when a live chat event arrives, not when the viewer clicks. After a background upgrade finishes, the agent can post a card. On a tab still on the old bundle, that card's chunk 404s and loadWithReload reloads the page while the viewer may be typing. Text drafts survive the reload, but attachments, picks, dictation and focus do not. Both call sites are already wrapped in CardBoundary, which was built for "a tab left open across an update whose old chunk is gone". Keep these two on plain React.lazy and leave the wrapper on routes and click-opened modals. The card then shows its fallback until the viewer clicks Reload in the row.
There was a problem hiding this comment.
🔁 This review has been superseded. See the latest review.
There was a problem hiding this comment.
🔁 This review has been superseded. See the latest review.
There was a problem hiding this comment.
🔁 This review has been superseded. See the latest review.
yunfanye
left a comment
There was a problem hiding this comment.
Design & Alternatives review: 🛑 REQUEST_CHANGES
When a signed-in viewer upgrades from the sidebar, the dashboard becomes unusable and risks losing unsent work, because the existing flow blocks interaction and automatically reloads afterward.
Goals: background progress, viewer-controlled completion reload, and one-shot recovery of missing chunks. Non-goals: changing Settings, nightly upgrades, or backend outcome reporting.
The PR appropriately extends packages/web/src/hooks/use-system-upgrade.ts rather than introducing a separate upgrade engine. Its shared lazy-loading wrapper addresses stale chunks centrally, but the reload guard needs correction.
Design & Alternatives
| approach | added complexity | correctness/completeness | blast radius | reversibility | maintenance | effort |
|---|---|---|---|---|---|---|
| PR: shared hook, background row, chunk recovery | Moderate | Meets scoped goals except reload-loop safety | Sidebar and all lazy components | Easy revert | Two finish policies; centralized recovery | Small–medium |
| Keep existing dialog/reload flow | None | Retains blocking and surprise reloads | Sidebar | Easy | Lowest | None |
| Unify manual upgrades with existing status hub | Higher | Enables cross-tab progress; still needs chunk recovery | Core and nightly/sidebar flows | Reversible | More shared lifecycle ownership | Medium–large |
| Retain previous hashed assets across upgrades | Higher operational complexity | Fixes stale chunks at source; not old-client/API compatibility | Container initialization and asset serving | Reversible | Retention and garbage collection | Medium–large |
The status-hub alternative is grounded in packages/core/src/instance/system-upgrade/{service,status-hub}.ts and packages/web/src/hooks/use-upgrade-status.ts. It requires adding manual-upgrade entry semantics: markRestarting() currently only accepts an existing countdown, and completion must retain target-version verification rather than treating idle as success.
Asset retention is feasible because /app persists, but scripts/docker/rome-init.sh currently uses rsync --delete. Preserving old hashed assets would require changing synchronization/cleanup; packages/core/src/lib/caddyfile-generator.ts already serves existing hashed assets immutably. This is a broader deployment change than this PR needs.
Recommendation: retain the PR's shared-hook/background-row design, but make chunk recovery genuinely one-shot across a failed reload. No new public API, schema, or wire-format commitment creates a one-way door here.
Verification: inspected upgrade callers, Settings, nightly status handling, asset serving, and recovery tests. A dependency-free harness using the actual recovery implementation reproduced a second reload after a simulated 120-second failure. The targeted unit suite could not run because dependencies/rstest are absent.
Verdict: REQUEST_CHANGES — The background-upgrade approach fits the scope, but its time-limited chunk-recovery guard permits an endless reload cycle.
1 finding(s) posted as inline comments below.
| Severity | Category | File | Title |
|---|---|---|---|
| P1 | design | packages/web/src/lib/lazy-with-reload.ts |
Make chunk recovery one-shot rather than time-windowed |
Automated review by RomeOS Code Review · commit d00c63d · Full review history
| if ( | ||
| last?.url === url && | ||
| typeof last.at === "number" && | ||
| now - last.at < CHUNK_RELOAD_WINDOW_MS |
There was a problem hiding this comment.
[P1] design — Make chunk recovery one-shot rather than time-windowed
The reload-attempt marker expires after 60 seconds, so a still-broken chunk that fails slowly on the reloaded page can trigger another reload indefinitely. Rspack's default chunk timeout is 120 seconds, already longer than this guard; a harness against this implementation reproduced two reloads at the same URL when failures were 120 seconds apart. Keep a per-URL/build recovery-attempt marker through the failed reload, resetting it only after confirmed recovery or a different build, rather than elapsed time alone. Add a delayed-failure test proving that the second failure surfaces without another reload.
The row now reads "Update to X", "Updating to X…", "Update failed · Retry" and "Updated · Reload" at the sidebar's small text size and a compact height, truncating rather than wrapping. The tooltip and accessible name keep the full sentence with the agent's name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔁 This review has been superseded. See the latest review.
Review on #2291: the server probe used /api/build-info, which needs a session, so on signed-out pages a missing chunk waited forever; it now asks /api/health and reads any answer below 500 as the server being up. The reload guard expired after a minute while a chunk can take two to fail, so it now holds per page part until that part loads. Chat cards keep plain React.lazy, since they mount without a click and CardBoundary already covers a missing chunk there. A retry that cannot be sent puts its reason in the row's tooltip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zoolsher
left a comment
There was a problem hiding this comment.
Code Review: 🛑 REQUEST_CHANGES
What the PR does. Sidebar upgrades now run in the background. useSystemUpgrade gets a finish: "report" mode and a retry that checks the version first. The dialog only confirms now. One UpgradeIndicator instance shows the progress. Every React.lazy call goes through loadWithReload, so a page left on the old bundle reloads once when a chunk is missing.
What I checked. I read every changed file in full.
- Callers:
useSystemUpgradehas two. Settings keeps the defaultreload; the sidebar usesreport. No rawReact.lazyimport is left. - i18n: en and zh-CN have the same keys, and the removed settings keys have no other users.
- Contrast test: the rail paints on
bg-background, which the test uses as the canvas. - Server check:
/api/build-infois not inPUBLIC_API_PATHS(core/src/api/routes/auth.ts).
The hook's state handling looks right to me:
- Each accepted request creates a new wait object, so a retry restarts the poll.
upgrade_in_progressandtarget_not_latestare handled on both the first request and Retry.- The effect that closes the dialog stops a retry that gets
target_not_latestfrom reopening it. - Keeping a single indicator instance means the upgrade's state survives toggling the rail's names.
Still open from earlier review threads. Head ba10470 has not changed lazy-with-reload.ts, and nobody has replied to these threads:
- The server check needs a session. On logged-out pages it gets a 401, so a missing chunk is retried every 3 s forever.
- The 60-second reload window is shorter than Rspack's 120-second chunk timeout, so a slow failure can trigger a second reload.
I agree with both and list them below as one P1 so the verdict reflects them. The other open threads (P2: chat cards can reload on their own; P3s: Retry fails silently, state is lost when the shell unmounts) still apply too. I don't repeat them.
New in this pass. One optional point (P3): the contrast test mixes the tint in OKLab, but the browser blends the translucent tint over the page in sRGB. In dark mode that overstates the contrast a little.
Simplicity. The design is about as small as the problem allows: one option on the existing hook rather than a second engine, and one wrapper in place of lazy. I found nothing over-complicated.
Not verified. The repo has no installed dependencies, so I could not run the unit tests or the contrast test.
Verdict: REQUEST_CHANGES — Two P1 problems in the chunk-reload code are still in head ba10470, and they break the PR's "no loop" promise: the server check needs a session, and the reload guard is limited by a 60-second window.
2 finding(s) posted as inline comments below.
| Severity | Category | File | Title |
|---|---|---|---|
| P1 | error-handling | packages/web/src/lib/lazy-with-reload.ts |
Still open at head: the server check needs a session, and the reload guard depends on a time window |
| P3 | testing | packages/web/src/lib/themes-contrast.test.ts |
The contrast test blends the tint in OKLab, but the browser blends it in sRGB |
Automated review by RomeOS Code Review · commit ba10470 · Full review history
|
|
||
| async function serverAnswers(): Promise<boolean> { | ||
| try { | ||
| const res = await fetch("/api/build-info", { |
There was a problem hiding this comment.
[P1] error-handling — Still open at head: the server check needs a session, and the reload guard depends on a time window
This confirms the open threads; head ba10470 does not change this file. (1) /api/build-info is not in PUBLIC_API_PATHS, so a viewer without a session gets 401. serverAnswers() then returns false, and /login, /share/:token, /onboard and /callback retry a missing chunk every 3 s with no end. Fix: probe /api/health, or treat any status below 500 as the server answering. (2) CHUNK_RELOAD_WINDOW_MS = 60_000 is shorter than Rspack's 120 s default chunk timeout. If the chunk fails slowly again after the reload, it can reload again. Simplest fix: drop the time check and keep the per-URL marker until a load on that URL succeeds. Add one test with a 401 probe and one where the second failure comes after 60 s.
| const canvas = resolveToken(theme, mode, "background"); | ||
| const ink = mixOklab(primary, INK_SHARE, resolveToken(theme, mode, "foreground")); | ||
| return TINTS[mode].flatMap((tint) => { | ||
| const ratio = contrastRatio(ink, mixOklab(primary, tint, canvas)); |
There was a problem hiding this comment.
[P3] testing — The contrast test blends the tint in OKLab, but the browser blends it in sRGB
color-mix(in oklab, var(--primary) N%, transparent) gives primary at alpha N. The browser then paints that over --background with normal sRGB alpha blending, not as an OKLab mix of primary and canvas. In dark mode the blend over a dark canvas comes out lighter than the OKLab mix, so the light ink's contrast is a little lower than measured (about 5–8% by a rough estimate). In light mode the test errs on the safe side. Optional: model the tint as primary * N + canvas * (1 - N) per gamma-encoded sRGB channel, so the check measures the color actually painted.
There was a problem hiding this comment.
🔁 This review has been superseded. See the latest review.
There was a problem hiding this comment.
🔁 This review has been superseded. See the latest review.
yunfanye
left a comment
There was a problem hiding this comment.
Code Review: 🛑 REQUEST_CHANGES
Reviewed updated head 3c14a39; earlier auth-probe and timeout findings are fixed. A source-level harness reproduced one remaining reload-loop issue. Unit tests could not run because node_modules/rstest is missing.
Verdict: REQUEST_CHANGES — Concurrent chunk failures can still defeat the reload guard and cause repeated reloads.
1 finding(s) posted as inline comments below.
| Severity | Category | File | Title |
|---|---|---|---|
| P1 | error-handling | packages/web/src/lib/lazy-with-reload.ts |
Retain reload guards for all failing parts |
Automated review by RomeOS Code Review · commit ba10470 · Full review history
| now - last.at < CHUNK_RELOAD_WINDOW_MS | ||
| ) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
[P1] error-handling — Retain reload guards for all failing parts
The single stored marker lets two failing parts overwrite each other’s reload guard. When both mount at the same URL—for example, Settings over a restored document preview—and both chunks remain missing, subsequent page loads permit another reload because only the other part’s attempt is remembered. A two-loader source-level harness reproduced this across four consecutive simulated page loads. Retain attempted parts per URL, clear only the recovered entry, and add a regression test with two concurrently failing loaders.
There was a problem hiding this comment.
🔁 This review has been superseded. See the latest review.
Review on #2291: one reload mark per URL let two parts that stay missing side by side take turns reloading the page. The mark now keeps every part that reloaded at a URL, so reloads there are bounded by its parts. File previews can open on the agent's lead, so they no longer reload the page: a missing preview chunk shows a Reload button in its place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zoolsher
left a comment
There was a problem hiding this comment.
Code Review: ✅ APPROVE
Code Review: ✅ APPROVE
What the PR does: Starting an upgrade from the sidebar no longer blocks the page. It runs in the background:
useSystemUpgradegets afinish: "report"option and aretry.- A single
UpgradeIndicatorrow under the logo shows the stages: available → updating → failed/Retry → updated/Reload. - Routes and dialogs opened by a click load through
lazy(lib/lazy-with-reload.ts). When a chunk is missing it waits while the server restarts, then reloads the page once per part and URL. - Parts that can mount without a click don't reload the page. Chat cards keep plain
React.lazybehindCardBoundary, and file previews uselazyInPlace, which shows a Reload button in their place.
Earlier threads, checked against head 06b2305:
- ✅ Single reload mark lets two parts take turns (P1/P2/P3, @yunfanye, @zoolsher, @Jessie-QingYu): the mark is now
{url, parts[]}.claimReloadrefuses a part that is already listed for that URL.clearMarkremoves only the part that loaded.- A new test makes two parts fail on the same load, then both fail again after the reload in reverse order, with no third reload.
claimReloadruns synchronously, so two parts failing at the same time can't overwrite each other's entry.
- ✅ File previews the agent opens could reload the page (P2, @yunfanye):
FileViewnow loadsDocxPreviewPaneandSpreadsheetPreviewPanethroughlazyInPlace(PreviewNeedsReload). A missing chunk shows the stand-in, and only the viewer's click reloads. Both locales have the newfileskeys, and a test covers it. - ✅ The auth-gated probe (now
/api/health, treating any status below 500 as the server answering), the 60-second reload window, chat cards, and retry error reasons were already fixed at 3c14a39 and are unchanged here. - Still deferred as accepted P3 follow-ups: the row's state is lost when the shell unmounts, and the contrast test mixes colours in OKLab where the browser blends in sRGB.
What I checked:
- Every
lazy(call site: App routes, theai-tools-panelmodals (opened by a click), and dev routes and docs use the wrapper.render.tsxandQuestionCard.tsxstay on React's ownlazy. useHostNavigation: SDK navigations come from app UIs; iframe navigations are limited to chat and session routes.- The hook's state machine:
- Each accepted request creates a new wait object, so a retry restarts the poll.
- In report mode,
upgrade_in_progresscounts as accepted. target_not_lateston retry clears the wait and re-runs the check.- A retry first checks build-info, so it doesn't send a second request when the backend is already on the target.
- The dialog closes for good once the request is accepted.
- Settings: it still uses the default
reloadfinish. - Reload guard across URLs: different URLs are guarded separately, but every extra reload needs a navigation by the viewer, so this can't loop.
- Tests: I could not run them, because the clone has no
node_modules.
One optional note (P3): the contrast roster in themes-contrast.test.ts still has the old "upgrade arrow on its disc" pair (surface on success). It describes the removed disc design.
Design & Alternatives
| Approach | Complexity | Correctness | Blast radius | Verdict |
|---|---|---|---|---|
PR: a report finish option on the shared hook, a background row, a reload-once lazy with a no-reload variant for previews |
Moderate, kept in two small modules | Meets the stated invariants | Sidebar plus every lazy part, with added behaviour only when a chunk fails | ✅ Fits |
| Keep the blocking dialog and auto-reload | None | Blocks the page and drops drafts | Sidebar | ❌ The problem this PR solves |
| Version-skew handling in core (keep old chunks served) | High, needs server and asset retention | Avoids reloads entirely | Core, deploy | Overkill for this scope |
Verdict: APPROVE — Head 06b2305 fixes the last two open findings: the reload mark now records every part that reloaded at a URL, and file previews show a Reload button instead of reloading the page. I found no new correctness problems, only one optional cleanup.
1 finding(s) posted as inline comments below.
| Severity | Category | File | Title |
|---|---|---|---|
| P3 | code-quality | packages/web/src/lib/themes-contrast.test.ts |
Contrast roster still lists the removed upgrade disc |
Automated review by RomeOS Code Review · commit 06b2305 · Full review history
| .join("")}`; | ||
| } | ||
|
|
||
| describe("sidebar upgrade row", () => { |
There was a problem hiding this comment.
[P3] code-quality — Contrast roster still lists the removed upgrade disc
This PR replaces the bg-success text-surface disc with the tinted .rome-upgrade-row. The roster entry for the disc ({ fg: "surface", bg: "success", why: "upgrade arrow on its disc" }, around line 218) and its comment now describe a UI that no longer exists. Optional: delete that entry and its pinned id, so the roster only checks pairs that are actually painted.
Jessie-QingYu
left a comment
There was a problem hiding this comment.
Code Review: 💬 COMMENT
Code Review: 💬 COMMENT
What the PR does. Sidebar upgrades now run in the background. useSystemUpgrade gets finish: "report" and retry, and one UpgradeIndicator row shows the stages: available → updating → failed/Retry → updated/Reload. Routes and click-opened modals load through lazy in lib/lazy-with-reload.ts, which reloads the page once when a chunk is missing and waits while the server restarts. File previews use lazyInPlace, which shows a Reload button in place of the preview instead of reloading the page.
Earlier threads, checked at head 06b2305:
- ✅ Two parts taking turns at one URL (P1 @yunfanye, P2 @zoolsher, P3 @Jessie-QingYu). The mark is now
{url, parts[]}.clearMarkremoves only the part that loaded, and a test covers two parts that fail together. - ✅ File previews the agent opens could reload the page (P2 @yunfanye).
FileViewnow useslazyInPlace(PreviewNeedsReload), and tests cover it. - ✅ Already fixed before this head: the health probe that needed a session (
/api/healthis inPUBLIC_API_PATHS, and any status below 500 counts as the server answering), the 60-second window, chat cards on plainReact.lazy, and the retry reason in the tooltip. - Deferred in the PR description and fine as follow-ups: row state is lost on
/full/apps/*, and the contrast test blends in OKLab rather than sRGB.
What I checked beyond the diff:
- Read every changed file in full.
lazycall sites. Every wrapped site inApp.tsx,ai-tools-panel.tsxand the dev registries is a route or a modal opened by a click.render.tsxandQuestionCard.tsxstay onReact.lazy.useSystemUpgradecallers. Settings keeps the defaultreload, and the sidebar usesreport.- Removed i18n keys. None of them is still used.
system-upgrade-section.tsxstill usesrestartingBody,restartTimeoutBodyandrestartTimeoutAction, and those keys stay. - The rail. It mounts once per layout branch, and
hideSidebarcomes from a query parameter, so the indicator does not unmount during normal use. - Core health route. It returns 503 when the database or schema check fails. In that state a missing chunk waits rather than failing, which is minor and not reported.
Remaining issue. AppWidget loads the same app in same-origin iframes at /full/apps/<id>/…, and those iframes share the tab's sessionStorage. The guard still remembers only one URL, so two documents at different URLs whose chunk is still missing replace each other's mark and reload without end. A small change fixes it: key the mark by URL.
I could not run the unit tests in this clone.
Verdict: COMMENT — The open threads are fixed at 06b2305, but the reload guard still keeps only one URL, and same-origin app-tile iframes share it with the page, so the reload loop can still happen across URLs (P2).
1 finding(s) posted as inline comments below.
| Severity | Category | File | Title |
|---|---|---|---|
| P2 | error-handling | packages/web/src/lib/lazy-with-reload.ts |
Reload mark keeps one URL, but same-origin app-tile iframes share it |
Automated review by RomeOS Code Review · commit 06b2305 · Full review history
| const url = window.location.href; | ||
| try { | ||
| const mark = readMark(); | ||
| const parts = mark?.url === url ? mark.parts : []; |
There was a problem hiding this comment.
[P2] error-handling — Reload mark keeps one URL, but same-origin app-tile iframes share it
sessionStorage is shared by a tab and its same-origin iframes, and AppWidget loads this same app in iframes at /full/apps/<id>/…. Each of those iframes loads AppFullPage through this wrapper. Say two tiles (or the page and a tile) sit at different URLs and both still miss a chunk after the reload, for example after a broken deploy or with a cached index.html. Each one then finds the other's URL in the mark, resets parts to [] here, claims again and reloads, so they take turns with no end. This is the cross-URL form of the loop the latest commit fixed for one URL.
There is a second gap: clearMark ignores the URL, so a part that loads in one document can remove another document's guard. The simplest fix is to store Record<url, string[]>, claim and clear only under window.location.href, and add a test where two URLs fail one after the other.
yunfanye
left a comment
There was a problem hiding this comment.
Code Review: ✅ APPROVE
Reviewed head 06b2305, including upgrade callers, Settings compatibility, lazy-loading recovery, and public health routing. A source-level harness passed concurrent-failure guard and non-reloading preview checks. Focused unit tests could not run because node_modules/rstest is missing.
Verdict: APPROVE — No new actionable defects found; the earlier reload-loop and automatic-preview issues are fixed.
No issues found. Code looks good!
Automated review by RomeOS Code Review · commit 06b2305 · Full review history
…inted (#2292) ## Why Review follow-ups on #2291. Session storage is shared by the dashboard and its same-origin app-tile frames. One reload mark meant a page and a frame at another URL could reset each other's guard and take turns reloading after a broken deploy. A part that loaded in one document could also clear another document's guard. The contrast check for the upgrade row also blended its tint in OKLab, while the browser composites it in sRGB. ## Invariants - A missing chunk reloads a URL at most once per page part until that part loads, whichever other documents in the tab are missing chunks too. - A part loading in one document never resets another document's guard. ## Scope - Marks are kept by URL, capped at 20 URLs per tab session (the oldest goes first). - The contrast test now paints `primary` at the row's alpha over the canvas in sRGB, and drops the removed upgrade disc from the roster. The row still clears AA everywhere. ## Merge danger Two-way door. Blast radius: the chunk-reload guard and one test. An older mark in session storage reads as empty, which allows at most one extra reload per part. ## Evidence - A page and a frame at another URL both stay missing a part: one reload each, then each fails without another reload. Fails without the change. - The same part loads in a frame: the page's guard at its own URL holds. Fails without the change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The sidebar's upgrade row was green before #2291 moved it to the primary tint. The web row mixes its tint and ink from --success with the same formula, and the contrast test now measures the success mix in every theme. The iOS drawer row uses successSoft and success; the update page keeps primary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) ## Why The app had one minimum instance version, and every raise blocked the whole app until the instance updated (up to 40 minutes). Most raises come from one feature calling a new API while Chat keeps working, so the block cost more than it protected. The app now has two minimums, and a process that raises them only once the server release that brings the API is out. ## Invariants - Below the blocking minimum, the update page covers the app with no way past it, and says the app cannot be used during the update. - Below the background minimum only, the page asks once with one button, "Update in background". Pressing it closes the page, and the upgrade runs exactly like one started from the drawer: the row's progress, the one-time "updated" line, Retry on failure. The page does not come back for that release on that instance, after a relaunch too. - At or above both minimums, a newer release is only offered in the drawer, as before. - A minimum is raised only to a published server release (a GitHub release, not a draft or prerelease) that contains the server change the app needs, and never lowered. When publication cannot be confirmed, nothing is raised. ## Scope - Both minimums stay at 1.1.196, so nothing changes for any instance until the next raise. - Raises are queued in `ios/Config/pending-minimum.json` by the PR that needs them. `ios/Tools/bump-minimum.mjs` applies them before a TestFlight build (new step 1 in `ios/README.md` "Release to TestFlight"). It takes the newest published release, stops with "Release the server first" when that release lacks an entry's server change, and edits files only. No GitHub Actions run it. - `ios/CLAUDE.md` says when to add an entry and which tier: `blocking` only when Chat itself needs the API. - The upgrade row returns to the success green it had before #2291: the web sidebar row (tint and ink mixed from `--success`, same formula, contrast test updated) and the iOS drawer row. The update page buttons keep primary. ## Merge danger Two-way door. Blast radius: the update page and the drawer row for instances behind the app's minimum; with both minimums unchanged, today's instances see only the new line on the blocking page. ## Evidence - Unit tests (`UpdateTiersTests`): which page shows for each version; the background button hands over to the drawer flow and finishes in the background; a failure stays in the drawer row and its Retry restarts in the background without the page; a newer release asks again; the blocking path is unchanged. - `PendingMinimumTests` checks the pending file's shape. `pnpm test:ios:minimum` (in `test:unit:rest`) checks the script against a scratch git repository: version comparison, the "Release the server first" stop, raising after the tag, never lowering. - Web upgrade row: `themes-contrast.test.ts` holds AA for the success mix in every theme and mode; sidebar checked in the mock, light and dark. - Ran on Mac Catalyst: UpdateTiers, PendingMinimum, BackgroundUpdate, UpdateGate, InstanceUpdater, SoftUpdate, UpdateFailure, UpdateStatusLine, BuildInfoProbe, Localization, CachedLaunch suites, all passing. Snapshots `20-update-required`, `20b-update-background`, `21-update-updating`, `22-update-failed`, and both variants at xxxLarge (`37`, `37b`) and AX3 (`36`, `36b`), light and dark, checked by eye. The page's content now sits at 45% of the room between the bar and the button, and scrolls rather than reach the button. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…of the chat's error banner (#2368) ## Summary Two dashboard fixes for what a viewer sees while Rome upgrades and restarts. **1. Confirming an upgrade that is already under way no longer fails.** The sidebar only knows about an upgrade that the same page started. So while Rome upgrades from another tab or device, or after a reload, the row still offers `Update to X`. Confirming that offer showed Rome Cloud's refusal in red: `Upgrade request failed: Cannot update your Rome while it is upgrading`. The hook already treats an in-progress refusal as "join the wait", but it compared the code `upgrade_in_progress` against `fetchJson`'s message, which picks `detail`/`message` before `error`. A body that carries a sentence never matched. - `requestUpgrade` now reads the code from the body's `error` field, the field iOS reads, and keeps the human message for display. - The in-progress check matches the code `upgrade_in_progress`, or the sentence Rome Cloud answers with (`… while it is upgrading`), in case the code is absent. - `target_not_latest` uses the same code read. - Effect: the dialog closes, and the row shows `Updating to X…` as a status, so a second upgrade can't be started. It then shows `Updated · Reload` when the backend reports the target. **2. The chat no longer shows a proxy's HTML error page as the error.** During the restart, the proxy in front of Rome answers with its own HTML error page. The chat put the first 200 characters of that markup in the composer's error banner (`<!DOCTYPE html> <!--[if lt IE 7]> …`). - `plainErrorText` returns no text for a body that starts with `<`. It is used where the chat reads a non-JSON error body: the turn send, `jsonOrThrow`'s payload, and Stop. - `isUnreachableStatus` covers 502, 503, 504 and Cloudflare's 520–530. Send and Stop failures with these statuses and no message now say "Can't reach Rome, try again soon." - A turn stream that meets these statuses says "Can't reach Rome, reconnecting…". The loop already reconnects on its own. - The notices say "Updating now, try again soon." and "Updating now, reconnecting…" instead only while this page knows an upgrade is under way. `useUpgradeUnderWay` holds a small shared flag while the sidebar or Settings waits on its upgrade, or the nightly banner shows its restart. Any other gateway failure, such as a crash or a restart for another reason, is not named an upgrade. - New strings in `en` and `zh-CN`. ## Scope - Web only. Core's upgrade relay and Rome Cloud are unchanged. - The sidebar still learns of an upgrade started elsewhere only when the viewer confirms. Showing it before that needs a shared signal, which this change doesn't add. One option is core marking manual upgrades in the upgrade status, the follow-up noted in #2291. Another is the attempt outcome on the upgrade check proposed in #2364. - The Settings Version section, which reloads at the end, keeps its current handling of an in-progress refusal. ## Testing - `UpgradeIndicator.test.tsx`: an in-progress refusal sent as the code alone, the code with a sentence, or the sentence alone. Each one closes the dialog and shows the updating row with no error. Without the fix, the last two fail. - `chat-api.test.ts`: an HTML error page on a send gives an empty message and its status. Plain text is kept. A listing refused by the proxy throws `Request failed with status 502`. The status helper is covered too. - `Chat.test.tsx`: a send refused with 502 and no message shows the can't-reach text, or the updating text while an upgrade is under way. A turn stream answered with a 522 HTML page shows the reconnecting text. - `upgrade-under-way.test.tsx` covers the flag, and `UpgradeIndicator.test.tsx` checks the sidebar holds it while updating and lets go once updated. - Related web suites pass: 111 files, 1,169 tests. Web `typecheck`, Biome on the changed files, `lint:imports` and `lint:prose` pass. `lint:deadcode` reports nothing new. - Not reproduced end to end: a real restart behind the proxy, or Rome Cloud's live refusal body. ## Screenshots Mock data, with Rome Cloud's refusal and the proxy's HTML page served by mock handlers; before is `main`, after is this branch. | Confirm while already upgrading, before (1280×900) | After (1280×900) | | --- | --- | | <img src="https://gist.githubusercontent.com/Jessie-QingYu/1fbc8d31ca90fed5eb5916e51011242e/raw/8ba6e7178a76c9e1ea8b25a1871f5f54fd7a0a7f/upgrade-before-1280.png" width="480"> | <img src="https://gist.githubusercontent.com/Jessie-QingYu/1fbc8d31ca90fed5eb5916e51011242e/raw/8ba6e7178a76c9e1ea8b25a1871f5f54fd7a0a7f/upgrade-after-1280.png" width="480"> | | Send during the restart, before (1280×900) | After (1280×900) | After, while this page's upgrade is under way (1280×900) | | --- | --- | --- | | <img src="https://gist.githubusercontent.com/Jessie-QingYu/1fbc8d31ca90fed5eb5916e51011242e/raw/8ba6e7178a76c9e1ea8b25a1871f5f54fd7a0a7f/chat-before-1280.png" width="320"> | <img src="https://gist.githubusercontent.com/Jessie-QingYu/1fbc8d31ca90fed5eb5916e51011242e/raw/8ba6e7178a76c9e1ea8b25a1871f5f54fd7a0a7f/chat-after-1280.png" width="320"> | <img src="https://gist.githubusercontent.com/Jessie-QingYu/1fbc8d31ca90fed5eb5916e51011242e/raw/8ba6e7178a76c9e1ea8b25a1871f5f54fd7a0a7f/chat-updating-1280.png" width="320"> | | Before, 390×844 | After, 390×844 | After, 390×844 (Chinese) | | --- | --- | --- | | <img src="https://gist.githubusercontent.com/Jessie-QingYu/1fbc8d31ca90fed5eb5916e51011242e/raw/8ba6e7178a76c9e1ea8b25a1871f5f54fd7a0a7f/chat-before-390.png" width="180"> | <img src="https://gist.githubusercontent.com/Jessie-QingYu/1fbc8d31ca90fed5eb5916e51011242e/raw/8ba6e7178a76c9e1ea8b25a1871f5f54fd7a0a7f/chat-after-390.png" width="180"> | <img src="https://gist.githubusercontent.com/Jessie-QingYu/1fbc8d31ca90fed5eb5916e51011242e/raw/8ba6e7178a76c9e1ea8b25a1871f5f54fd7a0a7f/chat-after-390-zh.png" width="180"> | 🤖 Generated with [Rome OS](https://github.com/rome-os/rome) --------- Co-authored-by: Rome OS <noreply@romeos.cc>
Why
An upgrade started from the sidebar locked the page in a dialog until it finished, then reloaded it. Rome was unusable for minutes, and the reload dropped unsent chat drafts. The iOS app runs the same upgrade in the background (#2276). The web now does too, except at the end: a reload swaps the frontend bundle, so the viewer picks the moment.
Invariants
Scope
/api/instance/upgrade/check. Core relays that body verbatim, so the web needs no core change./full/apps/*), and link Rome Cloud's instance status from the failed row.color-mixvalues ofprimary. A new check inthemes-contrast.test.tsmeasures them at AA in every theme and mode, at rest and on hover. The lowest is 5.1:1, Ember light on hover (5.5:1 at rest).Merge danger
A two-way door that a revert undoes. Blast radius: the sidebar upgrade entry, plus every lazily loaded page and component. Those now load through a wrapper that only adds behaviour when a chunk fails to load.
Evidence
pnpm start:web:mockwith the endpoints mocked.upgrade_in_progressas still updating, and finishes without a second request when the backend is already on the target. Unit tests and the browser walkthrough.🤖 Generated with Claude Code