Repository navigation
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 changesDoctor settles inherited shared-state WAL maintenance before opening repair resources while preserving independent readers. Example: Run openclaw doctor --fix with a shared-state handle retained by preflight.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a useful, bounded Doctor fix that current main still lacks; no actionable patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDoctor's offline maintenance owner receives the selected state directory and requester authority, settles inherited SQLite work, and admits scoped repair resources. flowchart TD
A[Doctor preflight] --> B[Cached shared state handle]
C[Exclusive maintenance owner] --> D[Settle inherited WAL work]
B --> D
D --> E[Retire cached handle]
E --> F[Revalidate ownership]
F --> G[Admit Doctor repair resources]
Technical reviewBest possible solution: Land the focused cached-owner settlement fix through the normal workflow once current-head CI completes. Do we have a high-confidence way to reproduce the issue? Source shows current main admitting repair resources while the inherited cached WAL owner remains live; the contributor reports a failing baseline regression and supplies real-path observations, but this review ran no reproduction. Is this the best way to solve the issue? The repair uses the existing cache and maintenance owners, joins accepted WAL work, preserves independent readers, and retains requester and physical-ownership checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d70a7e7300cd. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +27, Tests +109. Total +136 across 6 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 HistoryReview history (13 earlier review cycles; latest 8 shown)
Reviewed October 12, 2026, 9:40 PM ET / October 13, 2026, 01:40 UTC (Revision 14). |
After-fix runtime proofI ran the patched candidate at Setup: a complete isolated snapshot of the affected Mac state and configuration, using the candidate's Node 24 runtime. I quarantined only the snapshot's copied gateway-owner artifacts before the run; those artifacts referenced the still-running live gateway PID, while the original incident occurred after the gateway was stopped. Live state and the live Gateway were not modified or stopped. Observed result: exit status Scope note: the snapshot reported unrelated cron-authority and skill-path warnings caused by its intentionally isolated paths; Doctor continued and completed. They are not attributed to this change. This is supplemental runtime evidence in addition to the focused real-SQLite regression and full build already recorded in the PR body. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
92a35ba to
d2714a6
Compare
Current-head WAL-settlement evidenceUpdated head:
Verification on this exact head: I also ran the source CLI against an isolated copied Mac-state snapshot after quarantining only copied gateway-owner and agent-handle lease artifacts. It entered Doctor and performed recovery work, but the copied snapshot contains an unrelated malformed agent database; Doctor correctly refused that migration. I am not presenting that as a successful end-to-end proof. The deterministic regression above covers the requested pending-inherited-WAL settlement boundary on this head. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Addressed ClawSweeper P2 in 68f3922399af9dfe80b22c8fcf80d27300986093. Doctor now settles and retires only the inherited cached WAL owner before repair admission; it no longer performs database-wide async resource drainage. The new regression keeps an independent same-database current reader open through Doctor acquisition/release and verifies it remains usable afterward. The existing delayed-cancellation regression still proves Doctor waits for inherited WAL settlement before opening repair resources. Verification: @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Follow-up evidence for the current head I reran the real-path proof in a fresh isolated state directory using the current source tree. It opens the actual shared-state SQLite/WAL handle, writes a pending record, invokes the real periodic WAL maintenance path, then enters Doctor’s exclusive maintenance owner and runs the real SQLite reclamation repair. No mocked cancellation/delay is involved. Redacted observation: {
"walBytes": 1499712,
"databaseBytes": 1470464,
"logFrames": 364,
"checkpointedFrames": 364,
"maintenanceState": "complete",
"inheritedSharedStateClosedBeforeRepair": true,
"repair": {
"autoVacuum": 2,
"retainedValue": "preserved",
"integrityCheck": "ok"
}
}The proof asserts all of the following before succeeding: the WAL maintenance manager remains owned while checkpointing; its inherited cached shared-state handle is closed before Doctor opens exclusive repair resources; the repaired database has incremental auto-vacuum ( Separately, I ran the current source Please re-review this current head; the previous evidence comment did not demonstrate a real pending WAL settlement. |
|
@clawsweeper re-review Current-head redacted real-path WAL-settlement and successful-repair proof is in #166413 (comment). |
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
da8d37b to
55a8afb
Compare
Published-updater compatibility proof (redacted)Validated on the current PR head pnpm test:docker:published-upgrade-survivorResult: passed (the selected lane completed in 755s).
The generated summary is redacted (only fixture references, no credential values, personal IDs, or external URLs) and records |
|
@clawsweeper re-review The requested redacted published-updater compatibility proof for the current head is here: #166413 (comment) |
|
🦞👀 Re-review progress:
|
55a8afb to
ad2d75c
Compare
4212541 to
e252968
Compare
10f88e8 to
f07c444
Compare
|
Thank you @dlmccoy! The WAL maintenance owner already prevents inherited timers from borrowing Doctor's authority (8b16e53), and #170022 suspends shared-worker timers during maintenance, so Doctor keeps its lease and repair continues. Closing since current |
What Problem This Solves
openclaw doctor --fixcan lose its agent-database maintenance lease when a shared-state handle left open by preflight keeps its optional WAL maintenance worker alive during Doctor's exclusive repair.User Impact
Doctor now drains that inherited shared-state maintenance before it opens Doctor-scoped resources. The offline repair no longer competes with itself for the state store.
Why This Change Was Made
The fix closes the cached preflight handle only after Doctor has acquired exclusive maintenance ownership, then reasserts that ownership before proceeding. It deliberately does not change SQLite busy-timeout or lease-duration behavior.
Evidence
main: the inherited shared-state handle remains open aftermaintenance.acquire().pnpm test src/commands/doctor-maintenance.sqlite-reclamation.test.ts --maxWorkers=1— 2 tests passed (20.25s wall time).pnpm build— passed (3m 57s).pnpm checkcould not complete because of pre-existing max-lines-baseline shrink requirements in unrelated files andspawnSync git ENOBUFS; this focused PR does not alter those surfaces.Scope
This intentionally does not add archive-resume cursoring. That path needs a separate design because a partial cursor could bypass canonical-file exclusion and verification receipt semantics.