Skip to content

fix(ui): playing chat widgets reload when the run finishes or the gateway reconnects - #168181

Merged
steipete merged 1 commit into
mainfrom
steipete/widget-state-retention
Oct 10, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/widget-state-retention

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a playing inline chat widget (for example a show_widget video) reloads and loses its state when the agent's run finishes or the Control UI's gateway client reconnects.

User Impact

User impact: in Chrome/Edge 133+ and Firefox 144+, a widget keeps playing and keeps its local interaction state when its run completes and the widget moves into the final reply. Every browser keeps rendered widgets across event-gap recovery, wake reconnects, online recovery, and Retry now. Safari still reloads the widget when it moves into the final reply, because it lacks atomic DOM moves; it gets the reconnect fix.

Why This Change Was Made

  • Run completion. While a run is live, the persisted show_widget result renders as its own transcript row. When the final assistant reply embeds that same document, the reply row takes over the widget, and the run frame reorders its body parts. Both steps removed or reinserted the iframe, and removing an iframe discards its document. Production evidence: the gateway log shows a second canvas.document.view read 1.5 s after the final reply, on the same open WebSocket. This change keeps the transcript projection as-is and hands the live element across instead:
    • A small AsyncDirective parks the widget element in an inert offscreen container. Lit's clear path notifies the directive before it removes DOM, so the element is still connected when it parks.
    • The parked element is adopted by the reply's mount, or disposed after one second if nothing claims it.
    • The run frame's body parts reorder with moveBefore.
    • connectedMoveCallback keeps the view's sandbox lifecycle intact during atomic moves.
    • Parked widgets cannot send prompts or runtime-error wakes.
    • Without moveBefore, rendering is exactly what Lit did before.
  • Reconnects. The canvas widget view tied rendered content to the gateway client object. The gateway store creates a new client on every event-gap recovery, wake reconnect, and manual retry, so each of those destroyed a playing widget. Content ownership now uses principal facts: document, session, connection revision, gateway URL, profile, recovery scope, and read access. In-flight reads and prompt authority still require the current client and frame generation, and they revalidate before prompts resume. Credential changes still clear the view.

Evidence

  • ui/src/e2e/chat-widget-retention.e2e.test.ts (real chat transcript, mock gateway, Chromium, ~25 s for pnpm test <file> --maxWorkers=1):
    • A live run renders the show_widget result, and a click sets in-widget state.
    • The same run's final reply then embeds the document and the run completes.
    • Assertions: exactly one widget, now inside the final reply, on the same outer iframe node. Inner state is preserved and still interactive. No second canvas.document.view read. Wheel scroll still forwards to the transcript.
    • Fails before the fix.
  • ui/src/components/canvas-widget-view.test.ts, 32 tests:
    • A replacement client keeps the iframe and revalidates through the new client.
    • Prompt authority returns only after revalidation.
    • Credential, session, and denial changes still clear the view.
    • Parked widgets cannot prompt or wake.
  • The new mount and keyed-repeat helpers have unit tests, including the non-atomic fallback. The existing widget-card tests pass.
  • check:changed passed on Testbox (146 s). oxfmt and Codex autoreview are clean.
  • Not covered: Firefox and Safari were not driven. Safari's reload at run completion is a documented limitation.

Related: #168143 (widget fullscreen, content-fit sizing, and clipped captions; same user report).

Retained-widget authorization proof

Additional Chromium browser proof and its disposable source pass on head 77310579857f722c70b206392486c4694ab5cf17: same-account client replacement retains the original iframe and permits prompts/wakes after revalidation; account replacement, recovery-scope replacement, and loss of read access block the original sandbox before prompt dispatch or outbound chat.send/wake. The stale sandbox is deliberately kept alive, and its real runtime-error message is observed, so iframe destruction and error deduplication cannot explain the negative result. Three cases pass in 24.71 s wall time. This uses the real UI/sandbox with a mock Gateway, not a live external Gateway.

Exact-head CI run 38023254215 passed.

Run completion moves a live show_widget document from its tool-result
preview into the final assistant reply, then reorders the run frame.
Preserve its connected element through a bounded parking handoff and
atomic keyed body-part moves without changing transcript projection.
Disable prompts and runtime-error wakes while parked.

Retain rendered content by document, session, and principal facts rather
than Gateway client identity. Retire request and prompt bindings when the
client changes, revalidate through the new client, and keep the iframe
when document bytes and sandbox configuration are unchanged. Credential
revision changes still clear the view, and wakes use the validated client.

State-preserving DOM moves require native moveBefore (Chrome/Edge 133+
and Firefox 144+). Safari retains the original Lit and remount behavior.
Unclaimed parked elements are disposed after one second; a second parked
copy with the same key replaces the older copy as requested.

Regressions failed before the fixes and pass afterward: replacement-client
retention and prompt revalidation, live tool-result to final-reply handoff,
parked authority, and non-atomic prepend behavior. The real transcript E2E
retains the original iframe, inner counter, and one view read, and verifies
scroll forwarding after completion.

Validation: 32 view tests, 2 mount tests, 3 keyed-range tests, 15 existing
widget-card tests, and the focused Chromium transcript E2E pass. The full
changed-file gate passed on a verified remote Crabbox SSH checkout, with
candidate hashes checked before and after. Oxfmt and isolated review pass.
@clawsweeper

clawsweeper Bot commented Oct 10, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: XL labels Oct 10, 2026
@steipete
steipete marked this pull request as ready for review October 10, 2026 04:12
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserve inline chat widgets across run completion and same-account Gateway client replacement.

Example: The cv_retained_counter widget reaches count 1 before its agent run finishes.

  • Before: Moving the widget into the final reply reloads its iframe and resets the count.
  • After: Chromium retains the original iframe and count 1, and the next click advances it to 2.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused repair with Chromium boundary proof, successful exact-head CI, and no actionable findings; browser coverage remains Chromium-only.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Exact-head Chromium output exercises the built Control UI, production sandbox, real private ports, and mock WebSocket Gateway: same-account replacement preserves the iframe and permits revalidated prompts/wakes, while surviving revoked sandboxes emit no prompt event or outbound chat.send/wake after account, recovery-scope, or read-access changes. The completion browser scenario preserves interactive inner state through final-reply transfer. Downloaded historical offline screenshots were inspected but do not establish this change; Firefox and Safari were not driven.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Playing widgets reload and lose local state when a response completes or the Gateway client reconnects.
Reason: Preserving an existing widget's state has clear value, and the maintainer-authored repair retains existing security boundaries and browser fallback behavior.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current widget-state bug; the new browser trace resolves the earlier authorization-proof concern, and no actionable introduced defect was found.

Priority: P2
Reviewed head: 77310579857f722c70b206392486c4694ab5cf17

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI renders authenticated Canvas documents inside sandboxed chat iframes; transcript updates move their presentation, while Gateway state governs document reads and prompt or wake authority.

flowchart TD
  A[Gateway transcript events] --> B[Chat run frame]
  B --> C[Widget mount and handoff]
  C --> D[Canvas widget view]
  E[Current Gateway authority] --> D
  D --> F[Sandbox iframe]
  F --> G[Guarded prompts and wakes]
  G --> E
Loading

Technical review

Best possible solution:

Land the focused lifecycle repair with current-client authorization intact and the documented Safari fallback.

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

Current-main source exposes both destructive iframe movement and replacement-client invalidation; supplied Chromium evidence exercises the repaired paths, but this read-only review ran no code.

Is this the best way to solve the issue?

The change repairs widget presentation lifetime at its existing owners while preserving authoritative revalidation and avoiding transcript-projection changes.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Rendered-content ownership changes intended behavior with a stated reason (9764de1: Keep loaded visualizations usable offline while isolating their account and connection authority.)
  • Run-frame keyed rendering keeps the original intent (0d67d5e: Preserve live answer and control identity as surrounding transcript segments change.)
  • Managed widget mounting keeps the original intent (428e479: Load authenticated widget content through the isolated sandbox rather than direct iframe navigation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 428e479 adds ui/src/components/canvas-widget-view.ts:97 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 428e4793bd5f; files: ui/src/components/canvas-widget-view.ts)
  • RoboClaw: Raw commit 9764de1 adds ui/src/components/canvas-widget-view.ts:192 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9764de174749; files: ui/src/components/canvas-widget-view.ts)

PR surface

Source +238, Tests +503, Docs +5. Total +746 across 11 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 5 260 22 +238
Tests 4 625 122 +503
Docs 2 6 1 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 891 145 +746

Review metrics

Metric Value Why it matters
Production versus test changes Production +260/-22 lines; tests +625/-122 lines. Production growth implements connected DOM transfer and atomic ordering; browser and lifecycle coverage protect iframe state and authorization.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Widget playback and local interaction state reset during ordinary chat completion or reconnect, with impact limited to inline widgets.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-10T04:18:38.257Z sha 7731057 :: needs real behavior proof before merge. :: none

Reviewed October 10, 2026, 12:48 AM ET / 04:48 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The requested retained-port authorization proof is now complete on unchanged head 77310579857f722c70b206392486c4694ab5cf17.

A disposable Chromium E2E probe used the built Control UI, real Canvas sandbox server/wrapper, real private MessagePorts, trusted pointer clicks, and the existing mock WebSocket Gateway. It observed final outbound chat.send and wake requests, without mocking the view, prompt dispatcher, or send/wake handlers.

The probe induces event-sequence gaps, verifies the actual Gateway client object changes, waits for document revalidation, and confirms the original iframe survives. Positive controls then send two prompts through the normal chat path and one deliberate runtime-error wake. The wake assertion matches both the exact document ID and authority crash probe; the other document has no earlier wake, so deduplication cannot explain its negative result.

For the negative controls, it moves that original iframe to a connected test-only holder before revocation, keeping the actual old sandbox and private port alive even when the application clears its view. It then changes the next real handshake to a different account/recovery scope, a different recovery scope alone, or pairing-only scopes (no read/write/admin access), and induces a fresh client replacement. Pointer clicks in the original sandbox try both a prompt and a runtime error. A top-level observer confirms the original sandbox's runtime-error message arrives. No openclaw-widget-prompt event, chat.send, or wake is emitted. The prompt-event assertion makes the negative independent of the holder being outside the chat pane.

This is browser + mock-Gateway boundary evidence, not a live external Gateway claim. No production or committed test source changed. The probe uses serviceWorkers: "allow" because Playwright's blocking injection itself throws in opaque sandbox frames and otherwise consumes their one-time error report.

node scripts/run-vitest.mjs ui/src/e2e/chat-widget-authority.proof.e2e.test.ts --maxWorkers=1
3 tests passed; wrapper wall time 24.71 s; scenario time 8.78 s.
{"proof":"account","clientReplaced":true,"originalIframeRetained":true,"postRevalidationChatSends":2,"postRevalidationWakes":1,"revokedOriginalSandboxStillRunning":true,"revokedRawErrorArrived":true,"revokedPromptEventDelta":0,"revokedChatSendDelta":0,"revokedWakeDelta":0}
{"proof":"recovery-scope","clientReplaced":true,"originalIframeRetained":true,"postRevalidationChatSends":2,"postRevalidationWakes":1,"revokedOriginalSandboxStillRunning":true,"revokedRawErrorArrived":true,"revokedPromptEventDelta":0,"revokedChatSendDelta":0,"revokedWakeDelta":0}
{"proof":"read-access","clientReplaced":true,"originalIframeRetained":true,"postRevalidationChatSends":2,"postRevalidationWakes":1,"revokedOriginalSandboxStillRunning":true,"revokedRawErrorArrived":true,"revokedPromptEventDelta":0,"revokedChatSendDelta":0,"revokedWakeDelta":0}
Disposable probe source
import { expect, it } from "vitest";
import { buildWidgetDocument } from "../../../src/canvas/wrap.js";
import { clickBoardWidgetControl } from "../test-helpers/control-ui-e2e-widget.ts";
import { useCanvasSandboxFixture } from "./canvas-sandbox.test-support.ts";
import { controlUiSessionUrl, createChatFlowE2eSuite, installMockGateway } from "./chat-flow.test-support.ts";
import { createControlUiE2eContextOptions } from "./control-ui-e2e-suite.test-support.ts";

// Disposable boundary proof for PR #168181; no production hooks or synthetic ports.
const suite = createChatFlowE2eSuite();
suite.define(() => {
  const canvasView = useCanvasSandboxFixture();
  for (const change of ["account", "recovery-scope", "read-access"] as const) {
    it(`retained widget authority: ${change}`, async () => {
      await suite.withPage({ ...createControlUiE2eContextOptions(), serviceWorkers: "allow" }, async ({ page }) => {
        const sessionKey = `agent:main:dashboard:authority-${change}`;
        const ids = [`cv_positive_${change}`, `cv_negative_${change}`];
        const html = buildWidgetDocument("Authority proof", `<main style="height:180px"><button onclick="sendPrompt('authority probe')">Prompt</button><button onclick="throw new Error('authority crash probe')">Crash</button></main>`);
        const messages = [{ role: "assistant", timestamp: Date.now(), content: ids.flatMap(id => [
          { type: "text", text: `[embed](/__openclaw__/canvas/documents/${id}/index.html)` },
          { type: "canvas", preview: { kind: "canvas", surface: "assistant_message", render: "url", viewId: id, url: `/__openclaw__/canvas/documents/${id}/index.html`, title: id, preferredHeight: 180, sandbox: "scripts" } },
        ]) }];
        const gateway = await installMockGateway(page, {
          sessionKey, historyMessages: messages,
          presenceUsers: [{ self: true, id: "proof-account-a", name: "Synthetic A" }],
          methodResponses: { "canvas.document.view": canvasView(html) },
        });
        await page.goto(controlUiSessionUrl(suite.server.baseUrl, sessionKey));
        const widgets = page.locator(".chat-thread openclaw-canvas-widget-view");
        await expect.poll(() => widgets.count()).toBe(2);
        const positive = widgets.nth(0).locator("iframe");
        const negative = widgets.nth(1).locator("iframe");
        const positiveInner = positive.contentFrame().frameLocator("iframe");
        const negativeInner = negative.contentFrame().frameLocator("iframe");
        await positiveInner.getByRole("button", { name: "Prompt", exact: true }).waitFor();
        await negativeInner.getByRole("button", { name: "Prompt", exact: true }).waitFor();
        const original = await positive.elementHandle();
        await page.evaluate(() => { const app = document.querySelector("openclaw-app") as any; (window as any).proofOldClient = app.runtime.context.gateway.snapshot.client; });
        await gateway.deliverLatest({ type: "event", event: "proof-gap", payload: {}, seq: 1000000 });
        await gateway.deliverLatest({ type: "event", event: "proof-gap", payload: {}, seq: 1000002 });
        await page.waitForFunction(() => (document.querySelector("openclaw-app") as any).runtime.context.gateway.snapshot.phase === "connected");
        await page.waitForFunction(() => { const app = document.querySelector("openclaw-app") as any; return app.runtime.context.gateway.snapshot.client !== (window as any).proofOldClient; });
        await expect.poll(async () => (await gateway.getRequests("canvas.document.view")).length).toBe(4);
        expect(await positive.evaluate((frame, old) => frame === old, original)).toBe(true);
        await page.waitForFunction(() => [...document.querySelectorAll("openclaw-canvas-widget-view")].every((view: any) => !view.pending));
        const send = async (inner: typeof positiveInner) => {
          const count = (await gateway.getRequests("chat.send")).length;
          await clickBoardWidgetControl(page, inner.getByRole("button", { name: "Prompt", exact: true }));
          const request = await gateway.waitForRequest("chat.send", { after: count });
          expect(request.params).toMatchObject({ sessionKey, message: "authority probe" });
          await gateway.emitChatFinal({ runId: String((request.params as any).idempotencyKey), sessionKey, text: "Acknowledged." });
        };
        await send(positiveInner);
        await clickBoardWidgetControl(page, positiveInner.getByRole("button", { name: "Crash", exact: true }));
        await expect.poll(async () => (await gateway.getRequests("wake")).filter(request => JSON.stringify(request.params).includes(ids[0]!) && JSON.stringify(request.params).includes("authority crash probe")).length).toBe(1);
        // Negative control uses a distinct document: no error-dedup/rate limiter was spent.
        await send(negativeInner);
        expect((await gateway.getRequests("wake")).filter(request => JSON.stringify(request.params).includes(ids[1]!))).toHaveLength(0);
        const counts = { chat: (await gateway.getRequests("chat.send")).length, wake: (await gateway.getRequests("wake")).length };
        const oldNegative = await negative.elementHandle();
        await negative.evaluate(frame => {
          const holder = document.createElement("div");
          holder.style.cssText = "position:fixed;bottom:0;left:0;z-index:99999;height:180px;width:600px;background:white";
          document.body.append(holder);
          holder.moveBefore(frame, null);
          (window as any).proofRawErrors = 0;
          (window as any).proofPromptEvents = 0;
          document.addEventListener("openclaw-widget-prompt", () => (window as any).proofPromptEvents++, true);
          window.addEventListener("message", event => {
            if (event.source === frame.contentWindow && event.data?.type === "openclaw:widget-runtime-error") (window as any).proofRawErrors++;
          });
        });
        const hello = await page.evaluate(() => JSON.parse(JSON.stringify((document.querySelector("openclaw-app") as any).runtime.context.gateway.snapshot.hello)));
        if (change === "read-access") hello.auth.scopes = ["operator.pairing"];
        else hello.auth.recoveryScope = `proof-new-${change}`;
        if (change === "account") {
          await gateway.setMethodResponse("users.self", { profile: { id: "proof-account-b", displayName: "Synthetic B", emails: [], avatarMime: null, hasAvatar: false, githubIdentity: null, mergedInto: null, createdAt: 1, updatedAt: 1 } });
        }
        await gateway.setMethodResponse("connect", hello);
        await gateway.deliverLatest({ type: "event", event: "proof-gap", payload: {}, seq: 1000000 });
        await gateway.deliverLatest({ type: "event", event: "proof-gap", payload: {}, seq: 1000002 });
        await page.waitForFunction(() => (document.querySelector("openclaw-app") as any).runtime.context.gateway.snapshot.phase === "connected");
        await page.waitForFunction(({ change }) => {
          const snapshot = (document.querySelector("openclaw-app") as any).runtime.context.gateway.snapshot;
          return change === "read-access" ? snapshot.hello.auth.scopes.includes("operator.pairing") && !snapshot.hello.auth.scopes.includes("operator.read") : snapshot.hello.auth.recoveryScope === `proof-new-${change}`;
        }, { change });
        // Keep the revoked original sandbox running to exercise real stale messages,
        // rather than accepting browser destruction as the reason they cannot send.
        const oldOuter = await oldNegative!.contentFrame();
        const oldInner = oldOuter!.frameLocator("iframe");
        await clickBoardWidgetControl(page, oldInner.getByRole("button", { name: "Prompt", exact: true }));
        await clickBoardWidgetControl(page, oldInner.getByRole("button", { name: "Crash", exact: true }));
        await page.waitForFunction(() => (window as any).proofRawErrors === 1);
        await page.evaluate(() => new Promise<void>(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve()))));
        expect(await page.evaluate(() => (window as any).proofPromptEvents)).toBe(0);
        expect(await gateway.getRequests("chat.send")).toHaveLength(counts.chat);
        expect(await gateway.getRequests("wake")).toHaveLength(counts.wake);
        console.log(JSON.stringify({ proof: change, clientReplaced: true, originalIframeRetained: true, postRevalidationChatSends: counts.chat, postRevalidationWakes: counts.wake, revokedOriginalSandboxStillRunning: true, revokedRawErrorArrived: true, revokedPromptEventDelta: 0, revokedChatSendDelta: 0, revokedWakeDelta: 0 }));
      });
    });
  }
});

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@steipete
steipete merged commit ff06ae6 into main Oct 10, 2026
161 of 163 checks passed
@steipete
steipete deleted the steipete/widget-state-retention branch October 10, 2026 04:57
@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 11, 2026
…enclaw#168181)

Run completion moves a live show_widget document from its tool-result
preview into the final assistant reply, then reorders the run frame.
Preserve its connected element through a bounded parking handoff and
atomic keyed body-part moves without changing transcript projection.
Disable prompts and runtime-error wakes while parked.

Retain rendered content by document, session, and principal facts rather
than Gateway client identity. Retire request and prompt bindings when the
client changes, revalidate through the new client, and keep the iframe
when document bytes and sandbox configuration are unchanged. Credential
revision changes still clear the view, and wakes use the validated client.

State-preserving DOM moves require native moveBefore (Chrome/Edge 133+
and Firefox 144+). Safari retains the original Lit and remount behavior.
Unclaimed parked elements are disposed after one second; a second parked
copy with the same key replaces the older copy as requested.

Regressions failed before the fixes and pass afterward: replacement-client
retention and prompt revalidation, live tool-result to final-reply handoff,
parked authority, and non-atomic prepend behavior. The real transcript E2E
retains the original iframe, inner counter, and one view read, and verifies
scroll forwarding after completion.

Validation: 32 view tests, 2 mount tests, 3 keyed-range tests, 15 existing
widget-card tests, and the focused Chromium transcript E2E pass. The full
changed-file gate passed on a verified remote Crabbox SSH checkout, with
candidate hashes checked before and after. Oxfmt and isolated review pass.
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 docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant