Repository navigation
refactor: consolidate archived transcript reads - #117343
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 6:52 AM ET / 10:52 UTC. ClawSweeper reviewWhat this changesThis PR replaces separate gateway filesystem transcript index and anchor readers with one Merge readinessNo blocking correctness or security finding was identified. This is a coherent gateway ownership refactor with focused regression coverage and successful exact-head CI, but its protected Priority: P2 Review scores
Verification
How this fits togetherGateway history endpoints first read the SQLite transcript projection and use a JSONL reset archive only when no projected rows are available and fallback is allowed. The archive reader turns the selected transcript artifact into history pages, recent messages, message lookups, and anchor-centered pages returned to gateway clients. flowchart LR
A[Gateway history request] --> B[SQLite transcript projection]
B --> C{Rows available?}
C -->|yes| D[History or message response]
C -->|no; archive fallback allowed| E[Archived transcript reader]
E --> F[Reset archive selection and materialization]
F --> D
Before merge
Agent review detailsSecurityNone. PR surfaceSource -433, Tests +113. Total -320 across 8 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single-reader consolidation after a maintainer confirms the clean merge result; keep SQLite-first selection and Do we have a high-confidence way to reproduce the issue? Yes for the reported defect: the added current-branch regression constructs an empty SQLite-facing scope with both an obsolete active JSONL and reset archive, then proves archive-only fallback selects the retained archive. I did not execute it because this review checkout is read-only. Is this the best way to solve the issue? Yes: centralizing artifact selection, materialization, indexing, and archive-only policy in one reader is better than preserving three filesystem readers or adding more façade-level guards, because all callers now share the same SQLite-first/reset-archive invariant. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a88f3ffc9609. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
ClawSweeper rank-up move disposition:
|
|
Merged via squash.
|
What Problem This Solves
Cold transcript reads were split across three filesystem readers plus facade-specific routing. The duplicated ownership made reset archive selection inconsistent: after SQLite returned no rows, the full-history path could still choose an obsolete live JSONL instead of the retained reset archive.
Why This Change Was Made
ArchivedTranscriptReaderis now the single filesystem owner for full/recent/page/by-id/anchor reads across plain and compressed reset archives. It preserves DAG/leaf and reset-kept-tail projection, oversized-line placeholders, pagination metadata, path scoping, and SQLite-first precedence while deleting the separate index and anchor-reader modules.The shared index is a bounded 256-entry LRU keyed by path plus
(mtime,size), stores in-flight promises to deduplicate concurrent scans, and discards failed builds. Reset archive header validation is no longer cached independently of archive materialization, so same-path replacement cannot reuse a stale authorization decision.No protocol, config, schema, dependency, plugin SDK, or public contract changes.
User Impact
History, pagination, anchor lookup, and usage behavior remain unchanged. Reset/archive fallback is more consistent, zero-sized recent reads return no messages while retaining the total, and the gateway carries 433 fewer production lines.
Production delta:
+434 / -867(net-433). Tests are counted separately:+150 / -37.Evidence
pnpm buildpassed on Blacksmith Testboxtbx_01kyyc9gdn1bagm1xbbdz000an(run).pnpm check:changedpassed all core/coreTests formatting, boundary, dead-export, typecheck, lint, storage, schema, and import-cycle checks on Testboxtbx_01kyy9cwn91ew9q1d83qc85b71(run).gpt-5.6-sol,xhigh, clean with no accepted/actionable findings (0.98 confidence).main, including refactor(memory): consolidate session transcript ingestion #117293 and refactor(agents): fold cache TTL pruning into prompt projection #117313; no subsequent main chasing.ClawSweeper Rank-up Move
ClawSweeper optionally suggested another current-main refresh. This is intentionally skipped: exact head
180554426b94ea311135a1055eb64449d5c0105ealready performed the coordinated one-time integration onto then-currentmain, followed by a clean full build and 142 post-integration archive, anchor, pagination, SQLite, reset/delete lifecycle, revocation, and reader-boundary tests. The subsequent base advance has an empty diff across all eight touched transcript-reader paths. Repeating the refresh would invalidate the exact-head CI and proof without exercising a changed owner surface.