Repository navigation
fix(sessions): avoid repeated unchanged transcript reads - #191100
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 changes before merge. What this changesThis PR shares identical in-flight transcript reads, populates the existing replica, reuses revision-matched accounting, and adds fixed caller metrics. Example: Four concurrent bounded reads request the same unchanged session without a retained actor.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored PR addresses measured redundant transcript work, but its new runtime import breaks the trusted PR wrapper’s source closure. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherSessionManager and Gateway consumers request transcript views through admitted history workers; the actor replica retains bounded snapshots, while SQLite projection readers calculate accounting. flowchart TD
A[Session and Gateway consumers] --> B[Admitted hydration reader]
B --> C[Existing actor replica]
B --> D[Revision scoped in flight sharing]
D --> E[History worker]
E --> F[SQLite transcript and accounting]
E --> C
Technical reviewBest possible solution: Retain the existing replica and accounting owners, and include the new attribution module in the trusted wrapper inventory. Do we have a high-confidence way to reproduce the issue? Current-main source repeats cold hydration and accounting work, and the supplied benchmark reports matching outputs with reduced work; no target code was executed during this review. Is this the best way to solve the issue? The approach uses existing retained owners and transient sharing with request-shape and revision keys; the added cancellation, mutable-result, and accounting invalidation tests cover distinct failures. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against baaf869a3a4e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +244, Tests +252, Docs +8, Other +319. Total +823 across 44 files. Added test files: 0. View PR surface stats
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 November 2, 2026, 8:05 AM ET / 13:05 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…1100) * fix(sessions): reuse unchanged transcript reads * fix(ci): include hydration caller in PR runtime inventory
What Problem This Solves
Concurrent or repeated reads of an unchanged session could hydrate the same transcript repeatedly, while cold accounting recomputed the same active-byte aggregate.
User Impact
Repeated session reads use less SQLite I/O and CPU, with identical transcript and accounting results. Hydration reader-operation labels now have fixed caller suffixes; aggregate
sessions.transcript-hydration.*as documented. No schema or configuration changes.Why This Change Was Made
Admitted readers outside active actor custody could consume the existing transcript replica but could not populate it. Hydration now seeds that owner and shares identical in-flight bounded requests by native revision, request shape, fence, and worker lane. Each consumer keeps independent cancellation and mutable results. The existing bounded window owner records cold accounting facts by database handle and full transcript revision. Fixed caller labels distinguish model preparation, cron/subagent opens, reloads, previews, compaction, exports, and other consumers.
Full streaming/compaction reads retain their contracts. Sequential hydration without a retained actor remains a miss; the first cold accounting computation is unchanged.
Evidence
Synthetic Linux fixture: 17.13 GB, 5,000 sessions, three transcripts exceeding 600 MiB. Separate pinned baseline/candidate sources, A/A controls, five repeated sequences per process, exact physical-reader counters, complete result digests, CPU, and separate allocation sampling. All results match.
Without an actor, four identical concurrent hydrations dispatch once instead of four times. Hydration worker-owner sampled allocations fall about 63% with a retained actor; accounting JavaScript allocations remain within A/A spread. First-process cold accounting reads remain 174,776,320 bytes on both versions. An initial slower unchanged control is retained in the investigation; fresh profiled and topology-warmed controls found no new hotspot. This is synthetic Linux/overlayfs evidence, not a deployment or filesystem-specific claim.
fe912d6852d89c4ac75b8438961f0dbf7791950f: scoped-clean through P2, no actionable findings.Production delta: +244 lines, including +134 for fixed caller attribution. Reuses existing completed-snapshot/scalar owners; adds only transient in-flight sharing. Test growth +252 lines has a task-specific allocation for real-worker attribution/cancellation and revision invalidation. Simplification removes duplicate validation and normalization.
CI follow-up
The first run exposed a missing runtime inventory entry for the new caller module. The one-line repair is independently reviewed; both closure checks pass locally and their repaired-head CI job is green.
CI run 41451062375 on
a34a152c6334fd006dc81486b4bbb64187cbd28bhas one failed workload: the invited-project membership test. It is a proven main regression introduced by #191027,cfde51dfe792: discovery now readsspawnedCwd, but this fixture still suppliesexecCwd. The unchanged test fails identically on CI’s exact main parent75be4d0f93324db4b2e9ed81e5e2c5f433cf33d0(one failed, one passed). Swapping only the introducing owner reproduces the failure; changing only the fixture field passes both cases. The failed test and discovery inputs are unchanged by this PR.The other 112 jobs succeeded and 25 were skipped; the aggregate gate reflects that single failed workload. Landing uses the authorized pinned-head inherited-failure exception, retaining failed CI and the exact checkout/parent/introducer evidence. The stale fixture remains a main follow-up, not a flaky result or an ignored failure.