Repository navigation
refactor: remove redundant SQLite lease-release transactions - #176500
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 removes explicit SQLite transaction envelopes around eligible exact-owner lease deletions. Example: Release the synthetic lease release owned by original-owner.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-directed optimization is focused, but its new delayed-cleanup assertion fails on the reviewed head and needs a fixture repair. Priority: P3 Before merge
Findings
Tests
Agent review detailsHow this fits togetherLease lifecycle owners coordinate shared-state access and Gateway ownership; release requests pass through database admission and remove only the matching owner's lease row. flowchart TD
A[Lease lifecycle owner] --> B[Release dispatch]
B --> C[Worker final admission]
B --> D[Native database admission]
C --> E[Exact owner DELETE]
D --> E
E --> F[Cleanup settlement]
Technical reviewBest possible solution: Keep the existing owner-qualified autocommit path and repair the delayed-cleanup fixture so it actually exercises failed release and retained cleanup. Do we have a high-confidence way to reproduce the issue? Source confirms the redundant release envelopes, and exact-head hosted CI independently records the introduced assertion failure; no target code was executed during this review. Is this the best way to solve the issue? Using the existing single-statement publication owner is appropriate because release is one conditional DELETE; compound operations and PostgreSQL retain their existing transaction owners. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5f63135f917a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +33, Tests +99. Total +132 across 7 files. Added test files: 0. View PR surface stats
Review metrics
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 October 18, 2026, 5:39 PM ET / 21:39 UTC. |
…w#176500) Obtain final admission and validate database identity before the terminal exact-owner SQLite DELETE. Preserve PostgreSQL, acquisition, renewal, compound transactions, and nonblocking cleanup behavior. Validation: focused lease regressions, static gates, PostgreSQL conformance and review, published-driver update proof, and two Codex review rounds complete. Recovery/update CI failures match scheduled main. Maintainer accepted the separately diagnosed backup shared-temp fixture interference; fixture isolation follows in a separate change.
What Problem This Solves
Lease cleanup wraps a single exact-owner DELETE in a SQLite transaction, adding BEGIN IMMEDIATE and COMMIT to ordinary release and Gateway shutdown.
User Impact
No public API, configuration, schema, or lease ownership behavior changes. Eligible SQLite releases execute fewer statements while retaining nonblocking lock handling and cleanup retries.
Why This Change Was Made
The release owner knows the complete operation before writing: its conditional DELETE returns no payload. Native release uses the existing single-statement publication helper. Worker release obtains final admission and validates the physical database before the terminal DELETE; the deleted transaction-stage handshake and post-write identity check cannot reject an already committed release. The exact-owner predicate preserves a successor that acquires the row before cleanup.
Acquisition, renewal, existing-schema storage, compound startup work, and PostgreSQL retain their transactions. Gateway release retains its existing lifecycle custody and heartbeat shutdown checks. No generic envelope inference or new fallback is introduced. A standalone DELETE retains SQLite's statement atomicity; a nested caller retains its outer transaction owner.
Evidence
Supplemental CI also reports an unchanged UI bundle budget failure (base and candidate both 1,494,580 bytes, +0 bytes) and the Swedish translation-memory failure seen in scheduled main 39163574553/job/117782015543. These are recorded separately from the lease owner and static proof; no UI source is changed.
The final ordinary CI run reports three failing shards: backup config capture rejects a retired snapshot staging token; session-recovery teardown finds an active native database borrower; and update-status SQLite-safety fixtures do not receive their expected refusal. Recovery teardown is independently reproduced on scheduled main 39172446197/job/117808338765, and both unsafe-SQLite fixture failures match main 39172446197/job/117808338666. Both are inherited and routed for repair. The backup-staging failure is diagnosed as cross-file shared-temp fixture interference, as detailed below; it is not claimed to have reproduced on main. The tested CI merge is 36f9eebc8df7e89cee22900c38160e6fb168264b, combining main dbe55cc with the reviewed head. A focused Linux Testbox compares those exact revisions under Node 24.19.0; this is supplemental because the failing CI shards use Bun. Both revisions passed the selected backup and recovery cases under Node, and both failed the unsafe-SQLite fixture with the same assertion. The lease was stopped and cleanup verified. A separate focused comparison of the failed backup file under checksum-pinned Bun was cancelled because the requested Testbox remained queued without an assigned host. No Bun test ran. The original failure in
src/infra/backup-config-capture.test.tsoverlapssrc/infra/backup-create.test.ts. Both usechooseBackupTempRoot()→os.tmpdir():createBackupArchive()runsmaintainBackupScratch({ repair: true }), which can retire a sibling’s newly created scratch directory beforecreateBackupScratchDirectory()acquires its staging token after awaited directory/identity work. The existing scratch-refusal regression preserves that refusal. The exact CI main and merge cases both pass under Node. The maintainer accepted this diagnosis as unrelated to lease release and explicitly authorized landing this head; a separate fixture-only PR will isolate backup temp roots. No backup product code or assertion is changed here, and the failed Bun CI result is not relabeled green.