Skip to content

refactor(ui): separate chat grouping and recovery owners - #180724

Merged
steipete merged 1 commit into
mainfrom
solid2/w-design-thread
Oct 22, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/w-design-thread

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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 into chat-turn-presentation.ts. Put assistant status predicates with the existing assistant-reply rules, remove the chat-thread.ts re-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.

Check Result
pnpm tsgo:ui Pass
Message-index unit suite 37 passed
Transcript projection-scale suite 12 passed
Thread retention suite 1 passed
Targeted oxlint and oxfmt Pass
Isolated Codex review No actionable P0–P2 findings
Production Knip Same inherited findings byte-for-byte on base and head: 2 files, 18 export groups, 14 exported-type groups; none in chat
pnpm ui:build and strict performance check, base/head Pass
Startup JS gzip 317,361 → 317,374 B (+13 B, within 64 B build variance); cap 325,081 B
Startup CSS 1 → 1 requests; 41,043 → 41,043 B gzip
Chat boot JS gzip 1,440,329 → 1,440,788 B; cap 1,500,000 B
New Session boot JS gzip 1,017,398 → 1,017,414 B; cap 1,035,000 B

Production 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.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 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 22, 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-22T15:31:32.995257Z 9f9d637 PR opened
ℹ️ 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 22, 2026 15:41
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: The operations appear in a completed-work disclosure above the answer.
  • After: The same disclosure and answer remain visible, with presentation derived by the dedicated presentation module.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-consistent, with reported targeted validation; behavioral evidence remains limited to automated tests.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence reports focused suites and production builds, but contains no current-head live UI output for the moved presentation and recovery paths.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction removes unnecessary dependency reachability and clarifies existing responsibilities while preserving presentation and recovery behavior.

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
Reviewed head: 9f9d6376fe9c591f0171e8b3f19e58d2de4b03b6

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No current-head live Control UI scenario demonstrates streaming, completed-work disclosure, and full-message recovery together.
Agent review details

How this fits together

The 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
Loading

Technical review

Best 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

  • Grouping and presentation separation keeps the original intent (f808147: The earlier split separated canonical building, identity, and grouping while preserving behavior and lazy-loading boundaries.)
  • Internal chat-thread facade changes intended behavior with a stated reason (refactor(ui): split chat thread projection #113714: The earlier refactor deliberately retained facade exports for existing internal callers; this PR explicitly replaces them with direct imports to reduce dependency reachability.)
  • Full-message recovery lifetime keeps the original intent (fix: reduce memory retained by transcript scans and chat views #135326: Transcript-owned bodies and exact pending-entry identity prevent retained data and obsolete completions from surviving presentation retirement.)
  • Recovery pruning memoization keeps the original intent (d53b32b: Memoized pruning avoids rescanning retained history during unchanged renders and streaming updates.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit f808147 adds ui/src/pages/chat/chat-thread-grouping.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f808147f62c4; files: ui/src/pages/chat/chat-thread-grouping.ts)
  • Vyctor H. Brzezowski: Raw commit 2a87667 adds ui/src/pages/chat/chat-agent-run-grouping.ts:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 2a87667bb256; files: ui/src/pages/chat/chat-agent-run-grouping.ts)

PR surface

Source +23, Tests -2. Total +21 across 25 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 17 576 553 +23
Tests 8 15 17 -2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 25 591 570 +21

Review metrics

Metric Value Why it matters
Production versus test LOC Production +576/-553, net +23; tests +15/-17, net -2. Most movement relocates existing code; the small net growth supplies explicit imports and the consolidated recovery interface without additional state.

Labels

Label changes:

  • add P3: This is internal ownership cleanup with no intended user-visible behavior change or demonstrated urgent defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is internal ownership cleanup with no intended user-visible behavior change or demonstrated urgent defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 22, 2026, 11:53 AM ET / 15:53 UTC.

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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant