Repository navigation
refactor(ui): detach chat state ownership from pane controllers - #174021
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 the chat state controller with a plain factory whose disposal and render hooks are called by the pane. Example: Leave Home while report.txt is being prepared, then open the Home dock.
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 open: this maintainer-directed refactor is useful, but removing runtime notifications breaks existing browser-test discovery. Priority: P2 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherThe Control UI chat owner receives session state and composer events, manages persistence and resource cleanup, and requests rendering through the pane. flowchart LR
A[Composer and Gateway events] --> B[Chat state factory]
B --> C[Draft persistence and attachment reads]
B --> D[Pane renderer contract]
D --> E[Solid pane rendering]
E --> F[Commit and disposal hooks]
F --> B
Technical reviewBest possible solution: Keep the plain state factory and preserve runtime discovery at the pane/render boundary without restoring controller registration. Do we have a high-confidence way to reproduce the issue? Source tracing establishes the missing runtime registration, and exact-head CI annotations show matching undefined-state errors and probe timeouts; no local reproduction was run. Is this the best way to solve the issue? The factory and explicit disposal fit the synchronous ownership contract, but the renderer cutover must preserve the existing browser adapter’s runtime identity. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bf94f39db2aa. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource -11, Tests -25. Total -36 across 10 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 16, 2026, 4:46 AM ET / 08:46 UTC. |
|
Merged via squash.
|
…claw#174021) * refactor(ui): detach chat state ownership from pane controllers * fix(ui): retain chat runtime lifecycle diagnostics * test(ui): open assignment submenu through its keyboard path
What Problem This Solves
The chat state owner is still registered as a pane controller even though it owns synchronous session resources rather than UI presentation.
User Impact
Draft persistence, scrolling, queued-edit recovery, attachment handoff, and late callback cancellation keep their existing behavior. There is no markup, style, route, selector, or lazy-loading change.
Why This Change Was Made
A plain
createChatStatefactory replaces the controller class and registration. Its narrow renderer contract retainsrequestUpdateandupdateComplete, including the existing runtime identity used by opt-in diagnostics. The pane explicitly disposes the owner after composer and attachment handoff; reconnect creates a fresh owner. Persistence flushes before session state is released, and transferred attachment reads retain their new custodian. The enclosing Solid pane owns lifecycle, so this synchronous resource owner needs no additional reactive root or mirrored lifecycle flag.The shared pane host remains for transcript, progress-card, locale, polling, and subscription controllers owned outside this lane. Removing it also intersects the active presentation port.
Evidence
The first full CI run caught an omitted diagnostic contract: E2E’s pane adapter discovers the runtime through its existing notifications. Removing those notifications left private probes such as
pane.stateundefined, causing hydration and scroll-probe failures. The repair restores notifications at their original admission/commit boundaries through the real renderer; it adds no public state getter, controller registration, or new diagnostic hook. The mounted regression exercises actual production notifications instead of manually supplying one. Existing Solid diagnostics in unchanged background/details views remain unsuppressed.That run also saw unrelated Codex test-type errors introduced by main cleanup #173951, where three calls retained names whose imports had been aliased. The PR’s original base and head have identical valid source; CI’s advanced main contains the broken source. Main fix 89dbe8fb corrects those exact three calls. The final CI merge includes that fix and passes the type checks.
Final-head performance (
621f932) passed: startup JavaScript 339,180 B gzip / 7 requests, startup CSS 38,786 B / 1 request. Chat boot JavaScript 1,654,477 → 1,654,246 B gzip (−231) with 31 requests unchanged; Chat boot CSS 130,736 B gzip / 8 requests, unchanged.The replacement CI run passed every nonaggregate job except
session-owner-assignment.e2e.test.ts > keeps rejected owner assignments visible from the sidebar, retrying a failed header directory. It timed out waiting for “Me” after right-click/hover, before the assignment RPC. The exact case passed on scheduled main and in one local replay, so no inherited-failure claim is made. The outcome scenario now opens the submenu through its existing public keyboard helper and waits for expansion. Dedicated sidebar pointer tests retain hover coverage; all owner selection, RPC, rejection-alert, and avatar assertions remain. The changed case passed once locally; lint, formatting, and fresh isolated review through P2 passed. The timeout was not deterministically reproduced locally. The final full CI run passes the repaired shard and both real-Gateway shards.Render preparation now runs when Solid renders. A parked pane may allow one already-scheduled producer frame instead of consuming it during a non-rendering host publication. Persistence and scroll ownership are captured at invalidation; hiding the document still cancels stream frames immediately. This bounded scheduling difference adds no observed state-loss path.
Production LOC across the two changed production files: 1,354 → 1,351 (−3). Test/support LOC across ten files: 7,405 → 7,398 (−7). Controller-pattern references 13 → 10;
createEffect0 → 0;untrack0 → 0; native listener registrations 2 → 2. The class and its controller lifecycle are gone; remaining update calls serve the retained pane renderer. Three scroll flags are one pending intent, preserving force/content-change coalescing.No dependency change, new dead-code ignore, local E2E battery, or repeated green suite was added. PR CI owns broad and performance proof.