Repository navigation
refactor(ui): simplify chat rendering and lifecycle state - #133567
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
The requested cleanup removes duplicated composer contracts, attachment source projection, menu/listener state, frame admission, and queue/payload wrappers. Full-message rendering carries prepared state, while admission still rereads the live owner to avoid duplicate loads when projected rows share a source ID. Dead tool-row canvas preview code and unused inputs/exports are removed. No persistence, protocol, configuration, dependency, media-authorization, retry-budget, or asynchronous send-order change. Production: +256/-568 (net -312). Tests: +49/-23 (net +26). Assertion baseline: +2/-2, recording two fewer assertions. Total: -286 lines across 20 files. Validation (task-local cache paths omitted): node scripts/run-vitest.mjs run --config test/vitest/vitest.ui.config.ts --configLoader runner \
ui/src/pages/chat/chat-agent-run-grouping.test.ts \
ui/src/pages/chat/chat-send-settings.test.ts \
ui/src/pages/chat/chat-send.test.ts \
ui/src/pages/chat/chat-pane-browser-annotation-lifecycle.test.ts \
ui/src/pages/chat/chat-state.test.ts \
ui/src/pages/chat/chat-view.test.ts \
ui/src/pages/chat/components/chat-message-markdown.test.ts \
ui/src/pages/chat/components/chat-message.test.ts \
ui/src/pages/chat/components/chat-message-attachments.test.ts \
ui/src/pages/chat/components/chat-message-media-lifecycle.test.ts \
ui/src/pages/chat/components/chat-selection-popup.test.ts \
ui/src/pages/chat/components/chat-tool-cards.test.ts \
ui/src/pages/chat/components/chat-tool-cards.outcome.test.ts \
ui/src/pages/chat/components/widget-card.test.ts \
ui/src/pages/chat/components/browser-tab-card.test.ts \
ui/src/pages/chat/components/chat-sidebar.test.ts
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-isolated.config.ts --configLoader runner \
ui/src/pages/chat/chat-pane-attachment-handoff.test.ts \
ui/src/pages/chat/components/chat-transcript-render.test.ts \
ui/src/pages/chat/components/chat-transcript-invalidation.test.ts
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner \
ui/src/e2e/chat-outbox-recovery.e2e.test.ts \
ui/src/e2e/chat-tool-turn-outcome.e2e.test.ts \
ui/src/e2e/chat-message-actions.e2e.test.ts \
ui/src/e2e/managed-image-actions.e2e.test.ts \
ui/src/e2e/managed-media-base-path.e2e.test.ts \
ui/src/e2e/chat-flow.media-files.e2e.test.ts \
ui/src/e2e/chat-agent-run-transcript.e2e.test.ts
node scripts/ui.js build
node scripts/check-changed.mjs
# Resume the sole failed lane after correcting bracket access for __openclaw.
node --import ./scripts/tsx.mjs scripts/run-oxlint-shards.mts --only=coreThe unit/isolated runs passed 1,200+33 cases; browser proof passed 49 scenarios. The build and bundle budgets passed. Before/after screenshots were captured in separate runs of the dark-desktop tool-layout case, inspected in full, and show matching synthetic presentation. Browser proof uses the built UI with a mocked Gateway; no production deployment changed. The initial changed gate required shrinking two assertion-baseline entries and making the newly internal queued-edit type private. Those consequences are included rather than allowlisted. Independent source cross-reviews retained the actual owner contracts, including current sidebar credentials and epoch, retained SVG URLs, nested popup teardown, repeated message IDs, and send-setting microtask ordering. Named follow-up: reproduce the pre-existing nested Rewind checkbox/outside-click interaction described in the PR body; no behavior change or confirmed defect claim in this cleanup. Best-fix verdict: the owner-boundary consolidation is preferable to adding general registries or keeping wrappers for one caller. A generic settings-tail helper was rejected because it would add an asynchronous boundary before send admission; removing the scoped queued-message retry was rejected because the store can decline a mutation. Those flows remain explicit. Shared message render facts do not replace the live full-message admission check. Dependency inspection: the lead directly checked Fresh final Codex autoreview after the metadata-access formatting correction: scoped-clean at the repository P0 threshold; no actionable P0 findings. Independent owner and sibling cross-reviews also found no behavior regression. All changed-file guard/format/dead-export/typecheck stages passed; the sole failing full-lint lane passed on rerun after the metadata property kept its existing bracket notation. No suppression was added. Rebased onto Integration after the patch-identical rebase also passed: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui.config.ts --configLoader runner \
ui/src/pages/chat/chat-agent-run-grouping.test.ts \
ui/src/pages/chat/chat-thread.test.ts \
ui/src/pages/chat/components/chat-message.test.ts
node scripts/ui.js build
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner \
ui/src/e2e/chat-agent-run-transcript.e2e.test.ts \
ui/src/e2e/chat-send-pending-handoff.e2e.test.tsResults: 464 unit cases, rebuilt UI and bundle budgets, and 8 browser cases passed. The browser scenarios include queued-image handoff when execution changes the run ID, and the session echo arriving before the send acknowledgement. Visual evidence gap: the before/after PNG captures were inspected locally and show matching presentation. The initial attachment upload was rate-limited; after reset, the approved CLI string-protection guard rejected the attachment command as unsafe input. No alternate upload route was used to bypass the guard. Browser assertions and local visual inspection passed, but the PR has no uploaded captures. Hosted CI for the reviewed head: https://github.com/openclaw/openclaw/actions/runs/33337037846 completed successfully on the reviewed head; all required CI is green before native prepare. Latest ClawSweeper review (2026-08-30 21:49 UTC, same head) found no actionable introduced defect and recommends retaining this single owner-boundary refactor for normal exact-head landing. Its remaining checklist item is ordinary maintainer merge validation; no separate Rank-up moves are listed. The generated stored-data-model notice does not apply: |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 5:49 PM ET / 21:49 UTC. ClawSweeper reviewWhat this changesThe branch consolidates Control UI chat rendering, attachment resolution, popup cleanup, lifecycle state, and transcript grouping while deleting redundant wrappers and unreachable preview paths. Merge readinessNo actionable introduced defect was found in this Control UI cleanup. This active maintainer-owned, Priority: P3 Review scores
Verification
How this fits togetherThe Control UI chat page converts Gateway transcript and session data into message, attachment, tool-detail, and composer views. Browser lifecycle helpers coordinate rendering updates, queued sends, and popup cleanup around that flow. flowchart LR
Gateway[Gateway session and transcript data] --> Chat[Control UI chat controller]
Chat --> Transcript[Transcript and message rendering]
Chat --> Composer[Composer and queued sends]
Transcript --> Attachments[Attachment and tool-detail views]
Chat --> Lifecycle[Render lifecycle and popup cleanup]
Lifecycle --> Browser[Browser updates]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -312, Tests +26, Other 0. Total -286 across 20 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the single owner-boundary refactor intact and land it after the normal exact-head merge controls complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a behavior-preserving refactor, not a report of a new externally reproducible defect. The relevant behavior is covered by focused source tests and the supplied validation evidence. Is this the best way to solve the issue? Yes. The patch consolidates repeated projections at existing owners while retaining the live expansion-map reread needed to prevent duplicate full-message loads; a new shared registry would widen the lifecycle surface without improving that invariant. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 786b19ebfbb5. 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.
|
* origin/main: (55 commits) test: include v2026.8.1 release navigation (#133581) fix: stop cloud work before unrelated provider inspection finishes (#133476) fix(e2e): keep delete fixture target-compatible (#133526) fix(release): detect optional target E2E capability (#133525) fix(package): publish readable dist inventory (#133549) docs: add complete v2026.8.1 maintainer change index (#133585) fix(browser): preserve contextless worker and iframe sessions (#133571) fix(voice): discover configured provider candidates (#133507) refactor(ui): simplify chat rendering and lifecycle state (#133567) test: reduce maturity fixture cleanup time (#133566) improve: speed up legacy imports and transcript replacement (#133546) docs: add draft v2026.8.1 release notes (#133557) test: guard multi-project Vitest cache ownership (#133554) fix(memory): clarify default agent scope in command help (#133560) fix(clawdock): keep credentials out of diagnostic output (#133547) refactor(ui): avoid redundant presence work in avatar lists (#133548) fix(agents): recognize internal requester completion replies (#133543) fix: prevent duplicate queued user messages in chat clients (#133542) chore(ui): refresh control ui locales (#133544) fix(beam): restart delivery when the receiver changes (#133533) ...
…cked-delivery * origin/main: test: include v2026.8.1 release navigation (openclaw#133581) fix: stop cloud work before unrelated provider inspection finishes (openclaw#133476) fix(e2e): keep delete fixture target-compatible (openclaw#133526) fix(release): detect optional target E2E capability (openclaw#133525) fix(package): publish readable dist inventory (openclaw#133549) docs: add complete v2026.8.1 maintainer change index (openclaw#133585) fix(browser): preserve contextless worker and iframe sessions (openclaw#133571) fix(voice): discover configured provider candidates (openclaw#133507) refactor(ui): simplify chat rendering and lifecycle state (openclaw#133567) test: reduce maturity fixture cleanup time (openclaw#133566) improve: speed up legacy imports and transcript replacement (openclaw#133546) docs: add draft v2026.8.1 release notes (openclaw#133557) test: guard multi-project Vitest cache ownership (openclaw#133554) fix(memory): clarify default agent scope in command help (openclaw#133560)
What Problem This Solves
Continues the maintainer-requested cleanup of Control UI chat after #133508. Composer inputs remained duplicated, transcript and Files views independently resolved the same attachment sources, and menu/listener state was spread across globals. Full-message rendering and tool previews also retained repeated or unreachable paths.
Why This Change Was Made
The chat view inherits its existing composer contract. One attachment-source projection serves transcript and Files consumers using each owner's current runtime. Popup listeners retire with their menu owner, while render-scope identity replaces a redundant epoch. Full-message render data is prepared once and Markdown dispatch shares one renderer; request admission still rereads state because different projected rows can share a source ID.
Remove the unreachable tool-row canvas preview and unused options, duplicate SVG fallback markup, single-store settings wrappers, a one-field outbox wrapper, and redundant attachment-release bookkeeping. Frame admission uses one append path with unchanged failure ordering. Persistence formats, configuration, protocol, dependencies, media authorization, retry budgets, and asynchronous send boundaries are unchanged.
Production: +256/-568 (312 lines removed). Tests: +49/-23 (26 lines added). Type-assertion baseline counts shrink to match removed assertions.
User Impact
No intended behavior or visual change. Composer actions, uncertain-send Retry/Discard, attachment previews, copy/reply actions, tool details, and session lifecycle use fewer independent implementations.
Evidence
Before/after captures show the same synthetic tool-detail surface from the built UI with a mocked Gateway. Both captures were inspected in full and show matching layout. Upload is blocked: after the GitHub upload rate limit reset, the approved CLI publication guard rejected the attachment command as unsafe input. Captures remain local; no alternate route was used to bypass that guard. No production deployment was changed.
Follow-up noted during source review
The nested Rewind confirmation's checkbox interaction deserves a focused reproduction: its body-portaled click may reach the parent menu's outside-click handler. Existing nested coverage checks Escape. This behavior predates the listener-owner refactor, which preserves the same containment and event rules; no defect or fix is claimed here.