Repository navigation
fix(ui): a later browser preview renders above an earlier inline widget in completed turns - #161473
Conversation
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.
|
🦞👀 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 September 29, 2026, 9:04 PM ET / September 30, 2026, 01:04 UTC. ClawSweeper reviewWhat this changesThe 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 provenancePossible 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -2, Tests +179, Docs +2. Total +179 across 8 files. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
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.
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.
ui/src/e2e/chat-worked-for-visualization.e2e.test.tsadds widget-first, browser-first, and run-frame histories built from the real nestedexec→show_widget→ embed →browseropen/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.tsgo:ui, oxfmt, oxlint andgit diff --checkpass.