Skip to content

refactor(ui): simplify chat rendering ownership and derivations - #177461

Merged
steipete merged 2 commits into
mainfrom
solid2/w-idiom7-chat
Oct 19, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-idiom7-chat

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Removes redundant reactive computations from chat rendering and creates pane startup projections in their owning component instead of restoring a captured owner.

User Impact

No intended visual or behavioral change. Chat retains its native input drafts, menu focus, parked panes, transcript geometry, and lazy loading boundaries.

Why This Change Was Made

Cheap display values and pass-through accessors do not need a second cached computation. This removes 47 memos while retaining the caches that own rendered content, resources, expensive/shared preparation, or equality boundaries for native drafts and disclosure state. Pane startup still waits for the existing readiness gate, then runs in MountedPane so its projections inherit that component's lifetime directly.

The baseline contains only two Solid flush() calls in chat: header-menu admission and virtualized position-rail keyboard focus. Both remain as named synchronous DOM integrations. Other flush functions drain ordinary TypeScript queues or group messages. Five remaining Solid owner calls serve the markdown-media, Canvas range, and detached retained-transcript DOM adapters; comments document their ownership contracts.

Evidence

Check Result
pnpm tsgo:ui (tsrs) Passed
chat-pane-bridge.test.tsx --maxWorkers=1 6 passed
chat-composer-solid.test.tsx --maxWorkers=1 15 passed, including native input/IME and open permission picker retention
chat-transcript-follow-continuity.test.tsx --maxWorkers=1 13 passed
Targeted oxlint Passed with existing reactivity warnings
pnpm check:control-ui-controllers Passed; all four wave-zero ratchets unchanged
Formatting / git diff --check Passed
Production Knip Passed
Independent Codex review (through P2) Passed with full-file and owner context; no actionable findings
Existing permission-content and timestamp-attribute regressions Both reproduced on the initial head, then passed after retaining six equality memos
Broad chat performance, retention, and browser coverage Replacement-head PR CI with ci:full

Touched production files: 17. LOC: 6,651 → 6,619 (−32). Memos: 109 → 62 (−47). Solid owner calls: 7 → 5 (the remaining calls are DOM-island integrations). Effects: 2 → 2; untrack: 1 → 1; direct listeners and DOM queries: 0 → 0.

No startup imports, dependencies, styles, tags, selectors, or routes change. Under the campaign's bounded-proof rule, no local build, startup-byte measurement, or screenshots were run for this behavior-preserving refactor. Local tests used the default pinned Bun runtime. Broader performance and retention evidence will come from the labeled PR run.

The initial full run 39283443243 exposed two real regressions: preserves option content on unrelated refreshes while admitting permission changes and leaves timestamp attributes untouched when only message usage changes. The correction retains their six equality boundaries and documents why these apparent pass-through memos are necessary. Both existing tests were reproduced red and then green locally.

The initial baseline-ratchet job also failed mock-exports at src/infra/openclaw-process-census.missing-command.test.ts:12. The same guard failed against a temporary index containing only main 7cb1ea1f8e8352c900314079d6126b3fd2aef46e; that file is outside both chat diffs. No test assertion is being attributed to main.

Replacement run 39288688032 completed: all 3 UI unit shards, all 9 browser shards, both real-Gateway shards, and the Control UI performance check passed. The only failed root was checks-fast-baseline-ratchets, with the exact same mock-exports source/line/specifier as completed scheduled-main run 39286736487. The failed source and guard inputs are unchanged in the actual tested merge. Landing uses the documented inherited-failure exception; the overall CI run is not green.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 19, 2026
@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T16:53:50.833305Z b1ebd72 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete enabled auto-merge (squash) October 19, 2026 16:21
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR removes cached chat display derivations and moves pane startup into its mounted Solid component.

Example: An assistant message keeps timestamp 1000 while its input-token usage changes from 100 to 200.

  • Before: Token metadata updates without rewriting the timestamp attributes.
  • After: The removed scalar equality boundaries allow unchanged timestamp attributes to be rewritten.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful ownership simplification with focused harness reports, but two source-supported performance regressions require correction.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored internal refactor is outside the ordinary contributor proof gate; the body reports focused pane, composer, and transcript harness results, with broader CI still pending.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Chat rendering retains unnecessary reactive machinery, making ownership and maintenance harder.
Reason: The maintainer-authored direction is established, and the change reduces machinery without adding configuration or state owners; the identified regressions are locally repairable.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep this PR open: the maintainer-approved simplification is useful, but two changes restore avoidable DOM writes that an earlier measured performance fix removed.

Priority: P2
Reviewed head: 3df7ce995c1704afa21270d5f8e08a75425a08c2

Before merge

  • Preserve the timestamp attribute equality boundaries (P2) - When a message snapshot changes only token usage, prepareTimestamp can publish another object containing the same timestamp strings. Reading those fields directly reconnects native datetime and aria-label bindings to that object refresh, restoring equal attribute writes. These memos were added specifically to prevent this in perf(control-ui): retain loading panels and skip unchanged metadata writes #174392, and chat-message-group.solid.test.tsx already covers usage 100→200 with timestamp 1000 and expects no attribute mutations. Retain the scalar timestamp and context-label memos.
  • Retain equality gates for unchanged Details values (P2) - A Details snapshot refresh with unchanged workspace, execution host, and model now reruns their native title bindings because these accessors subscribe directly to the broader snapshot. This restores the redundant title writes eliminated by the exact scalar memos in perf(control-ui): retain loading panels and skip unchanged metadata writes #174392; its dashboard reload evidence measured 101 such writes falling to zero. Keep workspaceLabel, host, and model memoized so unrelated session updates do not republish equal DOM values.
  • Explain or restore the original intent of Timestamp and Details scalar bindings - cb9316d: Suppress unchanged native attributes during metadata refreshes and dashboard reloads, supported by measured DOM-write counts in perf(control-ui): retain loading panels and skip unchanged metadata writes #174392.

Findings

  • [P2] Preserve the timestamp attribute equality boundaries — ui/src/pages/chat/components/chat-message-timestamp-view.tsx:60-63
  • [P2] Retain equality gates for unchanged Details values — ui/src/pages/chat/components/chat-details-environment.tsx:26-28

Provenance

Agent review details

How this fits together

Control UI chat components consume synchronous pane and session owners through Solid projections and render the composer, transcript, menus, and Details panel.

flowchart LR
  A[Gateway and session owners] --> B[Pane runtime]
  B --> C[Solid projections]
  C --> D[Chat components]
  D --> E[Native DOM bindings]
  D --> F[Retained transcript islands]
Loading

Technical review

Best possible solution:

Keep the pane-lifetime and pass-through simplifications while restoring the timestamp and Details scalar equality boundaries.

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

The timestamp regression has an existing usage-only MutationObserver scenario, and the Details change restores the exact bindings previously measured to cause redundant writes; no tests or target code were executed during this read-only review.

Is this the best way to solve the issue?

Most replacements follow the repository's accessor guidance, but cheap computation and equality-gated publication serve different purposes, so the measured DOM boundaries should remain.

Full review comments:

  • [P2] Preserve the timestamp attribute equality boundaries — ui/src/pages/chat/components/chat-message-timestamp-view.tsx:60-63
    When a message snapshot changes only token usage, prepareTimestamp can publish another object containing the same timestamp strings. Reading those fields directly reconnects native datetime and aria-label bindings to that object refresh, restoring equal attribute writes. These memos were added specifically to prevent this in perf(control-ui): retain loading panels and skip unchanged metadata writes #174392, and chat-message-group.solid.test.tsx already covers usage 100→200 with timestamp 1000 and expects no attribute mutations. Retain the scalar timestamp and context-label memos.
    Confidence: 0.97
  • [P2] Retain equality gates for unchanged Details values — ui/src/pages/chat/components/chat-details-environment.tsx:26-28
    A Details snapshot refresh with unchanged workspace, execution host, and model now reruns their native title bindings because these accessors subscribe directly to the broader snapshot. This restores the redundant title writes eliminated by the exact scalar memos in perf(control-ui): retain loading panels and skip unchanged metadata writes #174392; its dashboard reload evidence measured 101 such writes falling to zero. Keep workspaceLabel, host, and model memoized so unrelated session updates do not republish equal DOM values.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Pane startup ownership keeps the original intent (8454ea1: Startup creates projections requiring the retained view's owner; the PR preserves that lifetime by running startup inside MountedPane after readiness.)
  • Composer, queue, and permission presentation keeps the original intent (07384e0: The Solid migration preserved synchronous draft and queue authority, stable native inputs, and retained controls; the remaining input-value and rendered-content boundaries preserve those contracts.)
  • Lazy sidebar and widget menu entries keeps the original intent (9d74023: Construct entries only while open and retain keyed entry ownership; removing the extra pass-through memo leaves the lazy entry owner and Menu boundary intact.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm --dir ui test src/pages/chat/components/chat-message-group.solid.test.tsx src/pages/chat/components/chat-details-session.test.ts --maxWorkers=1
  • pnpm --dir ui test src/pages/chat/chat-pane-bridge.test.tsx src/pages/chat/chat-composer-solid.test.tsx --maxWorkers=1
  • pnpm tsgo:ui
  • git diff --check

What I checked:

PR surface

Source -38. Total -38 across 17 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 17 102 140 -38
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 102 140 -38

Labels

Label changes:

  • add P2: The patch reintroduces documented rendering work during ordinary metadata updates and dashboard reloads, with a focused repair available.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The patch reintroduces documented rendering work during ordinary metadata updates and dashboard reloads, with a focused repair available.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 execution lanes are retired.

Reviewed October 19, 2026, 12:26 PM ET / 16:26 UTC.

@steipete
steipete merged commit 7b7bc3d into main Oct 19, 2026
99 of 105 checks passed
@steipete
steipete deleted the solid2/w-idiom7-chat branch October 19, 2026 17:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
…claw#177461)

* refactor(ui): simplify chat rendering ownership and derivations

* fix(ui): retain chat presentation equality boundaries
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 ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant