Repository navigation
refactor(ui): give chat panes explicit element ownership - #176586
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b91effb5be
ℹ️ 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".
| const panes = new Set<ChatPaneElement>(); | ||
| const unboundPanes = new Set<HTMLElement>(); |
There was a problem hiding this comment.
Shrink the refactor to reduce production code
This behavior-preserving Solid refactor adds these global registries and associated ref plumbing, increasing the touched production code from 14,843 to 15,022 lines (+179, as recorded in the commit), although the mandatory UI refactor checklist requires a net production-LOC decrease. Consolidate or remove the parallel registration machinery so the refactor satisfies that maintainability gate.
AGENTS.md reference: ui/AGENTS.md:L3-L5
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR replaces chat-pane DOM queries and render-effect input forwarding with explicit registrations and renderer-owned element references. Example: A conversation prefilled with “What can you do?” replaces its chat pane.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 5 items remain Keep this PR open: the maintainer-approved refactor is coherent, but exact-head CI exposes four incomplete test-fixture migrations that need focused repairs. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe Control UI chat page retains pane renderers around synchronous session owners; route inputs and owner events enter this layer, which publishes transcript, composer, board, attachment, and focus behavior. flowchart TD
A[Route and native inputs] --> B[Synchronous pane owner]
B --> C[Solid pane renderer]
C --> D[Registered panes and element refs]
D --> E[Focus and lifecycle operations]
B --> F[Transcript and composer presentation]
Technical reviewBest possible solution: Complete the existing fixture cutover while retaining the renderer-owned refs, synchronous domain owners, and established focus and history assertions. Do we have a high-confidence way to reproduce the issue? This behavior-preserving refactor claims no end-user bug; exact-head CI traces and source inspection establish the listed fixture failures without executing target code locally. Is this the best way to solve the issue? Explicit renderer references fit the existing ownership model, but all affected fixtures must consume the new contract before the cutover is complete. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5a0fb5a7f579. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +180, Tests +48. Total +228 across 68 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 HistoryReview history (2 earlier review cycles)
Reviewed October 18, 2026, 7:40 PM ET / 23:40 UTC (Revision 3). |
|
Fixed in b5ee7ee98ba222a0daa9e803ceb5d328490e0fe0:
The PR body has the updated proof and performance measurements. Fresh @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
3849f92 to
98a8242
Compare
cfb5967 to
f817cec
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f817cec411
ℹ️ 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".
| // Other source frames may show a buffered stream before its normal RAF publishes it. | ||
| runtime.chatState.captureRenderChanges(); |
There was a problem hiding this comment.
Flush queued stream state before source-driven renders
When a stream update is waiting for its animation-frame publication and another projected source (such as gateway, theme, or transcript state) invalidates the pane, this path can render the buffered mutable stream without cancelling/publishing the pending run state; the RAF then publishes the same update and causes a second render and commit, potentially repeating scroll reconciliation during active streaming. The test host still calls publishPendingRunState() before captureRenderChanges(), so it masks the production-only sequence; preserve that ordering here through a write-safe hook or render only the published snapshot.
AGENTS.md reference: ui/AGENTS.md:L37-L38
Useful? React with 👍 / 👎.
3fd9f5e to
68731b5
Compare
68731b5 to
810a907
Compare
Replace pane, composer, history, board, attachment, and plugin focus discovery with renderer-owned references. Preserve retained-pane input publication and commit ordering while removing the feature render effect and copied presentation subscriptions.
810a907 to
d6a6803
Compare
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…6586) * refactor(ui): give chat pane rendering explicit element ownership Replace pane, composer, history, board, attachment, and plugin focus discovery with renderer-owned references. Preserve retained-pane input publication and commit ordering while removing the feature render effect and copied presentation subscriptions. * refactor(ui): reuse chat presentation and ref lifetimes * fix(ui): preserve chat frame and plugin mount contracts * test(ui): publish explicit pane fixture registrations
What Problem This Solves
Retained chat panes discover their controls through DOM queries and synchronize native inputs through a render effect. These implicit handoffs make focus, eviction, attachment delivery, and plugin replacement depend on the rendered DOM shape.
User Impact
Preserves retained-session rendering, composer focus, board and attachment actions, plugin replacement, routes, tags, and CSS while moving those handoffs to renderer-owned refs. There is no intended visual change.
Why This Change Was Made
Native pane inputs now update their existing synchronous owner, including while the rendered frame is parked. A buffered stream is published before the property change admits a frame; tracked frame preparation only captures render bookkeeping. Explicit registrations describe mounted panes, and typed refs connect their controls to the operations that use them. Each renderer releases its own registration; identity checks keep a retiring branch from clearing its replacement.
Owner projections replace presentation state copies, and composer replacement refs stay lifetime-stable. The integration uses main’s
projectProgressCard(progressScope)contract, removing the superseded local seed and explicit source replacement. Remaining committed-DOM effects preserve focus, layout, cancellation, and ordering. Optional renderers remain behind their existing lazy boundaries.Test fixtures publish the same explicit registrations as the renderer: history sentinels, replacement panes, and the native element behind the legacy pane test adapter. Existing focus, attachment-retirement, pagination, and visibility assertions remain.
Integration preserves main’s transcript viewport getter, binder, and cleanup alongside explicit pane refs and the intentional
initialPaneIdsnapshot. It also preserves both the footer-control registration and composer-shell ref. Main’s #176765 supplies pasted-text focus and retained-comment startup-scroll fixes; superseded local fixes and reader-wheel fixtures were dropped. Main’s #176468 supplies the compressed-transcript test-reader repair. The prior PowerPoint CI failure is historical, not waived.Evidence
d6a68032f2ee76417d61edfb6c107a634fcf78f7, based958966b09ea425f906da6bb385902fe1e5a3fbfd6a68032f2eepassed with no findings (2m 36.4s)42c86b2ca5abalso fail onlynew boot JS gzipat 1,050,564 B. Standalone proof used Node 24.22; paired CI used Node 24.21. This is actual-base proof, not a claim that the latest scheduled-main performance failedchat-long-content/desktop-lightcapture per side at 1440×960, inspected and byte-identicalPrior CI and performance
CI 39205632501 on
810a907048a3passed all three UI unit shards, all nine UI E2E shards, one real-Gateway shard, performance, lint, and security. Its sole test failure wasdelivers PowerPoint and keeps persisted attachment failures replay-safe: the test dereferenced a null raw JSON column for a compressed transcript row. The exact comparison job on scheduled main passed, so no inherited waiver was claimed. Main subsequently repaired that reader in #176468; the current base contains the repair.The earlier exact
68731b5999a3CI 39202812060 and3fd9f5edb6b8CI 39200044318 passed every selected job, including all three UI unit, all nine UI E2E, and both real-Gateway shards. Main changes required reviewed conflict repair after each. The accepted auto request for68731b5999a3was retired before replacing its head. The final head landed through native replacement recovery with the qualified inherited-performance exception as6a67da37b9ed; the native landing-parent audit passed.810a907048a3CI68731b5999a3CI8c968d596cf2base andcfb5967ce901head on Node 24.22.0 / Vite 8.3.4: startup 337,722 → 337,728 B gzip (+6), raw 1,022,741 B unchanged, 7 JS / 1 CSS. Both strict checks exceeded the same chat/New Session absolute ceilingsThese historical measurements are not current-head results. Failed runs remain failures; they are not relabeled as green.
Scope and Remaining Patterns
Top-level
ui/src/pages/chat/*.ts(x)plustalk/**, excluding tests. This is the pane/registration cutover; the reactive-owner PR #176375 is already in the base, and keyboard/menu PR #176390 owns removal of the remaining non-exempt queries.d958966b09eacreateEffectcreateRenderEffectuntrackAcross the original lane, effects fall 10→3 (70%), render effects 1→0, untrack 13→1, listeners 54→22, and queries 40→1 once the keyboard/menu cutover lands. All 22 listener survivors are lifecycle-owned: 17 non-DOM platform listeners and five Gateway API subscriptions. No element/window/document listeners remain in scope. The final allowed query is the markdown renderer’s foreign DOM in
link-favicon-loader.ts;initialPaneIdis the intentional reactive snapshot.Remaining scope occurrences
All paths below are relative to
ui/src/pages/chat/.chat-page-state.ts:695(route focus/presence),chat-pane-runtime-view.tsx:281(frame/layout/timer),solid-render-lifecycle.ts:124(imperative commit tasks/cancellation)chat-view.tsx:192(initialPaneId)link-favicon-loader.ts:58chat-pane-lifecycle.ts:222,chat-pane-session-menu.ts:97,555,chat-pane-shared.ts:179,205,228,232route-loader-short-resolve.ts:125,126,talk/shared.ts:266,546session-snapshot-database.ts:44talk/audio.ts:263talk/camera-owner.ts:57,talk/input.ts:319,talk/webrtc.ts:116talk/google-live.ts:160,170,177,184talk/webrtc.ts:122,142,150,163composer-dictation-session.ts:106,362,talk/gateway-relay.ts:94,talk/shared.ts:315,talk/voice-selection.ts:34The attributable diff touches 41 production files and 29 directly coupled test/support files: 70 files, +556/−311. Production LOC is 16,265 → 16,446 (+181); test/support LOC is 14,198 → 14,262 (+64). The added code makes mount/release ownership explicit and moves every affected renderer/ref consumer to the same contract.
Before:
After:
No remote testing leases were used.