Skip to content

refactor(ui): simplify chat rendering and lifecycle state - #133567

Merged
steipete merged 1 commit into
mainfrom
codex/chat-deslop-lifecycle
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/chat-deslop-lifecycle

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Seven independent discovery lanes and cross-reviews covered current owners, callers, sibling paths, history and dependency contracts.
  • 1,233 focused tests passed: 1,200 normal UI cases plus 33 isolated transcript and attachment-handoff cases. Added coverage ensures repeated source projections admit one full-message load and retain both previews.
  • Production UI build and bundle-size budgets passed. After a patch-identical rebase onto current main, the rebuild, 464 focused integration tests, and 8 queue/transcript browser scenarios also passed.
  • 49 browser scenarios passed across media files, queue recovery, tool outcomes, message actions, managed images/base paths, and agent-run transcript grouping.
  • Fresh Codex autoreview at the repository P0 threshold found no actionable defects.
  • Changed-file guards, formatting, dead-export scans, core/UI typechecks, and full core/UI lint passed. The gate exposed two stale assertion-baseline counts, one now-internal type export, and metadata-access style; each was corrected.

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.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 30, 2026 21:39
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete

steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor Author

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=core

The 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 openai/codex source codex-rs/protocol/src/protocol.rs:3572 (patch begin/end correlation and outcome) and :4084 (FileChange Add/Delete/Update and move_path). Tool preview cleanup changes no Codex event or patch contract. Browser event listener signal ownership follows existing app-shell usage and the installed EventTarget implementation; media ticket/revocation contracts retain their existing lifecycle owners.

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 00b64b81c4073e594c423bcb5e7a5ca1c5a6f6d7; git range-diff confirms the complete cleanup patch is identical. Reviewed head: bb80e40d768f029afccdf370934a1ee0eb1040d3. New main includes #133542, separating queued submission identity from execution identity; this cleanup preserves those contracts.

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.ts

Results: 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: chat-agent-run-grouping.ts only builds in-memory render frames from supplied transcript items. The refactor consolidates append/flush control flow with the same result shape, boundary key construction and failed-frame ordering. It adds no persistence calls, schema, migrations or stored-state format. No upgrade migration is needed.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 5:49 PM ET / 21:49 UTC.

ClawSweeper review

What this changes

The branch consolidates Control UI chat rendering, attachment resolution, popup cleanup, lifecycle state, and transcript grouping while deleting redundant wrappers and unreachable preview paths.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No actionable introduced defect was found in this Control UI cleanup. This active maintainer-owned, maintainer-labeled PR should remain open for the normal merge path.

Priority: P3
Reviewed head: bb80e40d768f029afccdf370934a1ee0eb1040d3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A normal good cleanup patch: source review found no regression and it adds focused coverage for the one shared-admission invariant.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, behavior-neutral Control UI refactor is exempt from the external-contributor proof gate; the supplied focused browser and source-test evidence is supplemental.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, behavior-neutral Control UI refactor is exempt from the external-contributor proof gate; the supplied focused browser and source-test evidence is supplemental.
Evidence reviewed 5 items Full-message loading: The changed action-details projection carries the render-time expansion state, while grouped-message admission rereads the live expansion owner before it requests a load; this preserves deduplication for repeated transcript projections.
Regression coverage: The added focused test models two projected rows with one source ID and verifies exactly one full-message admission while preserving both visible previews.
Attachment and lifecycle cleanup: Attachment payload release remains idempotent per attachment ID, lifecycle scopes still cancel on both disconnect and reconnect, and the SVG retirement flag was always true at its sole construction site.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Complete next step (P2) - No concrete introduced defect needs an automated repair; remaining work is ordinary maintainer merge validation.
Agent review details

Security

None.

PR surface

Source -312, Tests +26, Other 0. Total -286 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 16 256 568 -312
Tests 3 49 23 +26
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 20 307 593 -286

Review metrics

Metric Value Why it matters
Production versus test delta production +256/-568 (net -312); tests +49/-23 (net +26); baseline +2/-2 The refactor is net-negative in production code while adding focused coverage for shared full-message admission.

Stored data model

Persistent data-model change detected: unknown-data-model-change: ui/src/pages/chat/chat-agent-run-grouping.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is behavior-preserving Control UI cleanup with no reported user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, behavior-neutral Control UI refactor is exempt from the external-contributor proof gate; the supplied focused browser and source-test evidence is supplemental.

Label justifications:

  • P3: This is behavior-preserving Control UI cleanup with no reported user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, behavior-neutral Control UI refactor is exempt from the external-contributor proof gate; the supplied focused browser and source-test evidence is supplemental.

Evidence

What I checked:

Likely related people:

  • steipete: 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 merged commit 2181ae7 into main Aug 30, 2026
215 checks passed
@steipete
steipete deleted the codex/chat-deslop-lifecycle branch August 30, 2026 21:56
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 30, 2026
* 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)
  ...
vincentkoc added a commit to shojikumaru/openclaw that referenced this pull request Aug 30, 2026
…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)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
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 maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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