Repository navigation
fix(control-ui): old tabs 404 on lazy chunks after every update - #163099
Conversation
Retained Control UI generations let already-open documents from the previous build load hashed lazy assets after `openclaw update` restarts the Gateway. A current build manifest lists 53,113,860 bytes per generation, 18,023,582 of them precompressed .br/.gz sidecars, so the current generation plus one prior (106.2 MB) no longer fit the 96 MiB budget and every preparation after an update pruned the previous build. Retained generations now store an identity-only manifest named by its own hash. Bundled sidecars are never directly addressable and a missing retained sidecar is already served as identity bytes, so stale tabs keep working with uncompressed responses while the current build still uses its sidecars from the bundled root. Current plus previous now needs 70.2 MB. Existing full-format cache directories remain valid generations in both upgrade and downgrade directions; every verification property is unchanged. Pruning now warns when the byte budget drops the newest prior generation, so a future build that outgrows the budget is visible.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 4:31 AM ET / 08:31 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR omits compressed sidecars from retained Control UI builds, warns when the previous build cannot fit, and adds documentation and regression coverage. Merge readiness✅ Ready for maintainer review This repair remains necessary: current main still retains compressed sidecars and can prune the previous build. No actionable introduced defect was found, and the supplied Gateway evidence covers retention and existing-cache compatibility. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway retains verified Control UI build assets so already-open browser tabs can request older lazy-loaded modules after an update. Its HTTP server uses these retained files when the current bundled build lacks the requested asset. flowchart TD
A[Bundled build manifest] --> B[Select identity assets]
B --> C[Verify and publish retained build]
D[Existing retained builds] --> E[Apply generation and disk limits]
C --> E
F[Old tab requests missing module] --> G[Gateway asset lookup]
E --> G
G --> H[Serve verified asset bytes]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +23, Tests +178, Docs 0. Total +201 across 4 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep verified identity assets within the existing disk bound while preserving older cache readers and current-build compression. Do we have a high-confidence way to reproduce the issue? Yes: current-main pruning cannot retain two reported 53.11 MB full generations within 96 MiB, and the supplied fail-before regression establishes prior-build eviction. This read-only review did not execute the reproduction. Is this the best way to solve the issue? Yes: filtering non-addressable sidecars at the existing retention owner restores the compatibility window without increasing the disk bound or introducing another cache owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4ad3766a2169. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
* fix(release): backport retained Control UI assets Backport the merged retained-asset startup and identity-only generation fixes from #163090 and #163099 onto release/2026.9.8. Include the timer-free test helpers required by the older release branch. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]> * test(release): keep compact node plan within cap Consolidate the retained-asset budget cases under the existing publication test owner so the frozen release branch does not add another compact-plan shard. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: vincentkoc <[email protected]> Co-authored-by: roboclaw-bot <[email protected]>
…claw#163099) * fix(control-ui): old tabs 404 on lazy chunks after every update Retained Control UI generations let already-open documents from the previous build load hashed lazy assets after `openclaw update` restarts the Gateway. A current build manifest lists 53,113,860 bytes per generation, 18,023,582 of them precompressed .br/.gz sidecars, so the current generation plus one prior (106.2 MB) no longer fit the 96 MiB budget and every preparation after an update pruned the previous build. Retained generations now store an identity-only manifest named by its own hash. Bundled sidecars are never directly addressable and a missing retained sidecar is already served as identity bytes, so stale tabs keep working with uncompressed responses while the current build still uses its sidecars from the bundled root. Current plus previous now needs 70.2 MB. Existing full-format cache directories remain valid generations in both upgrade and downgrade directions; every verification property is unchanged. Pruning now warns when the byte budget drops the newest prior generation, so a future build that outgrows the budget is visible. * test(control-ui): await async retained lookups and pin identity-only HTTP serving
Related: #129922, #131930, #163090
What Problem This Solves
Fixes: already-open Control UI tabs fail to load routes they had not visited yet after every
openclaw update, because the retained-asset cache always prunes the previous build.User Impact
After an update, an open tab from the previous build can still load its lazy chunks. Those responses are uncompressed (identity bytes) instead of Brotli/gzip; the current build still serves its precompressed sidecars. The retained cache now holds about 70 MB on disk (current plus previous build) instead of about 53 MB (current only). If a future build grows too large for the previous generation to fit, the Gateway logs
Control UI asset retention cannot keep the previous generationinstead of failing silently.Why This Change Was Made
The retention owner keeps at most 3 generations within 96 MiB (100,663,296 B), current first. When #129922 set that budget, a generation was 24.6 MB. A fresh
pnpm ui:buildtoday lists 1,434 assets totaling 53.1 MB, about a third of which is precompressed sidecars:.js, 69.css, 24.webp).brsidecars (470).gzsidecars (470)Retained generations now store an identity-only manifest, named by its own hash. That is what old documents need: bundled
.br/.gzURLs are never directly addressable (control-ui.ts404s them), and the HTTP path already falls back to identity bytes when a retained sidecar is missing. The sidecar rule comes from the static-response owner (isControlUiPrecompressedAssetExtension), so retention follows that owner's sidecar policy.Options weighed:
Tradeoffs: a stale tab downloads lazy chunks uncompressed during the post-update window, about 4 times the Brotli size (33.5 MB of JavaScript in this build is 8.4 MB as Brotli). A third generation (105.3 MB identity) no longer fits today's build; one prior covers the update contract. Identity bytes can grow to 48 MiB (50.3 MB) per build, about +43%, before the previous generation stops fitting. Locale catalogs are 19.1 MB (55%) of identity and grow with UI strings across 20 locales, so the new warning is the early signal.
Compatibility: the manifest format is unchanged. Directories written by older Gateways (full format, sidecars included) still verify as generations and count at their real size. On the first update onto this change, the new 35.09 MB identity-only current plus the old 53.11 MB full prior is 88.2 MB, so the operator's existing previous build survives. After a downgrade, an older Gateway reads identity-only directories as ordinary generations and serves identity bytes. All verification properties are untouched: manifest parse and hash, directory name equals generation, per-asset size and SHA-256, path containment, symlink and hardlink policy, staging and collision handling, prune claims, and cancellation.
Coordination: #163090 (on-miss lookups await the startup inventory) landed first by agreement, making
resolveAssetasync. This branch merges main and converts the new budget test's lookups toawait. It also adds the identity-only HTTP case to #163090'scontrol-ui-retained-assets.http.test.ts: the real owner publishes a prior build that ships.br/.gzsidecars, and a client acceptingbr, gzipgets 200 identity bytes with noContent-Encoding. That case fails on the pre-PR retention code, which answers with Brotli.Evidence
Fresh measurement:
pnpm ui:buildat df8c0ee, manifest summed as in the table above. A read-only look at the operator's~/.openclaw/cache/control-ui-assetsshowed a single generation of 53,076,371 B (35,065,545 identity), consistent with the bug.Regression tests in the new
src/gateway/control-ui-asset-retention.budget.test.ts, owner-level and worker-free, with sparse zero-filled fixtures at the measured sizes:undefined, and the warning is never called. Both pass with the change.control-ui-retained-assets.http.test.ts): an identity-only retained generation serves identity bytes to a client acceptingbr, gzip; with the production change reverted, the handler setsContent-Encoding: brand the case fails.Test cost:
pnpm test src/gateway/control-ui-asset-retention.budget.test.ts --maxWorkers=1gave 3.9 s and 0.7 s per test (Duration 15.7 s; process CPU 5.7 s user + 3.6 s sys) on a host at load average ~81. On CI (checks-node-changed-compact-large-10, gateway-core shard) the tests took 120 ms and 73 ms; the local times were host contention.Focused suites: on the merged head, the 4 existing retention files, the budget file,
control-ui-retained-assets.http.test.ts,server-control-ui-root.resolve.test.ts, andcontrol-ui.http.test.ts: 8 files, 148 tests passed.Gates:
pnpm run tsgo:corepassed.pnpm run tsgo:core:test --ci-graphs-json '["core-test-gateway-root"]'passed.pnpm check:import-cycles: 0 cycles..claude/because the parent checkout's ignore rules otherwise lint nothing.git diff --checkwas clean.Autoreview (Codex, two passes, the second with the full retention module attached): no actionable findings.
Isolated Gateway proof at head 2fb0d8d, through the supported
pnpm openclaw gateway runwrapper. Each phase used a fresh scratch state, a free loopback port, token auth, and nogateway.controlUi.root, so the bundled root was auto-resolved. Builds were realpnpm ui:buildoutputs (OPENCLAW_CONTROL_UI_BUILD_ID=devwith distinct build timestamps), each 1,434 assets and about 53.11 MB. P1 was a read-only copy of an older real generation. Probes ran only after preparation settled, in the same fresh process, against chunks that process had never served.Accept-Encoding: br: 200,Content-Encoding: br, bytes match its sidecar entry. P1-only chunk: 404Accept-Encoding: br, gzip: 200, noContent-Encoding, sha256 matches the identity entryIn both phases, directory names match their manifest hashes, identity-only directories contain no sidecars or unlisted files, and the
cannot keep the previous generationwarning did not appear. The fail-before side of this composition comes from the owner-level regression test and the operator cache observation; the old code's 106.2 MB pair cannot fit the budget.