Repository navigation
refactor(ui): derive chat panel state and own DOM references - #176370
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis 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.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Regression provenancePossible 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 Before merge
Findings
Provenance
Agent review detailsHow this fits togetherControl 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]
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3561a19c06ec. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +18, Tests +5. Total +23 across 22 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 18, 2026, 4:09 PM ET / 20:09 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…w#176370) * refactor(ui): derive chat panel state and own DOM references * fix(ui): retain sidebar ref callbacks within their render scope
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
reply-admission-ticket.ts,reply-turn-admission-owner.ts); no unused UI files. Archive baseline additionally flags its unmaterializedtools/solid-linteslint dependency.39169083093: all UI unit and Control UI E2E shards, CI performance and security-fast pass; only three exact Gateway names match scheduled main39168070659.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-cacherename()(sampled); the explicit unit project with--fsModuleCache=falsecompleted 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.
createEffectcreateRenderEffectuntrackaddEventListenerquerySelector(All)The remaining two DOM queries inspect Canvas iframe islands. Two remaining
untrackcalls 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 head0df7dbe12a5b72858df9cb15761a9567d0e5e92con 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 on0258083103ad56beb4b6f061e44da400b8b31209.Survivors in touched production files
chat-pasted-text.tsx:32,chat-pdf-preview.tsx:53,chat-text-attachment.tsx:146,chat-sent-comments.tsx:84chat-message-video-preview-solid.tsx:66chat-summary-automations.tsx:135,185canvas-widget-mount.tsx:39,widget-card-view.tsx:521chat-files-panel.tsx:74,137chat-github-publication-menu.tsx:20chat-subagent-activity-live.tsx:81chat-subagents-panel.tsx:56chat-message-bubble-view.tsx:100,113file-draft-recovery-dialog-view.tsx:25,widget-card-view.tsx:289chat-message-bubble-view.tsx:98,387canvas-widget-mount.tsx:84,widget-card-view.tsx:492A later real conflict in
chat-processes-panel.tsxpreserves 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 head0df7dbe12a5b72858df9cb15761a9567d0e5e92c; 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-safeManaged image ordering through real chat.send and history > keeps headings, managed images and trailing prose ordered live and after reload without duplicatesSpeech supplements through real chat.send and cursor history > attaches delayed speech to each original answer live and after reloadNative 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.