Repository navigation
perf(sessions): skip protection scans for full cold batches - #192033
vincentkoc wants to merge 1 commit into
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: needs maintainer review before merge. What this changesThis PR skips hot-transcript protection scans when embedded archives already fill a cold-storage batch. Example: One embedded archive fills a batch whose maxTranscripts is 1.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored draft makes a focused, source-consistent optimization with no actionable introduced defect found, but substantially overlaps an existing open PR. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe cold-storage worker receives batch limits and admission identities, selects embedded archives and eligible hot transcripts, and passes preparation results to the existing guarded mutation worker. flowchart TD
A[Maintenance request] --> B[Cold selection worker]
B --> C[Embedded archive selection]
C --> D[Protection scan when slots remain]
C --> E[Archive preparation]
D --> E
E --> F[Guarded mutation worker]
F --> G[Database and archive files]
Technical reviewBest possible solution: Carry one conditional selection implementation forward, coordinating its landing with #184507. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically performs the protection scan before discovering that embedded archives fill the batch; no runtime reproduction was executed in this review. Is this the best way to solve the issue? Moving the read into its sole consumer's existing condition is the smallest complete selection-side fix and preserves the original snapshot and protection owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9c5f014050e7. Provenance checked
TestingProof path: none. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +76. Total +78 across 2 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 3, 2026, 11:00 AM ET / 16:00 UTC. |
aa8ac6c to
de8e95e
Compare
|
Consolidated into #184507, now merged with this PR’s unique SQLite and PostgreSQL regression coverage. Closing the duplicate; the original source branch is preserved. |
What Problem This Solves
Cold-storage selection scans every session for hot-transcript protection even when embedded archives already fill the batch and no hot transcript can be selected.
User Impact
Full externalization batches skip unused preparation work. Selected records, ordering, incoming-reference protection, commit validation, schemas, stored formats, retention, and recovery authority remain unchanged. No configuration or migration is required.
Why This Change Was Made
Move the protection scan into the existing hot-window selection condition. PostgreSQL buffers the query result, so avoiding the query also avoids transferring unused metadata through the bridge. This is an avoided-work claim, not a measured latency result.
Evidence
de8e95eccd408feb4661a7f030a1afeb9df8ca89; base:6f8c9bad8bd1a8c339f2d61985e637f9e557550d.Review hold: #184507 already contains the same selection optimization and additionally avoids the mutation-side scan. Keep that existing PR as the canonical runtime repair; do not land both production patches. This draft adds distinct SQLite and PostgreSQL protection/reference regression coverage that should be preserved during consolidation. The other PR's checkout, source branch, and validation remain untouched.
Outstanding: consolidate this coverage with the canonical repair, then validate the combined candidate.
Track A only. Draft for Vincent's review; do not merge or enable auto-merge.
Regression replay
The unchanged PostgreSQL regression failed on the unpatched frozen base because a full externalization batch still executed the protection SELECT. It passes at this PR head. The separate overlap/consolidation hold remains. Replayed with test-only overlays and unchanged production on the recorded base through Blacksmith Testbox.