Skip to content

fix(ui): recover failed lazy surfaces - #126409

Merged
steipete merged 1 commit into
mainfrom
steipete/sweet-banach-fad19f
Aug 19, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/sweet-banach-fad19f

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where opening an optional Control UI surface could leave users on a permanent mascot/loading state—or silently do nothing—when its hashed custom-element module failed to load. Standalone terminal, desktop, dashboard, and approval views could stall; command-palette, debug, approvals, and other non-session panel actions could disappear without an outcome.

Why This Change Was Made

Optional custom-element loading previously owned only pending/defined state: rejected imports were logged and then discarded. This change makes loading and failure explicit, gives users visible Retry and Close actions, and records the exact shell action in a closed sessionStorage event descriptor so it can be replayed after the existing bounded reachable-document reload. Focused document URLs keep their own intent. Close fences late replay, context reset abandons it, and an ordinary document reload preserves it.

Chromium pins a failed hashed module URL for the document lifetime, so Retry deliberately uses the existing reachable-document reload owner. There is no gateway/version compatibility fallback and no alternate import path. The obsolete manual control-ui-shared chunk grouping was removed, reducing startup requests while keeping the new lifecycle below the existing byte budget.

Optional shell loading was introduced by b395dfc in #106243; later focused-document reuse carried that lifecycle forward.

User Impact

A failed optional UI module now ends in a visible, actionable state. Users can retry through a safe document reload and return to the exact intended surface, or close the failed action without a delayed replay reopening it.

Evidence

Before: the command-palette action disappears and leaves only the mascot/home surface, with no error or recovery action.

Before: failed lazy action has no visible outcome

Failure: the real hashed import error is visible with Retry and Close.

Failure: visible lazy-load error with Retry and Close

Recovered: Retry reloads the document and reopens the original command palette without another user action.

Recovered: command palette restored after reload

Recovery recording:

recovery.webm

Production/tooling LOC: +494/-170 (net +324). Tests/test support: +703/-155 (net +548). The production growth is the missing explicit load/error lifecycle, durable reload-action ownership, and visible Retry/Close behavior; the old promise-only/error-swallowing paths and obsolete manual chunk grouping were deleted.

Validation on the committed bytes:

  • Focused lazy/native Vitest selection: 31 passed; the broader focused architecture set previously passed 49/50 before the final focused run.
  • pnpm test:ui: 710 files passed; 10,061 passed, 1 skipped.
  • node scripts/check-changed.mjs: passed after the assertion fix.
  • pnpm ui:i18n:verify: passed; keys=5,421, raw-copy baseline=79.
  • pnpm ui:build: passed. Startup JS is 10 requests and 345,196 B gzip (337.1 KiB), below the unchanged 345,485 B (337.4 KiB) limit.
  • node scripts/run-vitest.mjs ui/src/e2e/lazy-custom-element-recovery.e2e.test.ts: 4/4 passed against the production bundle in Chromium with a mocked Gateway. The test intercepts the actual hashed terminal, desktop, dashboard, and command-palette chunks: the first chunk request is aborted, the first HEAD probe returns 503, Retry succeeds on the next HEAD, the document reloads, the second chunk request succeeds, and the original action replays.
  • git diff --check: passed.
  • Fresh Codex autoreview had no accepted/actionable finding; the suggested panel replay loop was rejected by direct source verification because terminal, browser, desktop, and custodian handlers return at their isOptionalElementDefined(...) guard after replay. Broad UI and panel tests remain green.

AI-assisted: yes. The maintainer reviewed, understands, and owns the change.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Aug 19, 2026
@steipete
steipete marked this pull request as ready for review August 19, 2026 19:13
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready evidence for exact head 6a73b0398daf843ef8bc2cc509744af670f0096f:

  • node scripts/watch-pr-ci.mjs 126409 6a73b0398daf843ef8bc2cc509744af670f0096f completed SUCCESS with 0 pending checks. Exact-head CI run: 32291814926. The earlier draft-era run was superseded.
  • pnpm test:ui: 710 files passed; 10,061 tests passed, 1 skipped.
  • Focused lazy/native Vitest selection: 31 passed. node scripts/run-vitest.mjs ui/src/e2e/lazy-custom-element-recovery.e2e.test.ts: 4/4 passed.
  • node scripts/check-changed.mjs: passed.
  • pnpm ui:i18n:verify: passed; 5,421 keys, raw-copy baseline 79.
  • pnpm ui:build: passed; startup JS 10 requests, 345,196 B gzip (337.1 KiB), under the unchanged 345,485 B (337.4 KiB) limit.
  • git diff --check: passed.
  • Production-bundle Chromium proof intercepted the actual hashed terminal, desktop, dashboard, and command-palette chunks: first chunk request aborted, first HEAD probe 503, Retry HEAD succeeded, document reloaded, second chunk request succeeded, and the exact original action replayed. Before/failure/recovered screenshots and the recovery video are embedded in the PR body.
  • Production/tooling LOC: +494/-170 (net +324). Tests/test support: +703/-155 (net +548). The positive production delta owns the previously missing explicit load/error lifecycle, durable reload action, and visible Retry/Close; the promise-only error-swallowing path and obsolete manual chunk grouping were removed.
  • Fresh autoreview: no accepted/actionable findings.
  • Latest ClawSweeper comment at fix(ui): recover failed lazy surfaces #126409 (comment) is still the exact-head review-started placeholder. It publishes no findings and no Rank-up moves:; there are therefore no moves to apply or skip, and repository policy does not block landing on the queued publisher.

Known proof gaps: none.

@steipete
steipete merged commit 5eda48e into main Aug 19, 2026
190 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant