Skip to content

fix(ui): show recoverable lazy renderer errors - #180742

Merged
steipete merged 7 commits into
mainfrom
solid2/w-s2-widget-registration
Oct 22, 2026
Merged

steipete merged 7 commits into
mainfrom
solid2/w-s2-widget-registration

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Canvas/MCP widget registration failures left blank cards. Lazy renderer failures in native avatar, lobster, and lightbox roots also escaped their local loading boundary, because those roots are isolated from the enclosing app's error boundary.

User Impact

Widgets show retryable errors while retaining their host and actions. The lobster and image lightbox expose Close/Retry controls. Failed decorative avatar artwork falls back to a text glyph without replacing the accessible identity.

Why This Change Was Made

The existing registration owner still deduplicates tag loads and admits retries. One shared readiness/error slot observes its promise beside both widget hosts. Native roots gain narrow Errored boundaries. The pet and lightbox failure panels use a Portal so clipped preview/composer hosts cannot hide recovery controls. No renderer or modal library becomes eager, and no owner state is copied into signals.

A failed import panel deliberately does not reproduce the successfully loaded modal's focus trap/return behavior. Close and Retry remain usable without introducing a second overlay lifecycle. Browser-cached module evaluation failures may still require reloading the page. The widget retry capture uses the real registration owner with a fixture loader that first rejects, then resolves and defines the tag; it proves retained host/action identity, not Chromium network-import cache recovery. Decorative avatar failure intentionally has no alert or retry control.

Evidence

Full CI runs on the final head. Local proof covers rejected imports, retained native hosts, widget retries, and the native lightbox close event.

Proof Result
Full CI 39830953116 passed on 9020a4d4d4ca5190664f2de97a0d9e0b102cdcf4; native completed-hosted evidence verified.
UI typecheck Passed
Focused tests Six behaviors passed: widget-registration 2/2, native-lazy-errors 3/3, retained image-lightbox-lazy 1/1 (one worker). Corrected the first run's fixture teardown error and reran only the affected native suite. CI also found an unsafe mock-call index under the broader test typecheck and missing reasons for intentionally rejected mock imports; the test-only correction preserves the assertion and names the isolation contract.
Targeted lint and format Passed; two existing widget reactivity warnings remain on unchanged code. The component-test type leaf and mock-export guard pass after the test-only CI correction. The diagnostic patch also passes the UI E2E type leaf and targeted lint.
Exact-base/head production builds and strict performance Passed against 48b7b4e6c2836891339d977bc939ce651946d891; zero violations or warnings. Production files are identical on the final test-only correction.
Production Knip Same two pre-existing unused files as exact base: src/infra/heartbeat-active-hours.ts and src/infra/heartbeat-wake-policy.ts; no UI additions
Independent review Scoped-clean P0–P2 for production and tests; correction and diagnostic reviews also clean
Synthetic before/after visuals Passed and inspected: Canvas, MCP, native avatar, clipped lightbox, and pet-menu failures at 960 × 900. The bounded Vitest/Playwright capture verifies widget retry identity and no unhandled errors in the after states.
Surface Base gzip Head gzip Delta
Startup JS 317,362 B 317,352 B -10 B (within 64 B build variance)
Startup CSS 41,043 B / 1 request 41,043 B / 1 request 0
Chat boot JS 1,440,332 B 1,440,529 B +197 B
New Session boot JS 1,017,411 B 1,017,799 B +388 B

All surfaces remain below their caps. The small route additions provide local failure panels while preserving the original lazy imports.

Scoped recipe and size counts

These counts cover the four changed production files; the campaign tracks the complete chat/components inventory separately. They represent four existing outcome contracts across five failure paths because Canvas and MCP share the widget-registration contract.

Pattern Before After
Unhandled lazy/registration failure consumers 5 0
Errored declarations 1 5
Loading declarations 4 5
Loading on= 0 0
createMemo calls (one added async readiness observer) 7 8
action, optimistic writes, affects, refresh, isPending, latest 0 0
Effects, direct listeners, owner APIs, flush, component cleanup 0 0
Existing untrack 1 1
Production LOC (final merge base) 1018 1099
Added test LOC 0 202

One new Errored declaration serves both widget registration consumers. The other three protect independent native roots. Production grows by 81 lines to make five failures visible without a new state owner or loader abstraction. The two regression files exercise rejected registration/retry identity, decorative fallback, retained pet scene, and the native lightbox close contract from a clipped host. The existing lightbox suite covers delayed success and disposal.

CI investigation

Run 39816013382 passed every UI unit shard, all nine ordinary UI E2E shards, types, lint, performance, and real-Gateway shard 2. Real-Gateway shard 1 failed only Delegated task PRs through a real Gateway > shows three persisted descendant PRs while keeping the parent branch unpublished: the socket retained three receipt-only items after foreground admission, with two GitHub HTTP requests and no hydrated output observed.

The exact named test passes locally on the CI base 13ab209569f7eb269fd9df5eec778727f94569c0 (111.86 s total) and on its tested merge eb005735febecab1af97c9dc3dec6fb8d22dfec9 (109.61 s total). Both stages show the expected receipt-only → three hydrated details sequence. These passing attempts do not explain or fix the CI failure, and it is not classified as inherited. The additional test-only patch records completed Git operation kinds, error counts, elapsed time, and stage duration through the existing diagnostics channel. That helps distinguish Git reader work between branch inspection and metadata hydration from the already recorded compute-capacity facts. Assertions and deadlines are unchanged; no production diagnostic API was added. The original failure remains documented for the next full CI run. Head 3e0db11456365714c9393af582b02a9522834c13 merges current main to resolve the overlapping diagnostic additions, preserving both groups, all assertions, and deadlines. Its affected TypeScript leaf, targeted lint, formatting, and independent review pass. Full CI is attached as run 39826321053.

Run 39826321053 passes the original descendant-PR scenario and all nine ordinary UI E2E shards. It exposes two test issues that are corrected in the replacement head: the Inbox retry test now explicitly awaits its real lazy import before waiting for Solid; the catalog test now checks the provider-row warning and recovers through the header Refresh action introduced by the Models-page change on main. Assertions about retained choices, explicit RPCs, acquisition counts, and recovered models remain intact; timeouts and production code are unchanged.

The Inbox file passes once before the correction and once after it; the first pass does not recreate hosted scheduling. The catalog test reproduces the same obsolete Retry-locator failure on exact merge base df12fbcd6b2b57371d6cc4687a9a6133c6817257 (74.43 s total), then passes with aligned expectations (65.05 s total). Both corrections have independent scoped-clean reviews; the catalog change also passes its TypeScript leaf and targeted lint and formatting. The combined replacement head 9020a4d4d4ca5190664f2de97a0d9e0b102cdcf4 passed full CI in run 39830953116.

Synthetic before / after

The widgets retain their action controls. The native lightbox and pet error panels remain visible outside clipped hosts. The avatar keeps its normal 20 px slot and uses a decorative glyph.

State Before After
Canvas registration Canvas registration before Canvas registration after
MCP registration MCP registration before MCP registration after
Avatar artwork Avatar artwork before Avatar artwork after
Image lightbox Image lightbox before Image lightbox after
Pet dismiss menu Pet dismiss menu before Pet dismiss menu after

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T18:26:56.002024Z 9020a4d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2896945181

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

fallback={(error, reset) => (
<LazyViewError
error={error()}
onRetry={() => reset()}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Route stale chunks through reload recovery

When an already-open tab hits an obsolete chunk after a deployment, reset() simply invokes the same dynamic import again and can leave Retry stuck on the same stale-chunk failure. The repository already handles this case with isStaleChunkImportError and retryStaleChunkReloadWhenReachable; this handler and the equivalent Retry handlers in image-lightbox.tsx and lobster-pet.tsx need that path so the newly visible recovery action can actually recover from update-related failures.

AGENTS.md reference: AGENTS.md:L76-L77

Useful? React with 👍 / 👎.

Comment on lines +365 to +368
function WidgetRegistration(props: { tagName: string; loadModule: () => Promise<unknown> }) {
const ready = createMemo(() =>
ensureCustomElementDefined(props.tagName, props.loadModule).then(() => null),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear sibling registration errors after a shared retry

When multiple cards require the same tag, ensureCustomElementDefined gives them the same pending promise; if it rejects, every card's local boundary latches the error. Retrying one card can successfully define the element and upgrade all hosts, but only that card resets, so the other cards continue displaying stale failure alerts despite their widgets now working. Keep readiness/recovery with the shared registration owner or notify all consumers when registration succeeds.

AGENTS.md reference: AGENTS.md:L18-L20

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

Adds visible error recovery for lazy widget, lightbox, and lobster renderers, plus a decorative avatar fallback.

Example: Loading the Canvas renderer for document synthetic-widget fails.

  • Before: The card stays blank and the failure is logged.
  • After: The retained card shows an error and Retry beside its existing host and actions.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful and focused direction, but recovery defects and a diff-caused test failure prevent a correctness pass.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 3 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Failed optional UI imports leave blank widgets or remove local recovery controls.
Reason: Visible recovery has clear value, and the maintainer-authored PR establishes direction and explicitly accepts the decorative-avatar and failure-panel focus tradeoffs.

Merge readiness

⛔ Needs changes before merge - 4 items remain

This PR addresses real gaps on current main and has maintainer-approved direction, but recovery and test-cleanup defects need repair before merge.

Priority: P2
Reviewed head: 289694518100bab89be929d7a070c020b5ca9f6d

Before merge

  • Route obsolete chunk failures through guarded reload recovery (P2) - After an update removes an old hashed chunk, resetting this boundary retries the same obsolete import URL. Global automatic recovery does not cover every case: it refuses reload when session storage is unavailable, while the existing manual recovery supports that case. The new Retry then remains ineffective. Detect stale import errors and use retryStaleChunkReloadWhenReachable with the surface's current lifetime, as existing lazy surfaces do; apply the same correction to lightbox and pet Retry handlers. The body’s accepted module-evaluation limitation does not address obsolete asset URLs.
  • Clear sibling errors when shared registration succeeds (P2) - Two Canvas cards share one pending registration promise, but each memo retains its own rejection. Retrying one card can register the tag and upgrade both retained hosts, yet the other card has no reactive dependency on that success and keeps displaying its error. Publish readiness through the existing registration owner so successful registration clears every mounted consumer; cover two cards with one failed load and one successful retry.
  • Dispose native hosts before removing their portal DOM (P2) - The lightbox test leaves its failed native host mounted, then this cleanup removes both that host and its body-level Portal in one operation. Native bridge disposal runs in a queued microtask and subsequently tries to remove the already-removed portal node. Exact-head CI reports the resulting unhandled NotFoundError in this file. Remove the owned host first, allow bridge disposal to finish while its portal still exists, and only then clear remaining fixture DOM.
  • Complete next step - The PR owner should add narrow mock-isolation explanations immediately above the three intentional import-failure mocks and verify the mock-export guard passes.

Findings

  • [P2] Route obsolete chunk failures through guarded reload recovery — ui/src/pages/chat/components/widget-card-view.tsx:374
  • [P2] Clear sibling errors when shared registration succeeds — ui/src/pages/chat/components/widget-card-view.tsx:365-368
  • [P2] Dispose native hosts before removing their portal DOM — ui/src/components/native-lazy-errors.test.tsx:19-21

Tests

  • Missing end-to-end proof: Supply browser before/after failure-and-recovery evidence for the changed surfaces, including clipped native hosts, shared-card recovery, and stale assets; base-red/head-green regression results are not yet shown.
Agent review details

How this fits together

Control UI components load optional renderers through dynamic imports and shared custom-element registration, then render their content or local recovery controls.

flowchart TD
  A[Control UI interaction] --> B[Widget or native host]
  B --> C[Lazy renderer import]
  B --> D[Shared tag registration]
  C --> E[Local error boundary]
  D --> E
  E --> F[Content or recovery controls]
Loading

Technical review

Best possible solution:

Keep the narrow local boundaries, reuse guarded stale-chunk recovery, and let the existing registration owner clear all consumers after successful registration.

Do we have a high-confidence way to reproduce the issue?

Current main logs rejected widget registration and leaves native lazy renderers without local error boundaries; the added tests inject those failures, but no product reproduction was run during this read-only review.

Is this the best way to solve the issue?

Local boundaries preserve existing hosts and lazy loading, but complete recovery must consume the existing stale-chunk and shared registration owners rather than leaving per-card errors latched.

Full review comments:

  • [P2] Route obsolete chunk failures through guarded reload recovery — ui/src/pages/chat/components/widget-card-view.tsx:374
    After an update removes an old hashed chunk, resetting this boundary retries the same obsolete import URL. Global automatic recovery does not cover every case: it refuses reload when session storage is unavailable, while the existing manual recovery supports that case. The new Retry then remains ineffective. Detect stale import errors and use retryStaleChunkReloadWhenReachable with the surface's current lifetime, as existing lazy surfaces do; apply the same correction to lightbox and pet Retry handlers. The body’s accepted module-evaluation limitation does not address obsolete asset URLs.
    Confidence: 0.97
  • [P2] Clear sibling errors when shared registration succeeds — ui/src/pages/chat/components/widget-card-view.tsx:365-368
    Two Canvas cards share one pending registration promise, but each memo retains its own rejection. Retrying one card can register the tag and upgrade both retained hosts, yet the other card has no reactive dependency on that success and keeps displaying its error. Publish readiness through the existing registration owner so successful registration clears every mounted consumer; cover two cards with one failed load and one successful retry.
    Confidence: 0.98
  • [P2] Dispose native hosts before removing their portal DOM — ui/src/components/native-lazy-errors.test.tsx:19-21
    The lightbox test leaves its failed native host mounted, then this cleanup removes both that host and its body-level Portal in one operation. Native bridge disposal runs in a queued microtask and subsequently tries to remove the already-removed portal node. Exact-head CI reports the resulting unhandled NotFoundError in this file. Remove the owned host first, allow bridge disposal to finish while its portal still exists, and only then clear remaining fixture DOM.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 19f6fa1851d8.

Provenance checked

  • Widget registration feedback keeps the original intent (4d18f99: The Solid widget migration preserved lazy registration, existing hosts, actions, and domain owners; subsequent preview-handle work preserved renderer ownership.)
  • Lazy lightbox rendering keeps the original intent (02d223b: The lightbox split removed optional viewer code from chat boot while retaining native-host identity and live media properties.)
  • Pet dismissal menu changes intended behavior with a stated reason (8b1315a: Native menus retained lazy loading and delegated dismissal and focus behavior to their existing owners.)
  • Avatar lazy artwork keeps the original intent (43b8092: The Solid artwork migration preserved lazy face loading and the identity renderer's existing accessibility and fallback ownership.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/pages/chat/components/widget-registration.test.tsx --maxWorkers=1
  • pnpm test ui/src/components/native-lazy-errors.test.tsx --maxWorkers=1
  • pnpm test ui/src/components/image-lightbox-lazy.test.tsx --maxWorkers=1
  • pnpm tsgo:ui
  • pnpm check:test-mock-exports

What I checked:

PR surface

Source +81, Tests +156. Total +237 across 6 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 4 135 54 +81
Tests 2 156 0 +156
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 291 54 +237

Review metrics

Metric Value Why it matters
Production versus test growth Production +81 lines; tests +156 lines Local recovery markup accounts for the production growth; tests cover distinct widget and native-root failure contracts without adding production test seams.

Labels

Label changes:

  • add P2: Optional UI renderers can fail silently or present ineffective recovery, with limited impact beyond the affected surfaces.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Optional UI renderers can fail silently or present ineffective recovery, with limited impact beyond the affected surfaces.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 22, 2026, 12:04 PM ET / 16:04 UTC.

@steipete
steipete enabled auto-merge (squash) October 22, 2026 16:58
@steipete
steipete disabled auto-merge October 22, 2026 17:35
@steipete
steipete merged commit ce9941f into main Oct 22, 2026
104 of 105 checks passed
@steipete
steipete deleted the solid2/w-s2-widget-registration branch October 22, 2026 18:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
* fix(ui): show recoverable lazy renderer errors

* test(ui): retire native hosts before clearing portal fixtures

* test(ui): qualify intentional lazy import failures

* test(ui): diagnose task PR Git read completion

* test(ui): await Inbox retry import settlement

* test(ui): follow provider row discovery feedback
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 ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant