Repository navigation
fix(storage): allow first session after missing-store reads - #200306
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 closes released database generations without an admitted file so later first-session creation can proceed. Example: Read the absent store for agent main, release the reader, then create agent:main:after-missing-read.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses a concrete first-session failure still present on current main, and its maintainer authorship also prevents automatic closure. No introduced correctness defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe agent database execution owner shares native storage generations among session readers and writers, then either retains an admitted generation for reuse or closes it after the last borrower releases. flowchart TD
A[Session read or write] --> B[Agent execution owner]
B --> C[Native storage worker]
C --> D[Agent SQLite database]
B --> E[Last borrower releases]
E --> F[Retain admitted generation]
E --> G[Close generation without a file]
Technical reviewBest possible solution: Retain only generations with an admitted file and let the existing retirement owner release empty generations. Do we have a high-confidence way to reproduce the issue? The current-main retention predicate and creating-borrower rejection establish the failure sequence, and the supplied regression names the same error; this read-only review did not execute tests. Is this the best way to solve the issue? The patch repairs the lifecycle invariant at its existing owner with one predicate change; the idle fixture changes model admitted files so existing retention coverage remains meaningful. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 42f3067f3968. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +54. Total +56 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 16, 2026, 6:57 PM ET / 23:57 UTC. |
Backport 827a749. Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 827a749) Co-authored-by: RomneyDa <[email protected]> Release adaptation: none; source change applies to the pinned beta baseline. Follow-up disposition: bounded pinned-main same-path audit recorded in the lane report; cross-lane changes remain parent-owned. (cherry picked from commit 732bc9a10bffc39b2414d5270f412789786067bf)
What Problem This Solves
Fixes first-session creation failing after an earlier read found no agent database.
User Impact
A fresh agent can create its first session after an empty state read. Existing admitted databases keep their normal warm-worker behavior; no configuration or migration is required.
Why This Change Was Made
Releasing the last reader could retain a generation that had never admitted a database file. That left a pending opener which later blocked creation. Only generations with an admitted file are now eligible for idle retention; the existing close path releases empty readers.
Evidence
Agent creation cannot capture another pending native opener, then passes after the fix: read an absent store, release the reader, create the first session, and read it back.15bb782f6ce61969f9804c7764a6c0cde4e341b3: all 36 creation-witness and idle tests pass with Node 24.22.1 and the pinned fs-safe 0.27.1 dependency. Targeted format and type-aware lint pass for all three changed files.726a8dd4985723c6b1050a65e05502dd010f2ae8..15bb782f6ce61969f9804c7764a6c0cde4e341b3: no findings, security cleared. Broader CI runs on this PR.