Skip to content

fix(ui): a later browser preview renders above an earlier inline widget in completed turns - #161473

Merged
steipete merged 1 commit into
mainfrom
steipete/chat-visual-order
Sep 30, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/chat-visual-order

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #160940

What Problem This Solves

Fixes: in a completed chat turn, a browser page preview opened after an inline visualization renders above that visualization when the "Worked for…" summary is collapsed.

User Impact

User impact: completed turns show visual results in the order the agent produced them. A widget drawn first stays first, and a page opened later appears after it, above the answer.

Why This Change Was Made

The collapsed "Worked for…" summary gathered every browser tab preview in the turn and rendered them directly under the summary line. Widgets and other kept-visible outputs render after that line, so any preview produced later jumped above them. The work-group collapse now records which visible output precedes each hidden tool group. After the existing whole-turn tab and page deduplication, each preview renders after that output, or under the summary when nothing visible came before it. The agent run frame uses the same placement. Streaming and expanded work are unchanged.

To keep production code size neutral, the change also removes an extra preview wrapper and folds some duplicated setup in the tool card and message group renderers. These cleanups don't change behavior. Production lines: +130 / −132 (net −2); tests +179; docs +3 / −1.

Evidence

Dark theme, synthetic turn: inline widget, then a browser page open, then the answer.

Before After
Before: browser preview above the earlier widget After: widget, then browser preview, then answer
  • ui/src/e2e/chat-worked-for-visualization.e2e.test.ts adds widget-first, browser-first, and run-frame histories built from the real nested exec → show_widget → embed → browser open/close shape seen in a live session, and checks there are no duplicate cards or row overlaps. The widget-first case fails on current main (browser before widget) and passes here. Cost: the four cases take 9.6 s of test execution, about 135 s wall including the shared harness startup.
  • Focused unit tests: 731 tests plus 2 browser-component tests across 24 files. tsgo:ui, oxfmt, oxlint and git diff --check pass.
  • Codex autoreview found no actionable findings (P0–P2) and judged the cleanups behavior-preserving.

Keep browser previews beside their original preceding visible output when
completed work collapses. Record anchors in the existing work-group partition,
then apply them after whole-group tab/page deduplication in both transcript
and run-frame rendering. Later previews use separate measured virtual rows;
streaming and expanded work keep their existing paths.

Remove the extra preview wrapper and skip preview preparation for groups
without browser tabs, while reusing cached tool-card extraction. Simplify
row insertion, share collapsed-tool summary setup and review-chip rendering,
remove repeated translation-key prefixes and a single-use review-label
wrapper, and reuse the already-selected footer action owners. Preserve all
existing labels, action ownership, deduplication, and regression assertions.
Production delta: +130/-132, net -2 lines (tests and docs excluded).

The nested exec/show_widget/embed/browser open-close regression reproduced
browser-before-widget on the base and passes after cleanup for widget-first,
browser-first, and run-frame histories, without duplicate cards or row
overlaps. All four E2E cases pass (9.59s suite execution; 134.92s including
harness startup). Focused validation passes 731 unit tests and 2 browser
component tests across 24 files in 98.24s, plus UI typecheck, formatting,
lint, and diff checks. Synthetic before/after captures remain local.
@clawsweeper

clawsweeper Bot commented Sep 30, 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.

@steipete
steipete marked this pull request as ready for review September 30, 2026 00:58
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: M labels Sep 30, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 9:04 PM ET / September 30, 2026, 01:04 UTC.

ClawSweeper review

What this changes

The branch places browser page previews after the visible output that preceded them in completed Control UI chat turns, updates run-frame rendering, adds browser regression cases, and documents the order.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Current main still renders collapsed browser previews beneath the work summary, so the ordering defect remains. The PR addresses that distinct problem, and the inspected before/after screenshots show the intended visible order. No blocking patch defect was established by this read-only review.

Priority: P2
Reviewed head: 5fda89e3bf04215c0f5b9009ee769af597af49de

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Direct before/after UI evidence and focused browser coverage support a bounded presentation fix with no established blocking defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The changed completed-turn grouping and transcript/run-frame renderers are exercised through a mocked Gateway in the Control UI browser harness. Inspected before/after screenshots show the browser card moving below the earlier widget, and the added cases assert both orders; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The changed completed-turn grouping and transcript/run-frame renderers are exercised through a mocked Gateway in the Control UI browser harness. Inspected before/after screenshots show the browser card moving below the earlier widget, and the added cases assert both orders; no stored-data contract changes.
Evidence reviewed 6 items Current-main behavior: Current main passes each collapsed work group’s browser previews directly to its summary renderer, which places them before visible answer groups; the PR’s ordering behavior is not present there.
Introduced placement: The PR records the preceding visible output for hidden groups and places selected browser previews after that output in both transcript and run-frame rendering.
Browser regression coverage: Three added browser cases exercise widget-first, browser-first, and run-frame histories through a mocked Gateway and assert the rendered order, single-card counts, disclosure state, and row geometry. The contributor reports a failing widget-first baseline on main.
Findings None None.
Security None None.

How this fits together

The Control UI turns Gateway chat history into completed-turn work summaries and visible answers. Its transcript renderer places tool previews, widgets, and answers into measured chat rows.

flowchart LR
A[Gateway chat history] --> B[Completed turn grouping]
B --> C[Visible output anchor]
B --> D[Browser preview selection]
C --> E[Transcript or run frame]
D --> E
E --> F[Measured chat rows]
F --> G[Displayed result order]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -2, Tests +179, Docs +2. Total +179 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 6 130 132 -2
Tests 1 179 0 +179
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 312 133 +179

Review metrics

Metric Value Why it matters
New browser ordering cases 3 added; contributor reports 9.6 s execution The cases cover both result orders and a run frame; the reported 135 s wall time includes shared harness startup.

Technical review

Best possible solution:

Keep preview placement owned by completed-turn grouping and render the resulting cards in measured transcript rows while preserving existing tab and page deduplication.

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

Yes. A completed dashboard turn containing a widget followed by a browser page open reaches the current-main ordering path; the contributor supplied a before capture and reports that the focused browser case fails on main. This read-only review did not rerun it.

Is this the best way to solve the issue?

Yes. The patch records a visible-output anchor during the existing grouping pass and uses measured rows for later previews without changing stored history or the live-turn path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2663c6b62028.

Labels

Label changes:

  • add P2: The defect affects the visible order of completed chat results, with a limited Control UI blast radius.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed completed-turn grouping and transcript/run-frame renderers are exercised through a mocked Gateway in the Control UI browser harness. Inspected before/after screenshots show the browser card moving below the earlier widget, and the added cases assert both orders; no stored-data contract changes.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed completed-turn grouping and transcript/run-frame renderers are exercised through a mocked Gateway in the Control UI browser harness. Inspected before/after screenshots show the browser card moving below the earlier widget, and the added cases assert both orders; no stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The changed completed-turn grouping and transcript/run-frame renderers are exercised through a mocked Gateway in the Control UI browser harness. Inspected before/after screenshots show the browser card moving below the earlier widget, and the added cases assert both orders; no stored-data contract changes.

Label justifications:

  • P2: The defect affects the visible order of completed chat results, with a limited Control UI blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The changed completed-turn grouping and transcript/run-frame renderers are exercised through a mocked Gateway in the Control UI browser harness. Inspected before/after screenshots show the browser card moving below the earlier widget, and the added cases assert both orders; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed completed-turn grouping and transcript/run-frame renderers are exercised through a mocked Gateway in the Control UI browser harness. Inspected before/after screenshots show the browser card moving below the earlier widget, and the added cases assert both orders; no stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed completed-turn grouping and transcript/run-frame renderers are exercised through a mocked Gateway in the Control UI browser harness. Inspected before/after screenshots show the browser card moving below the earlier widget, and the added cases assert both orders; no stored-data contract changes.

Evidence

What I checked:

  • Current-main behavior: Current main passes each collapsed work group’s browser previews directly to its summary renderer, which places them before visible answer groups; the PR’s ordering behavior is not present there. (ui/src/pages/chat/components/chat-transcript-projection.ts:479, 2663c6b62028)
  • Introduced placement: The PR records the preceding visible output for hidden groups and places selected browser previews after that output in both transcript and run-frame rendering. (ui/src/pages/chat/chat-thread-grouping.ts:398, 5fda89e3bf04)
  • Browser regression coverage: Three added browser cases exercise widget-first, browser-first, and run-frame histories through a mocked Gateway and assert the rendered order, single-card counts, disclosure state, and row geometry. The contributor reports a failing widget-first baseline on main. (ui/src/e2e/chat-worked-for-visualization.e2e.test.ts:41, 5fda89e3bf04)
  • Inspected visual proof: The PR body’s downloaded before image shows the browser card above the widget; its after image shows the widget, browser card, then answer in a dark-theme synthetic Control UI turn. Both prepared images were inspected. (5fda89e3bf04)
  • Feature history: Merged history for completed-turn grouping includes earlier answer-preservation work by Peter Steinberger and Josh Lehman; browser preview deduplication has a separate merged history entry by RoboClaw. These are routing signals, not proof of who introduced the defect. (ui/src/pages/chat/chat-thread-grouping.ts:290, 2663c6b62028)
  • Distinct related work: The linked, merged fix: dark-theme visualizations sit on an opaque box with no padding #160940 addresses widget dark-theme appearance and agent browser verification; it does not address collapsed browser preview ordering. (06120a1ef9aa)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RoboClaw: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete steipete self-assigned this Sep 30, 2026
@steipete
steipete merged commit 3e4daf8 into main Sep 30, 2026
147 of 149 checks passed
@steipete
steipete deleted the steipete/chat-visual-order branch September 30, 2026 02:19
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
Keep browser previews beside their original preceding visible output when
completed work collapses. Record anchors in the existing work-group partition,
then apply them after whole-group tab/page deduplication in both transcript
and run-frame rendering. Later previews use separate measured virtual rows;
streaming and expanded work keep their existing paths.

Remove the extra preview wrapper and skip preview preparation for groups
without browser tabs, while reusing cached tool-card extraction. Simplify
row insertion, share collapsed-tool summary setup and review-chip rendering,
remove repeated translation-key prefixes and a single-use review-label
wrapper, and reuse the already-selected footer action owners. Preserve all
existing labels, action ownership, deduplication, and regression assertions.
Production delta: +130/-132, net -2 lines (tests and docs excluded).

The nested exec/show_widget/embed/browser open-close regression reproduced
browser-before-widget on the base and passes after cleanup for widget-first,
browser-first, and run-frame histories, without duplicate cards or row
overlaps. All four E2E cases pass (9.59s suite execution; 134.92s including
harness startup). Focused validation passes 731 unit tests and 2 browser
component tests across 24 files in 98.24s, plus UI typecheck, formatting,
lint, and diff checks. Synthetic before/after captures remain local.
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: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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