Repository navigation
fix(state): await private SQLite snapshot cleanup - #146571
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 12, 2026, 10:29 PM ET / September 13, 2026, 02:29 UTC (Revision 5). ClawSweeper reviewWhat this changesAsynchronous database inspections await shared cleanup of private SQLite snapshots, while synchronous callers retain their existing cleanup operation. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 3 items remain This remains a useful, review-clean repair. The updated evidence addresses the previous current-head upgrade blocker; no actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherDoctor, update preflight, and database verification inspect private SQLite copies to avoid disturbing live databases. The snapshot owner removes those copies after readers close and retains failed removals for retry. flowchart TD
A[Doctor and database inspections] --> B[Private SQLite snapshot]
B --> C[Read and close database]
C --> D[Shared asynchronous cleanup]
D --> E{Removal succeeds?}
E -->|Yes| F[Complete inspection]
E -->|No| G[Retain retry ownership]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +114, Tests +211. Total +325 across 20 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one snapshot cleanup owner, preserve the synchronous SDK contract, and retain the matching packaged-upgrade evidence with this asynchronous cutover. Do we have a high-confidence way to reproduce the issue? Yes, from source: current-main asynchronous snapshot inspections reach recursive rmSync cleanup. The branch adds focused ordering regressions; this review did not execute them. Is this the best way to solve the issue? Yes. Extending the existing snapshot owner with shared asynchronous settlement preserves cleanup ownership and avoids a competing implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2a3b63857db3. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
3189dc4 to
41d3c01
Compare
7914a23 to
9d02720
Compare
|
Merged via squash.
|
* fix(state): await private SQLite snapshot cleanup * refactor(state): isolate the SQLite snapshot type contract
Split from #130741. The startup and CI inventory fixes are already on main through #146410 and #146538.
What Problem This Solves
Asynchronous SQLite inspections removed their private snapshot directories synchronously, blocking the event loop during recursive cleanup. Concurrent cleanup callers also needed one shared completion result.
User Impact
Doctor, update preflight, database verification, and other asynchronous snapshot readers await filesystem cleanup after their native readers close. Failed removal retains the existing cleanup retry ownership and error behavior.
Why This Change Was Made
The existing snapshot owner now supplies asynchronous cleanup alongside its synchronous operation. Concurrent asynchronous callers join one removal attempt; a synchronous caller cannot report success while it remains pending. Asynchronous consumers await that operation, and schema inspection preserves both read and cleanup failures. Synchronous callers retain their existing contract.
The published updater's existing update marker continues to select candidate preflight. This changes no schema, integrity check, retention setting, or timeout.
Evidence
Four entry-point regressions failed before repair. The initial composed validation contained 426 passing tests and one existing Linux-only skip, with a normal build and full canonical checks. CI then exposed an import cycle. Moving the unchanged snapshot type to an import-free module resolves it with zero net production growth and identical emitted JavaScript in all six affected modules. Architecture, canonical checks, SDK declarations, all 153 SDK subpaths, and independent reviews of the cleanup and type changes pass.
A later local sibling run passed 177 cases and hit the existing 30-second continuous-commit Doctor timeout in one case. One planned serial baseline/current comparison passed that case on both sources; the original timeout remains unexplained and retained. No deadline or assertion was changed.
The previous head passed the packaged upgrade cell with full retained evidence: published 2026.9.3 updated to the candidate, preserved legacy operator state, restarted through the updater's service owner, advanced the expected schemas, passed the mock turn and health checks, and completed an already-current second update. That proof is tied to the previous head.
The current head coherently includes the upstream plugin-argument contract and its matching tests. All 20 repair files are unchanged. Its frozen install, full changed checks, architecture, all 18 plugin-registry cases, and one continuous-commit Doctor case pass. Exact-head CI is green. A fresh isolated packaged upgrade on this same head also passes: published 2026.9.3 updates through its own updater, preserves legacy operator state, replaces the supervised process, advances state schema 16→17 and agent schema 19→20, and passes the mock turn, health, already-current second update and all 34 Doctor checks. All 159 evidence files were retained and hash-verified, and the Testbox is stopped. This is the service-manager fixture, not OS-native systemd/launchd proof. The broader Swarm 500 ms responsiveness target remains tracked in #130741.