Repository navigation
fix(doctor): prevent inspection timeouts from repeated continuation scans - #168069
Conversation
Reuse already recorded continuation and takeover receipts after fresh update admission. Actual ledger writes retain full integrity validation, while no-op guards no longer spend the native inspection deadline reopening the writer. Closes #168031. Thanks @Tosko4 for the event-loop and SQLite profile.
|
🦞👀 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 skips redundant ledger writes when fresh admission already contains the required continuation or takeover receipt. Example: The supplied regression inspects openclaw.service with a 5,000 ms deadline and charges each integrity check 6,000 ms.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep this PR open: it contains a useful, focused optimization absent from current main, with no concrete introduced code defect found. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor's maintenance admission reads the shared SQLite update ledger, evaluates current driver ownership, and supplies guards to native service inspection and maintenance. flowchart TD
A[Doctor maintenance] --> B[Fresh ledger read]
B --> C[Driver ownership admission]
C --> D[Existing receipt]
D --> E[Native service guard]
C --> F[Missing receipt]
F --> G[Validated ledger writer]
G --> E
Technical reviewBest possible solution: Retain this focused optimization and address cold admission-reader costs separately through the existing Doctor and state-reader owners. Do we have a high-confidence way to reproduce the issue? Source confirms that repeated continuation guards enter full writer integrity validation inside a five-second inspection deadline; the linked report includes official-release traces and a separate current-main CLI reproduction, but this review ran no target code. Is this the best way to solve the issue? Skipping an already satisfied write at the existing admission owner is a narrow root-cause improvement that retains fresh ownership evaluation and validated mutations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1f307d61d0f7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +13, Tests +53, Docs +6. Total +72 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 9, 2026, 9:31 PM ET / October 10, 2026, 01:31 UTC. |
…tion deadlines (openclaw#168069) With a systemd user Gateway running and a ~150 MB state database, openclaw update repair and doctor --fix never entered maintenance: each continuation guard re-recorded the repair continuation, which ran writer admission and a full synchronous integrity scan on the CLI main thread, so the 5 s service-manager inspection deadline expired, the verdict became unavailable, Doctor did not stop the Gateway and maintenance stayed deferred. Doctor admission now treats an existing continuation or takeover receipt as already recorded (the fresh admission read still checks authority), so no writer admission or full scan runs inside the deadline; actual writes keep full validation. Closes openclaw#168031. Reported by @Tosko4.
…tion deadlines (#168069) With a systemd user Gateway running and a ~150 MB state database, openclaw update repair and doctor --fix never entered maintenance: each continuation guard re-recorded the repair continuation, which ran writer admission and a full synchronous integrity scan on the CLI main thread, so the 5 s service-manager inspection deadline expired, the verdict became unavailable, Doctor did not stop the Gateway and maintenance stayed deferred. Doctor admission now treats an existing continuation or takeover receipt as already recorded (the fresh admission read still checks authority), so no writer admission or full scan runs inside the deadline; actual writes keep full validation. Closes #168031. Reported by @Tosko4. (cherry picked from commit d12658c)
…tion deadlines (openclaw#168069) With a systemd user Gateway running and a ~150 MB state database, openclaw update repair and doctor --fix never entered maintenance: each continuation guard re-recorded the repair continuation, which ran writer admission and a full synchronous integrity scan on the CLI main thread, so the 5 s service-manager inspection deadline expired, the verdict became unavailable, Doctor did not stop the Gateway and maintenance stayed deferred. Doctor admission now treats an existing continuation or takeover receipt as already recorded (the fresh admission read still checks authority), so no writer admission or full scan runs inside the deadline; actual writes keep full validation. Closes openclaw#168031. Reported by @Tosko4. (cherry picked from commit d12658c) (cherry picked from commit 56cd4b1) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes repeated service-inspection timeouts during Doctor maintenance and update repair when continuation guards repeatedly validate a large state database. Closes #168031. Thanks @Tosko4 for the event-loop probe and SQLite profile.
User Impact
An already recorded repair continuation no longer causes a full database scan at every native service guard. Doctor can inspect and maintain the managed Gateway within the existing inspection budget. Fresh update ownership checks and full validation for actual ledger writes remain in place.
Why This Change Was Made
resolveDoctorUpdateAdmissionpreviously reopened the one-shot ledger writer even when the requested receipt was already present. The writer validated integrity before discovering there was nothing to change. Doctor now uses its current admission read to recognize the existing continuation or takeover receipt. A missing receipt still goes through the transactional writer, including its integrity checks and authority revalidation. No new integrity cache, schema, configuration, or timeout is introduced.Secondary report: the current restoration readiness budget remains 60 seconds. Current Doctor already warns and completes repair when the Gateway is still starting or its service is running at expiry; a stopped/failed service still fails restoration. That behavior is unchanged and its existing readiness tests passed.
Evidence
systemd-inspection-deadline-exceeded; the fix admits the query and still refuses a subsequently created competing update.node scripts/run-vitest.mjs src/commands/doctor-maintenance.admission-warm.test.ts --maxWorkers=1: 10/10 tests passed in all three runs. Wrapper wall times: 54.49 s, 30.19 s, 37.39 s; test time approximately 19 s, 19 s, 22 s. The new regression took 4.61–4.77 s, with no real six-second sleep.node scripts/check-changed.mjs --base d810d753e31b: FAILED at the inherited dead-export gate. Production scan reportsisTelegramReadOnlyControlLaneText,buildDirectChatContext, and theresolveContextTokensre-export; full-tree scan reports the Telegram export. These files are unchanged from the lane base through observed origin/main. Core and all 27 test typecheck partitions passed. This inherited main failure is recorded separately from the change; the later lint/architecture gates were therefore run directly and passed (below).node scripts/check-madge-import-cycles.ts: 0 cycles.git diff --check: passed.The importer command took 774.60 s including its full runtime prerequisite build (429.9 s). The pre-existing
doctor-maintenance.admission-activation.test.tscases took 40.629 s, 38.430 s, and 46.919 s (125.978 s total); that fixture retains real synchronous snapshot/helper subprocesses around native guards. No timeout, retry, skip, or assertion was changed. Hosted CI timing is pending. This is local boundary proof, not a live Linux/systemd or 150 MB database reproduction.Diff: production +14/−1, tests +54/−1, docs +6/−0. Auto-merge is off.