Repository navigation
refactor(ui): separate chat grouping and recovery owners - #180724
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 maintainer review before merge. What this changesThis PR separates chat presentation from raw grouping, consolidates full-message recovery operations, and replaces internal facade imports with direct owner imports. Example: A dashboard answer follows two tool operations.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: the maintainer-directed ownership split is coherent, preserves the inspected behavior, and introduces no actionable correctness or security finding. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI transforms Gateway history and live stream items into grouped transcript rows, disclosures, reply attribution, and recoverable full-message views. flowchart TD
A[Gateway history and live items] --> B[Canonical chat item cache]
B --> C[Raw grouping and attribution]
C --> D[Turn presentation]
D --> E[Transcript index and rows]
E --> F[Solid chat views]
F --> G[Transcript recovery owner]
G --> A
Technical reviewBest possible solution: Retain this focused owner split, preserving the existing cache, transcript lifecycle, grouping decisions, and recovery guards. Do we have a high-confidence way to reproduce the issue? This PR addresses module ownership rather than a reported runtime bug; source inspection confirms the mixed responsibilities and facade imports on current main. Is this the best way to solve the issue? The split is appropriately scoped: it moves existing decisions to cohesive owners, migrates callers together, and removes the superseded paths without adding caches or reactive machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bf28212f2c4f. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +23, Tests -2. Total +21 across 25 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 22, 2026, 11:53 AM ET / 15:53 UTC. |
What Problem This Solves
Chat message grouping also owned stream/activity presentation, while identity-only readers imported the transcript cache module through re-exports. This made the chat dependency boundaries harder to maintain.
User Impact
No user-visible behavior change. Message ordering, completed-work disclosures, full-message recovery, and transcript row identity retain their existing contracts.
Why This Change Was Made
Keep raw grouping and full-transcript reply attribution in
chat-thread-grouping.ts; move stream, completed-turn, and activity presentation intochat-turn-presentation.ts. Put assistant status predicates with the existing assistant-reply rules, remove thechat-thread.tsre-export facade, and route every internal caller directly to its owner. The existing recovery module now owns both pruning and the full-message expansion command; the same session map and exact pending-object completion guard remain in place.This is an ownership split, not a new cache or reactive state layer. Static UI runtime reachability drops from 170 to 45 modules for message entries, 171 to 35 for reply attribution, and 209 to 84 for message Markdown. Those counts exclude external packages and dynamic imports and are not bundle-size claims. No cycle removal is claimed.
Evidence
Acceptance: preserve chat behavior, streaming work bounds, retention, existing lazy boundaries, and all strict asset caps. Base and head builds use Node 26.12.1 on the same Mac, with the final head rebuilt after an import-only lint correction.
pnpm tsgo:uipnpm ui:buildand strict performance check, base/headProduction LOC across touched modules: 4,935 → 4,958 (+23, chiefly the explicit owner imports and recovery API). Test LOC: 4,713 → 4,711. Raw grouping shrinks 821 → 361 LOC; the transcript projector shrinks 720 → 673. The Solid refactor-checklist counts for effects, cleanup, owner APIs, listeners, DOM queries, manual component loaders, and imperative render calls remain zero in the split modules.
The initial local typecheck found a missing moved import, and the message-index run found a prematurely removed helper; both were corrected and the checks passed. No local E2E battery was run. Full chat/UI/Gateway coverage is requested with
ci:full. No rendered markup, style, tag, or selector changed, so this refactor has no visual delta to capture.