Skip to content

refactor(ui): derive chat panel state and own DOM references - #176370

Merged
steipete merged 4 commits into
mainfrom
solid2/w-zero-chat-panels
Oct 18, 2026
Merged

steipete merged 4 commits into
mainfrom
solid2/w-zero-chat-panels

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What problem this solves

Chat panels and attachment cards retained imperative state copies, tracking suppression, and DOM lookups after the Solid migration. This first W-ZERO-CHAT-PANELS batch replaces those patterns while retaining existing tags, classes, lazy boundaries, request cancellation, and media custody.

Changes

Use writable derivations for process/subagent selections, live subagent digests, YouTube playback and thumbnails, and attachment source-view resets. Tie the question-card loader to its mounted lifetime and drive HTML preview loading from the existing text-read lifecycle. Replace owned DOM lookups with refs and native listener calls with JSX or the shared listener helper. The widget raw-details action receives its owning toggle ref rather than searching the enclosing message.

The hosted Browse action deliberately uses the existing native-listener ref factory: its button moves outside its original render root. Independent review caught the invalid delegated-handler replacement before publication.

No intended visual or product behavior change; existing markup/classes/styles remain. No new package, shared primitive, or startup registration.

Evidence

Check Result
UI typecheck Pass, including the final hosted-action correction
Focused proof 18 original tests pass across subagent live activity, message embed policy, and widget cards; after CI identified stale ref callbacks, all 16 file-editor browser tests and all 35 sidebar unit tests pass with the repair
Targeted lint / formatting / diff whitespace Pass; existing-style reactive-callback warnings recorded, no errors
Independent review P0–P2 clean after correcting hosted Browse event ownership; fresh repair review also clean
Same-machine candidate/base production builds + strict performance Both builds pass; strict check reports the existing chat budget overage on both sides. Node 26.12.0, Vite 8.3.4, Pako 3.0.2
Startup JS / CSS 336,625 B gzip / 38,500 B gzip, one startup CSS request
Chat boot vs merge base 1,494,638 → 1,494,608 B gzip (-30 B), 26 JS requests unchanged; both exceed the 1,490,000 B limit
New-session boot vs merge base 1,046,934 → 1,046,879 B gzip (-55 B), 20 JS requests unchanged
Production Knip Same two unused core files fail on exact merge base and head (reply-admission-ticket.ts, reply-turn-admission-owner.ts); no unused UI files. Archive baseline additionally flags its unmaterialized tools/solid-lint eslint dependency.
Broad proof Current-head run 39169083093: all UI unit and Control UI E2E shards, CI performance and security-fast pass; only three exact Gateway names match scheduled main 39168070659.

The added assertion extends the existing subagent observer test: returning to a previous run cannot revive a digest pruned when that run was replaced. Existing embed tests cover retained playback through ordinary refresh and revocation on policy, source, and session changes. Existing widget tests cover frame/height retention and prompt policy.

The first CI run found three file-editor searches and the sidebar HTML preview replacement case accessing a stale <Show> branch through ref-forwarding closures. Bind the callback directly so Solid resolves it under its rendering owner before unowned invocation. Both affected test files pass after that repair. The initial local unit setup stalled in a filesystem-cache rename() (sampled); the explicit unit project with --fsModuleCache=false completed normally. The old auto request was confirmed retired before replacing its head.

Refactor measurements

Counts cover all 21 changed production files, including the narrowly coupled message-bubble caller. This is a checkpoint, not completion of the entire chat-panels inventory or the 70% effect-reduction target.

Pattern Before After
createEffect 23 16
createRenderEffect 0 0
untrack 16 4
Direct addEventListener 7 0
querySelector(All) 6 2
Production LOC 4,817 4,835

The remaining two DOM queries inspect Canvas iframe islands. Two remaining untrack calls are intentional initial snapshots (initialDrafts, initialPromptCapable); two are untouched transcript internals in the coupled message-bubble module and remain with that lane. Growth is the explicit row/toggle refs and their lifetime cleanup replacing implicit DOM searches.

Remaining effects in this batch synchronize cancellable reads, retained Canvas properties/geometry, external presentation/menu state, hosted-tab notifications, the MCP unmount commit fence, or a parent-owned subagent show command. Observer/timer/focus consumers elsewhere in this lane will adopt shared primitives after those land; this PR does not copy them locally.

Current merge base: 5f63135f917ae28ddaf0e3a919c28fbe6746cb84. The performance table compares this base with repaired head 0df7dbe12a5b72858df9cb15761a9567d0e5e92c on the same machine. The real merge conflict in live subagent activity preserves main’s bounded narration subscriptions and projects the existing owner; the comprehensive observer test, UI typecheck and fresh independent P0–P2 review pass on 0258083103ad56beb4b6f061e44da400b8b31209.

Survivors in touched production files
Category Location
Cancelled/authority-scoped read chat-pasted-text.tsx:32, chat-pdf-preview.tsx:53, chat-text-attachment.tsx:146, chat-sent-comments.tsx:84
Presentation-scoped poster/blob lifetime chat-message-video-preview-solid.tsx:66
Gateway and pane presentation synchronization chat-summary-automations.tsx:135,185
Retained Canvas properties and clipping geometry canvas-widget-mount.tsx:39, widget-card-view.tsx:521
MCP unmount commit fence and external hosted-tab notifications chat-files-panel.tsx:74,137
External menu/presentation owner chat-github-publication-menu.tsx:20
Bounded live narration subscription chat-subagent-activity-live.tsx:81
Parent-owned consuming show command chat-subagents-panel.tsx:56
Untouched transcript effects in the coupled caller chat-message-bubble-view.tsx:100,113
Intentional initial snapshots file-draft-recovery-dialog-view.tsx:25, widget-card-view.tsx:289
Untouched transcript tracking suppression chat-message-bubble-view.tsx:98,387
Canvas iframe islands canvas-widget-mount.tsx:84, widget-card-view.tsx:492

A later real conflict in chat-processes-panel.tsx preserves main’s new snapshot/operation interface together with the derived selection reset. Both process-panel cases, UI typechecking, targeted lint and fresh P0–P2 review pass. This repair is head 0df7dbe12a5b72858df9cb15761a9567d0e5e92c; the completed current-head full CI is recorded below. The cancelled auto request remains retired.

Current-head CI attribution

Run 39169083093 completed on 0df7dbe12a5b72858df9cb15761a9567d0e5e92c. All three UI unit and nine Control UI E2E shards, CI performance, and security-fast pass. Only these three real-Gateway test names fail, and all also fail on latest completed scheduled main 39168070659:

  • Control UI media transcript replay with a real Gateway > delivers PowerPoint and keeps persisted attachment failures replay-safe
  • Managed image ordering through real chat.send and history > keeps headings, managed images and trailing prose ordered live and after reload without duplicates
  • Speech supplements through real chat.send and cursor history > attaches delayed speech to each original answer live and after reload

Native inherited-failure evidence binds the two failed root jobs, downstream gate and tested merge. The earlier local strict performance failure remains recorded separately; the later CI merge includes main’s smaller chat bundle and passes its performance check.

@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-18T21:47:33.924847Z 0df7dbe 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 18, 2026 20:02
@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 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces imperative chat presentation state and DOM searches with Solid derivations, owned refs, and shared listener helpers.

Example: A live subagent switches from child-run to replacement-run and later returns to child-run.

  • Before: An effect prunes cached observer digests for replaced runs.
  • After: A writable derivation performs the pruning, with an added assertion preventing the old headline from returning without a fresh event.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The refactor has useful focused coverage, but an introduced sidebar regression is corroborated by browser CI.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored ownership refactor is outside the ordinary contributor proof gate; supplied evidence consists of focused tests, builds, and CI rather than a recorded manual product run.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No new user-facing behavior is requested; the goal is simpler ownership while preserving existing chat interactions.
Reason: The maintainer-authored direction aligns with the ongoing Solid migration and removes redundant synchronization without adding a new owner or public option.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this maintainer-authored refactor open, but repair the file-sidebar ref regression before merging.

Priority: P2
Reviewed head: 7a8d4abaa244b577abebfea787d4462066310682

Before merge

  • Restore render-scope snapshots for sidebar ref callbacks (P2) - Opening file search now evaluates the narrowed controls() accessor inside a native ref callback, which Solid invokes without the rendering owner. The same change in FileAction defers its forwarded controls().searchToggleRef read. Exact-head browser checks report stale &lt;Show> accessor errors, missing search inputs in both mixed-line-ending search cases, and controls failing to transition into editing. This is the same regression repaired in refactor(ui): simplify chat side panels and cards #174739. Capture these callbacks in the owning render scope before passing them to native refs, preserving the editor callback snapshot as well.
  • Explain or restore the original intent of Sidebar ref callback snapshots - refactor(ui): own file preview state in Solid #174101: Mount-time callback capture preserves editor identity and resolves narrowed accessors inside their rendering scope; refactor(ui): simplify chat side panels and cards #174739 specifically retained this mechanism after matching browser failures.

Findings

  • [P2] Restore render-scope snapshots for sidebar ref callbacks — ui/src/pages/chat/components/chat-sidebar-file-view.tsx:281

Provenance

Agent review details

How this fits together

Control UI chat components consume Gateway and domain-owner snapshots, manage local presentation state, and render panels, attachments, media, and widget controls.

flowchart LR
  A[Gateway events] --> B[Domain owners]
  B --> C[Solid projections]
  C --> D[Chat presentation state]
  D --> E[Panels and attachment cards]
  E --> F[Owned DOM refs]
  F --> G[Browser interactions]
Loading

Technical review

Best possible solution:

Keep the derivation and ref-ownership cleanup while restoring the sidebar’s render-scope callback snapshots.

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

The sidebar regression is supported by the changed ref callbacks, exact-head browser failure annotations, the Solid runtime contract, and an earlier merged repair of the same pattern; no local target code was executed.

Is this the best way to solve the issue?

Writable derivations and explicit DOM refs fit the existing owners, but removing intentional mount-time snapshots breaks the sidebar lifetime contract.

Full review comments:

  • [P2] Restore render-scope snapshots for sidebar ref callbacks — ui/src/pages/chat/components/chat-sidebar-file-view.tsx:281
    Opening file search now evaluates the narrowed controls() accessor inside a native ref callback, which Solid invokes without the rendering owner. The same change in FileAction defers its forwarded controls().searchToggleRef read. Exact-head browser checks report stale &lt;Show> accessor errors, missing search inputs in both mixed-line-ending search cases, and controls failing to transition into editing. This is the same regression repaired in refactor(ui): simplify chat side panels and cards #174739. Capture these callbacks in the owning render scope before passing them to native refs, preserving the editor callback snapshot as well.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test ui/src/pages/chat/components/chat-sidebar-file-view.browser.test.ts --maxWorkers=1
  • pnpm test ui/src/pages/chat/components/chat-sidebar-region.test.ts --maxWorkers=1
  • pnpm tsgo:ui
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit fde0186 adds ui/src/pages/chat/components/chat-sidebar-file-view.tsx:98 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fde018655096; files: ui/src/pages/chat/components/chat-sidebar-file-view.tsx)
  • Shakker: Raw commit 8299e49 adds ui/src/pages/chat/components/chat-summary-automations.tsx:61 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 8299e4970ba9; files: ui/src/pages/chat/components/chat-summary-automations.tsx)

PR surface

Source +18, Tests +5. Total +23 across 22 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 21 266 248 +18
Tests 1 5 0 +5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 271 248 +23

Review metrics

Metric Value Why it matters
Production versus test LOC Production +18; tests +5 Production growth chiefly makes DOM references and cleanup explicit; the test extension protects digest pruning without adding scaffolding.

Labels

Label changes:

  • add P2: The refactor introduces a concrete file-search regression with limited Control UI scope.
  • 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 refactor introduces a concrete file-search regression with limited Control UI scope.
  • 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 18, 2026, 4:09 PM ET / 20:09 UTC.

@steipete
steipete disabled auto-merge October 18, 2026 20:16
@steipete
steipete merged commit c6746e5 into main Oct 18, 2026
109 of 113 checks passed
@steipete
steipete deleted the solid2/w-zero-chat-panels branch October 18, 2026 22:16
@steipete

Copy link
Copy Markdown
Contributor Author

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

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: L 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