Repository navigation
fix: Doctor maintenance closes unrelated database clients - #148126
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check could not safely complete for this revision. ClawSweeper will not retry this unchanged revision. Next step: No contributor action is requested. Maintainers should inspect the linked workflow run. |
|
Codex review: blocked before merge. Reviewed September 14, 2026, 8:59 AM ET / 12:59 UTC (Revision 5). ClawSweeper reviewWhat this changesDoctor now tracks and drains its own database work while preserving unrelated runtime clients and cleanup error details. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 1 item remains This remains a necessary fix, with no actionable introduced defects found. The new published-updater qualification resolves the previous review’s upgrade-proof blocker within its documented scope. Priority: P2 Review scores
Verification
How this fits togetherDoctor coordinates database repairs before releasing maintenance locks and restoring the Gateway. Its database lifecycle layer manages native handles, asynchronous work, and shared SQLite worker clients. flowchart TD
A[Doctor repair] --> B[Maintenance resource scope]
B --> C[Owned handles and worker jobs]
C --> D[Drain and close owned resources]
D --> E[Release locks and restore Gateway]
F[Independent runtime clients] --> G[Existing runtime resources]
B -->|Preserve| G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +645, Tests +284, Docs +2. Total +931 across 36 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep cleanup scoped within the existing database lifecycle owner, preserving independent clients, current write authority, and retryable cleanup failures. Do we have a high-confidence way to reproduce the issue? Yes, from source: Doctor release on fetched main invokes global agent cleanup regardless of which caller opened the handles. This review did not execute a reproduction. Is this the best way to solve the issue? Yes. Exact resource custody addresses the cleanup boundary while retaining canonical caches, shared worker ownership, and existing admission checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6f21bfa05db4. LabelsLabel changes:
Label 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)
|
|
Merged via squash.
|
…48126) * fix(sqlite): scope Doctor cleanup to its resources * fix(sqlite): preserve maintenance cleanup error details
Related: #146557
What Problem This Solves
Doctor maintenance can close or wait on database resources admitted by another caller when it finishes a repair or a check that finds no work.
User Impact
Doctor finishes its accepted database work while preserving existing and independently admitted runtime clients. Cleanup failures retain their underlying error details. No schema, stored-data layout, configuration, retention, or version change is included.
Why This Change Was Made
The existing database lifecycle owner associates maintenance work with exact resources through a lexical execution boundary. Cleanup settles owned asynchronous work and native borrows before closing its native handles. Nested and sibling scopes retain their common owner, and failed unpublished opens retain their exact cleanup owner. Current write/admission checks remain authoritative; disposal of owned resources remains possible after write authority is lost.
The five maintenance-lock callers and top-level Doctor use that boundary. This is an independent prerequisite for the KV worker migration in #146557.
Evidence
Current candidate
aa5ffff04d78preserves all 36 qualified repair files while incorporating main's shared Docker assertion fix from #148129. Package and lock inputs are unchanged. The repair passed 36 selected checks and ten ordinary resource/worker/Doctor controls. The cleanup-error correction passed 29 selected checks and two original-red/candidate-green pure error contracts: a lone error keeps its identity/message, and multiple errors keep their original list and first cause. Fresh P2 review of the final composition found no actionable findings.The published-updater Testbox session completed its original managed command successfully. Published
[email protected]drove an actual file-artifact update to exactaa5ffff04d78, despite both manifest versions being 2026.9.4. Recorded build IDs distinguish the published3a9d69db306cpayload from the candidate. Candidate Doctor completed successfully in 15.190 seconds; the updater restored the real Gateway through the maintained test service manager, with a replacement supervisor and healthy readiness/RPC. The ordinary synthetic installation retained agents, disabled cron jobs, approvals, workspace and plugin configuration. Candidate no-op and the named formerly-bundled plugin Doctor checks also passed; Doctor lint reported no findings across 35 checks, with 30 skipped.The candidate tarball was 71,242,565 bytes, SHA-256
13702623462992bd9abe0bb9c9d59c21384e4ad9e4ed5ebcba54891b7610f212. Source checks passed before build, after build, and after exercise; the package inventory contains 9,695 regular dist files. All 125 collected evidence files were independently hash-verified, and original-run collection and lease cleanup completed. This proves the successful published-updater/Doctor/service-adapter path using the maintained systemctl/busctl fixture and real Gateway processes. Native systemd and a full installed-dist rehash are outside this proof. Service status retained a recommended PATH finding for missing pnpm directories while RPC remained healthy. No recovery or synthetic future-package branch was exercised.The earlier installed compiled-entry qualification remains tied to exact
ba9217daa084: its two ordinary Doctor/shared-worker flows preserved independent handles and worker clients, closed the owned agent handle, and preserved a fresh canonical no-op database. Its distinct tarball SHA-256 isd8a8965e334485e36924372085cb1416d9b68f5c5aa9d22a86b4ee02ca9123d3; all 9,694 packaged regular dist files matched before and after. This remains historical successful-path ownership evidence, not a relabeled current-head package.One earlier KV-based maintenance candidate produced an unexplained ordinary TaskFlow creation failure. Later ordered passes and the successful upgrade cell do not diagnose its cause or establish that it is fixed. The original evidence remains retained. Current-head CI completed successfully: 123 jobs passed and 14 were skipped. Native landing gates remain; no workflow was replayed.