Repository navigation
refactor: simplify transcript reads and recovery state - #135392
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
8263f74 to
342bba6
Compare
|
Ready-to-land verification for The refactor removes 147 production lines and 111 lines overall. Canonical SQLite row parsing/generation and the existing UI map-version mechanism replace duplicate state; snapshot boundaries, pending-load fencing, reconnect invalidation, and the retry budget remain covered. Native review artifacts and the fresh Codex review are clean. The real Gateway/Chromium replay recovered all 64 large messages and retained zero large recovered bodies after teardown. All six real CLI calls passed, including the artifact download. The 11 production files match the live-tested candidate byte-for-byte after the branch refresh. Screenshots and video are in the PR body. The first merge build found the TS2790 fixture error from #135355. The repaired fixture now expresses its optional owned TTY property with a checked local type and keeps typed deletion and exact descriptor restoration. The same test-type stripe passes; 464 transcript/UI tests and 133 additional auth/CLI tests passed, with the final login fixture integration rerun. Local verification commandsnode --import ./scripts/tsx.mjs scripts/test-projects.mts --maxWorkers=2 \
src/config/sessions/session-accessor.sqlite-active-events.test.ts \
src/config/sessions/session-accessor.sqlite-history-events.test.ts \
src/config/sessions/session-accessor.sqlite-byte-size.test.ts \
src/gateway/session-transcript-readers.test.ts \
src/gateway/session-transcript-readers.markers.test.ts \
src/gateway/session-utils.fs.test.ts \
src/gateway/session-transcript-message.test.ts \
src/gateway/mcp-app-reconstruction.test.ts \
src/gateway/server-methods/artifacts.test.ts \
src/gateway/server-methods/artifacts-session-resolution.test.ts \
src/gateway/server-methods/artifacts.managed-lifecycle.test.ts \
ui/src/pages/chat/chat-thread.test.ts \
ui/src/pages/chat/components/chat-transcript-recovery.test.ts \
ui/src/pages/chat/components/chat-transcript-render.test.ts \
ui/src/pages/chat/components/chat-transcript-invalidation.test.ts
node scripts/check-changed.mjs --base da9137384c4
node scripts/run-tsgo-core-test-shards.mjs --stripe 4/5 --concurrency 2
node --import ./scripts/tsx.mjs scripts/test-projects.mts --maxWorkers=2 \
src/cli/models-cli.auth-login.integration.test.ts \
src/cli/models-cli.test.ts \
src/commands/models/auth.test.ts \
src/commands/models/auth-logout.test.ts
node --import ./scripts/tsx.mjs scripts/test-projects.mts --maxWorkers=2 \
src/cli/models-cli.auth-login.integration.test.tsHosted CI run 33539517666 completed successfully on this exact head: 248 checks passed, 37 skipped, none pending or failing. The latest ClawSweeper message reports that review has started; no findings or Rank-up moves have been published. The independent review and changed-surface proof are complete. The performance proof covers preserved streaming/bounded reads and zero retained large recovered bodies after teardown. |
b95d970 to
cd5a939
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 4:26 PM ET / 20:26 UTC. ClawSweeper reviewWhat this changesThis PR consolidates SQLite transcript-reader helpers, removes ignored transcript-scan options, and uses versioned map invalidation for Control UI full-message recovery. Merge readinessKeep this maintainer-authored, maintainer-labeled refactor open. The introduced change preserves the transcript projection and per-presentation recovery ownership boundaries, but its verified test merge is against the older base and current main has since changed the same central paths. Priority: P3 Review scores
Verification
How this fits togetherSQLite transcript projections feed Gateway readers used by artifact lookup and MCP app reconstruction. The Control UI then renders that transcript and holds recovered full-message text only for the active chat presentation. flowchart LR
A[Stored transcript events] --> B[Active SQLite projection]
B --> C[Gateway transcript readers]
C --> D[Artifacts and MCP reconstruction]
B --> E[Control UI transcript]
E --> F[Presentation recovery map]
F --> G[Rendered chat rows]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -147, Tests +37, Other -1. Total -111 across 17 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase the simplification onto current main, retain the canonical projection and presentation-owned recovery lifecycle, and validate the resolved integration on the resulting exact head. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a refactor and the review checked preservation of existing transcript and recovery behavior rather than a new defect report. Is this the best way to solve the issue? Yes on the reviewed base: it consolidates duplicated projection logic at the owning boundaries; current-main integration must be refreshed before that judgment can cover a merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 75bcd267f5e7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
cd5a939 to
e6c2c88
Compare
|
Addressed the current-main integration concern and rank-up move on The branch is rebased onto The stored-data warning is not a schema or migration change. The active projection now owns the same existing row parser and generation query; the event JSON, sequence/position arithmetic, database queries, serializers, index producers, and write paths are unchanged. The reset-window fields removed here belonged only to an unexported in-memory window; generation and indexed sequence remain on its authoritative cache entry with the same invalidation rules. No stored representation changes or data rewrites are introduced, so no migration is needed. Production remains −147 lines, tests +37, and the assertion baseline −1, for −111 lines overall. The prior head passed all CI, including both Windows jobs; the rebased head is receiving its own CI run before native prepare and merge. |
|
Merged via squash.
|
* refactor: simplify transcript reads and recovery state * test: type the temporary stdin property at its fixture owner
Related: #135326
What Problem This Solves
Maintainer-requested cleanup around the large-transcript memory work. Session reads and full-message recovery had overlapping representations and cache bookkeeping that made their ownership harder to maintain.
Why This Change Was Made
Use the active SQLite projection's canonical type, row parser, and generation reader across transcript readers. Usage and previews consume the raw payloads they actually need, removing redundant metadata projection and the private visitor's ignored options. Reset-window validity now lives only on its cache entry.
Control UI recovery reuses the existing map-version mechanism instead of sorting and joining a signature on each render. Disconnect clears the captured map before replacing it: the clear fences pending completions, while the new identity invalidates guarded rows on reconnect. Per-message revisions retain their existing retry budget.
The CLI login fixture also uses a checked view of the optional TTY property it temporarily owns, avoiding a type assertion while retaining exact descriptor restoration and typed deletion.
User Impact
No intended behavior change. Streaming scans remain inside the SQLite read snapshot, full-message recovery keeps its three automatic attempts plus manual retry, and recovered bodies remain owned by the presentation that uses them. Cursor/reset semantics, display metadata, config, and persistent storage are unchanged.
Evidence
main, the required rebase retained this branch's checked property view. All 51 focused artifact/auth integration tests passed again on the refreshed candidate.ee9e22b5215, including main's attachment-only reply fix. All core reader production files and PR test files remain byte-identical to the preceding candidate. 125 focused tests in seven files and four real-browser reply scenarios passed one6c2c88f97e; fresh Codex autoreview was scoped-clean at the configured P0 threshold. Earlier integration also rebuilt the Gateway and passed six real CLI calls using an artifact stored only inopenclawDisplayContent; list/get/download returned the original eight bytes.Before, with the memory fix already present:
After:
After leaving chat, with every chat pane disconnected:
Recorded candidate replay:
transcript-refactor-after-video.webm