Skip to content

refactor(chat): own transcript DOM and async lifetimes - #176468

Merged
steipete merged 16 commits into
mainfrom
solid2/w-zero-chat-transcript
Oct 19, 2026
Merged

steipete merged 16 commits into
mainfrom
solid2/w-zero-chat-transcript

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Transcript navigation and selection repeatedly searched their own DOM, while menus, comment previews, and video resources had separate imperative lifetimes. Mounted refs now serve navigation and actions; Solid owns the selection toolbar, annotation editor, menu, and confirmation. Async derivation cancels retired comment reads, parked videos release resources, and shared observer/listener primitives replace local wiring. Tags, classes, routes, selectors, domain owners, and lazy boundaries stay intact.

Equal parent redraws retain disclosure observers without layout reads. Changed HTML, expansion, presentation, size, and fonts still invalidate measurement. Copy failures remain visible and retryable. Seven geometry/focus queries remain for a separate focused follow-up; markdown owns the other query. No dependency, budget, ignore, or user migration is added.

The last full CI run exposed a directly coupled test reader that assumed plain JSON transcript storage. Valid compressed rows store event_json = NULL and payload bytes in event_zstd. This PR now decodes that existing representation while keeping every replay assertion unchanged; independent P0–P2 review found no actionable issue.

Evidence

Base aba4ede1e9fff6ea552d72aaba7cc0bc68e5b682; candidate 3c4519c52960aa552094ab94be52b140d042062d. The latest rebase preserves the reviewed rendering patches unchanged. Earlier conflict resolution retained main's viewport cleanup and stronger selection-readiness helper.

Scope metric Base Candidate
createEffect 6 1
createRenderEffect 0 0
untrack 11 4
Direct listeners 45 0
DOM queries, including generic calls 30 8

Supplemental counts: controller patterns 0; manual-class regex 1 (announcement text); flush 4 (three local buffer methods and virtual-rail keyboard DOM commitment); owner captures 3 (markdown/media and retained render roots).

Four intentional initial snapshots: keyed message identity (chat-message-bubble-view.tsx:100), preview dimensions (chat-message-images-solid.tsx:654), rail identity (chat-position-rail-view.tsx:196), and attachment identity (chat-selection-annotations.tsx:55). The sole effect synchronizes QR expiry with its media owner (chat-message-bubble-view.tsx:103). Markdown retains its foreign-DOM query (chat-message-overflow.ts:130); the other seven queries are in the prepared geometry follow-up.

Proof Result
Frozen install / default pnpm tsgo:ui (tsrs) Passed after rebase, no override
Default pnpm tsgo:extensions:test (tsrs) Passed for compressed-row reader repair
Transcript invalidation / thread retention 21 passed before push, --maxWorkers=1; inputs unchanged by rebase
Generated inventory Canonical generator captured both ready routes; generated delta independently reviewed
Current base / candidate UI builds Passed on this machine
Production Knip Passed on this exact head
Independent review Original change and substantive repairs clean through P2; latest rendering rebase patch-identical
Current-head full CI 39205361119 passed on this exact head: 52 successful jobs, including every UI E2E shard and both real-Gateway shards; ci:full retained

The local base replay attempt did not reach Vitest: private runtime preparation failed resolving built-plugin SDK modules. This is a setup gap, not evidence that the failing replay test is inherited. Current-head full CI passed the repaired reader and both real-Gateway shards.

Changed-file LOC: production 9,696 → 10,075 (+379); tests/helpers 10,465 → 10,638 (+173); inventories +2. Growth replaces imperative DOM construction with owned JSX, refs, and explicit cancellation/cleanup; no parallel renderer remains.

Boot metric Exact base Candidate
Startup JS gzip 337,005 B 337,375 B (+370 B)
Startup JS requests 7 7
Startup CSS gzip / requests 38,500 B / 1 38,500 B / 1
Chat JS gzip / requests 1,536,891 B / 25 1,486,032 B / 25
New-session JS gzip / requests 1,089,985 B / 20 1,050,455 B / 20

Both sides were built on this machine using Node 24.22.0. Strict performance fails both route caps on the base; the candidate passes chat and exceeds the unchanged new-session cap by 455 B. Startup and every request budget pass. The small startup increase accompanies inventory/chunk regrouping, while route totals drop by about 51 KB and 40 KB. The chat partition hint changes 1408→1440 KiB to retain the request layout. No budget, ignore, or dependency changed, and the new bindings remain in chat's lazy group.

Before/after captures use a synthetic local mock at 1440×1000. The menu follows its real context-menu path; confirmation uses the real component with a synthetic trigger. Full frames were inspected before upload. Rendering patches remain identical after the rebase.

Before: synthetic transcript context menu

After: synthetic transcript context menu

Before: synthetic confirmation

After: synthetic confirmation

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

clawsweeper Bot commented Oct 18, 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 18, 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-19T05:40:27.861337Z 3c4519c 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7005f33679

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +183 to +186
// Keep disclosure JSX in its chat partition instead of splitting
// compression dictionaries. Shipped byte/request budgets still apply.
minSize: 128 * 1024,
maxSize: (route === "shared" ? 1280 : 1408) * 1024,
maxSize: (route === "shared" ? 1280 : route === "chat" ? 1440 : 1408) * 1024,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Regenerate the boot manifest for the renamed chat modules

The chunk-size adjustment relies on controlUiBootModules, but this commit renames chat-selection-popup.ts to .tsx and adds three boot-path modules without regenerating ui/config/control-ui-boot-modules.json; the manifest still lists the deleted .ts path and none of the new modules. Consequently these modules do not match the measured chat group, so this limit change cannot reliably preserve the claimed chat partition/request layout. Run pnpm ui:boot-manifest:gen and commit its output before validating the build.

AGENTS.md reference: ui/AGENTS.md:L76-L77

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces transcript DOM scans and imperative controls with shared element refs, Solid rendering, and owned asynchronous cleanup.

Example: A video preview is parked when its chat pane becomes hidden.

  • Before: An effect manages presentation changes and poster resources together.
  • After: The poster owner releases its request and blob URL while the outer preview button retains its identity.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful ownership cleanup with inspected visual evidence, repaired prior findings, and no verified correctness defect; prior-head CI remains prior-head evidence.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor proof gate; inspected browser screenshots show the real context-menu path and exported confirmation component, while focused tests support comment cancellation and parked-video cleanup.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Transcript controls and resource cleanup depend on DOM rediscovery and separate imperative lifetimes, making retained chat behavior harder to maintain.
Reason: The maintainer-authored direction consolidates lifecycle ownership while preserving public behavior; the PR explicitly bounds the remaining geometry queries as follow-up work.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed refactor remains useful, the four prior findings are repaired, and no actionable code defect was verified.

Priority: P3
Reviewed head: eccb97babcb6e46fea4235fe5b8893ef7f45b600

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI transcript turns session projections into retained message rows, navigation markers, media previews, and message controls.

flowchart TD
  A[Session projections] --> B[Retained transcript owner]
  B --> C[Message rows]
  C --> D[Shared element refs]
  D --> E[Position rail and interactions]
  C --> F[Owned media and comment reads]
  E --> G[Solid menus and dialogs]
Loading

Technical review

Best possible solution:

Retain the refactor's existing transcript and resource owners, then land once the required checks and mergeability are settled.

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

This refactor claims preserved behavior; source inspection disproved the proposed workspace-conflict regression, and no target code was executed during this read-only review.

Is this the best way to solve the issue?

The change reuses the transcript session, media owners, shared observer, and Solid disposal boundaries without introducing competing domain state or public configuration.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Transcript rows, element identity, and position rail keeps the original intent (4e3818b: The Solid transcript migration preserved keyed rows, virtualizer ownership, cached sessions, and existing selectors; subsequent rail work retained synchronous keyboard focus.)
  • Selection and annotation controls keeps the original intent (740b1f1: Selected passages become editable comments while preserving draft text, source highlights, compact controls, and keyboard behavior.)
  • Parked image and video resources keeps the original intent (4cbe7e6: Parked previews must release resources and reconnect through their existing scoped owners without losing retained presentation.)
  • Sent-comment asynchronous reads keeps the original intent (cb801e8: Mounted consumers own annotation rendering and abort reads on source replacement or disposal.)
  • Disclosure measurement and native listener lifetimes keeps the original intent (8d9c36d: Pair native listeners and disclosure observers with their presentation owners while preserving focus and retained-row behavior.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +406, Tests +108, Other -1. Total +513 across 47 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 35 1107 701 +406
Tests 11 189 81 +108
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 47 1296 783 +513

Review metrics

Metric Value Why it matters
Production versus test LOC Production +1,078/-691, net +387; tests/helpers +189/-81, net +108. Growth supplies JSX controls, shared element registrations, and explicit cleanup while removing imperative construction and scans; the separate menu module owns rendering and disposal rather than merely forwarding calls.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is a behavior-preserving ownership refactor without a verified urgent user-facing failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-18T21:12:57.739Z sha 7005f33 :: needs changes before merge. :: [P2] Regenerate the boot manifest after changing its module graph | [P2] Migrate the overflow fixture to observer-driven measurement | [P2] Update image teardown assertions for the shared listener contract | [P2] Register the table-retirement fixture with the transcript owner

Reviewed October 18, 2026, 6:57 PM ET / 22:57 UTC (Revision 2).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 860d3f19f4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

element?: HTMLButtonElement;
};

export function mountThreadMenu(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Inline the single-consumer menu helper

Repository-wide search finds mountThreadMenu used only by chat-thread-interactions.ts, so this separate 65-line module is a single-consumer wrapper introduced by a refactor that already grows touched production code by 387 net lines. The required Solid refactor guidance says new helpers need two callers and net production LOC must decrease; inline this JSX/lifecycle into its sole owner or consolidate it with an existing shared overlay implementation.

AGENTS.md reference: ui/AGENTS.md:L3-L5

Useful? React with 👍 / 👎.

@steipete

steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

The boot inventory is regenerated in eccb97babcb6, including the popup rename and the action, menu, and transcript-ref modules. The grouped build, UI typecheck, transcript work counts, and both retention suites pass; strict startup remains 336,791 B gzip with one CSS request. The local chat cap failure also occurs on the exact retained base, with this candidate 4,147 B smaller. Fresh full CI is requested for the generated correction; attachment to the new head is being verified.

The observer, image-listener, and connected-table fixture findings are fixed without dropping behavior assertions. The preceding fixture-repair head passed all three UI unit shards, all nine Control UI E2E shards, both real-Gateway shards, lint, types, and strict performance.

The inline-menu suggestion is declined: the TSX module renders the menu and owns its Solid teardown, keeping the interaction owner in plain TypeScript. Inlining would change that owner's compilation contract without changing behavior. The production LOC tradeoff is recorded in the PR body.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eccb97babc

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<>
<div
class={state().bubbleClasses}
ref={(element) => entryRef?.(element)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Register workspace-conflict bubbles with the transcript owner

When a workspace-conflict message is rendered, this registration ref exists only inside the normal-message fallback; WorkspaceConflictTranscriptMessage still emits a .chat-bubble with message IDs but never registers it. createPositionRail now obtains all observation targets exclusively from session.messageElements, while projectChatPositions still creates a marker for the visible conflict message, so its marker never receives IntersectionObserver visibility tracking or the data-visible state. Pass the registration ref through the conflict branch as part of the DOM-ref cutover.

AGENTS.md reference: AGENTS.md:L50-L51

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added 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. and removed 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 18, 2026
@steipete
steipete force-pushed the solid2/w-zero-chat-transcript branch 3 times, most recently from d8ccdf4 to 2e9f95a Compare October 19, 2026 01:57
@blacksmith-sh

This comment has been minimized.

@steipete
steipete force-pushed the solid2/w-zero-chat-transcript branch 2 times, most recently from a6e092c to f4615cc Compare October 19, 2026 03:35
@steipete
steipete enabled auto-merge (squash) October 19, 2026 03:43
@steipete
steipete force-pushed the solid2/w-zero-chat-transcript branch from b5e4353 to 3c4519c Compare October 19, 2026 05:35
@steipete
steipete merged commit e59d0c2 into main Oct 19, 2026
151 checks passed
@steipete
steipete deleted the solid2/w-zero-chat-transcript branch October 19, 2026 06:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
* refactor(chat): own transcript DOM refs and popup lifecycles

* refactor(chat): derive comment reads and bind message lifetimes

* refactor(chat): use owned listener cleanup for selection cancellation

* refactor(chat): share disclosure observation lifecycle

* fix(ui): align transcript observation proof and simplify refs

* test(ui): align transcript fixtures with owned lifetimes

* build(ui): refresh transcript boot inventory

* test(chat): retire comment editor before clearing fixture DOM

* refactor(chat): streamline retained transcript bindings

* refactor(ui): trim static transcript menu bindings

* fix(ui): preserve transcript copy failure feedback

* fix(chat): retain equivalent disclosure measurements

* test(chat): dispatch bubbling composition key release

* build(ui): regenerate transcript boot inventory after main refresh

* build(ui): refresh transcript inventory after conflict repair

* test(qa-lab): decode compressed transcript rows in media replay
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. extensions: qa-lab P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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