Repository navigation
improve: avoid session-list rereads when model metadata changes - #157129
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: blocked before merge. Reviewed September 24, 2026, 3:52 AM ET / 07:52 UTC. ClawSweeper reviewWhat this changesThe Gateway session-list projection retains accepted SQLite row facts so model-catalog updates can refresh displayed rows without rereading unchanged data, with documentation and regression tests. Merge readiness⛔ Blocked before merge - 2 items remain Current main still rereads session facts after a model-catalog change. This PR addresses that work in the existing Gateway projection, and the reviewed changes show no concrete correctness defect. Priority: P2 Review scores
Verification
How this fits togetherGateway session-list requests use a resident row projection fed by session storage and model metadata. The projection prepares row facts and returns current session presentation to clients. flowchart LR
A[Model catalog update] --> C[Resident row projection]
B[Stored session changes] --> D[Invalidate retained facts]
D --> E[SQLite read worker]
E --> C
C --> F[Session list presentation]
F --> G[Gateway response]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +15, Tests +214, Docs +8. Total +237 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep catalog-only reuse in the resident projection, with committed storage and transcript publications revoking retained facts and archived rows remaining bounded. Do we have a high-confidence way to reproduce the issue? Yes. Current main advances the database revision on catalog replacement, and the added registered-handler test gives a focused SQLite read-count path; this review did not run it. Is this the best way to solve the issue? Yes. Reusing accepted facts in the existing projection, with its revision fences and publication invalidations, is a narrow way to remove the redundant reads. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ffb17b275480. 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
|
|
Merged via squash.
|
What Problem This Solves
Refreshing model metadata makes busy session lists reread unchanged database rows before they can display the new model information.
User Impact
Model-catalog changes update session presentation with less database work. Real session, transcript, configuration, and store changes still require fresh facts. Schema, persisted data, permissions, Doctor, and update behavior are unchanged; no operator action is required.
Why This Change Was Made
The resident row owner now retains its complete accepted database snapshot for catalog-only rematerialization. It reuses the existing entry and ACP objects by reference, retaining a small snapshot envelope and optional transcript watermark. Cold archives retain no complete snapshot, and materialized archives keep the existing bounded cache.
Data publications revoke retained facts. Transcript updates also fence in-flight worker replies immediately, even while presentation refreshes are coalesced. Catalog renewal keeps its existing display ordering and validity checks.
Evidence
A regression through the registered
sessions.listhandler and real synthetic SQLite state fails before the fix: changing model limits rereads both unchanged rows. Afterward, limits and current activity-summary state update with zero additional row-fact/ACP worker reads and no host queries to the affected tables.A real stored update held across catalog renewal is read once and appears with the new model limits. Forced fact invalidation still reacquires rows.
The existing transcript-window regression exposed a stale retained snapshot; it now proves immediate revocation and rejects a paused worker reply after another transcript append, while refresh coalescing remains intact.
94 distinct focused tests pass. The final 40-case rerun covers catalog RPCs, accepted-facts lifecycle, and transcript/backfill behavior after the transcript fix; wall time was 87.887 seconds across three files with
--maxWorkers=1. Broader sibling proof took 134.147 seconds across nine files. These totals include worker compilation and test setup, not only test bodies.Independent managed review found no actionable P0–P2 issues. This is boundary proof of avoided reads, not a measured production latency improvement. Full changed checks passed (2,053.755 s wall, including production types, all 25 test type graphs, lint, dead exports, and storage/runtime guards). Exact-head hosted CI completed successfully: 125 jobs succeeded, 17 were skipped, and none failed.
Required per-file single-worker cost (
pnpm test <file> --maxWorkers=1):sessions-list-config.test.ts28.415 s wall (baseline with the regression: 40.662 s, expected unnecessary-read failure; new case 1.643 s);session-row-projection.accepted-facts.test.ts116.274 s wall, 24 passing cases, 109.33 s Vitest duration (new case 2.030 s);session-row-projection.backfill.test.ts54.567 s wall, 14 passing cases, 50.45 s Vitest duration (extended transcript/catalog race 1.796 s). The latter two measured fresh caches under concurrent checks, so compiler/import and host-load costs dominate and are not production latency measurements. Hosted CI ran the registered catalog regression in 1.095 s and its identity-scope sibling in 0.779 s; the containing Gateway-methods job passed in 665 s, including setup and unrelated cases. Individual CI timings for the two projection files are not yet available.