Repository navigation
fix(update): Doctor lint deferred with 0ms left after a slow state snapshot - #170374
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 changesThis PR gives newer update validation commands separate Doctor inspection windows and marks deferred lint as advisory. Example: A published 2026.10.3 updater validates a candidate with 60 agents after a slow snapshot and repair Doctor.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open for landing: it fixes inspection-budget starvation that remains on main, preserves advisory deferral, and has no blocking correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe installed updater snapshots state and launches candidate validation commands; candidate Doctor reads the copied ledger to budget optional inspections, and the updater converts its JSON report into progress and recorded outcomes. flowchart TD
A[Installed updater] --> B[Private state snapshot]
B --> C[Candidate Doctor command]
C --> D[Shared inspection budget]
D --> E[Lint worker and report]
E --> F[Advisory progress and update outcome]
Technical reviewBest possible solution: Land the shared command-budget correction and advisory classification while preserving older-driver behavior and required validation failures. Do we have a high-confidence way to reproduce the issue? The original beta report, current ledger-based admission code, and supplied before/after published-driver observations establish the failure path; this review executed no target code. Is this the best way to solve the issue? The existing budget and report-classification owners are appropriate, and the snapshot receipt distinguishes fresh-command drivers without changing shipped parents; the added environment variable is an internal worker handoff rather than an operator setting. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 98116a50c5e3. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +80, Tests +122, Docs +4. Total +206 across 9 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 HistoryReview history (1 earlier review cycle)
Reviewed October 14, 2026, 2:24 AM ET / 06:24 UTC (Revision 2). |
A passing lint report that deferred any inspection, including a partial run, uses the advisory mark and repeats that sentence on the final report. Activation still continues. The per-command inspection window stays in openclaw#170374. Refs: openclaw#170333
|
ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…apshot (openclaw#170374) * fix(update): show budget-deferred Doctor lint as advisory * fix(doctor): anchor rehearsal budget at each validation command's start
…hor handoff (#172887) * fix(ci): hand the Doctor lint budget anchor to its worker over stdin #170374 added OPENCLAW_UPDATE_REHEARSAL_COMMAND_STARTED_AT_MS so the rehearsal `doctor lint --json` CLI could pass its validation-command budget anchor to the lint worker it spawns. That pushed the distinct OPENCLAW_* count to 455 against the owner-held budget of 454, failing the env-var check inside the max-lines ratchet on every main push. The CLI already sends the worker a JSON payload on stdin and both processes are always the same build, so the anchor now travels there. The worker parses a strict { options, commandStartedAtMs } envelope and threads the value into its single resolveDoctorUpdateBudget call; every other command keeps anchoring at its own performance.timeOrigin. Budget semantics are unchanged. The deferred-inspection result builder moves next to its sibling createStateSnapshotFailureExecution in doctor-lint-output.ts so doctor-lint-runner.ts stays within its line cap. * test(doctor): narrow the captured worker stdin to a string
…hor handoff (openclaw#172887) * fix(ci): hand the Doctor lint budget anchor to its worker over stdin openclaw#170374 added OPENCLAW_UPDATE_REHEARSAL_COMMAND_STARTED_AT_MS so the rehearsal `doctor lint --json` CLI could pass its validation-command budget anchor to the lint worker it spawns. That pushed the distinct OPENCLAW_* count to 455 against the owner-held budget of 454, failing the env-var check inside the max-lines ratchet on every main push. The CLI already sends the worker a JSON payload on stdin and both processes are always the same build, so the anchor now travels there. The worker parses a strict { options, commandStartedAtMs } envelope and threads the value into its single resolveDoctorUpdateBudget call; every other command keeps anchoring at its own performance.timeOrigin. Budget semantics are unchanged. The deferred-inspection result builder moves next to its sibling createStateSnapshotFailureExecution in doctor-lint-output.ts so doctor-lint-runner.ts stays within its line cap. * test(doctor): narrow the captured worker stdin to a string
Closes #170333
What Problem This Solves
Fixes: on large state directories, update validation's Doctor lint deferred all agent-scope inspections ("0ms remaining in the validation inspection window") and Doctor disposal was cut to 52ms, while the lint step still showed ✓.
User Impact
User impact: candidate Doctor and lint now get their own inspection window per validation command, so slow state snapshots no longer starve them. When inspections are still deferred, the step shows
!with "runopenclaw doctor --fixafter the update" instead of a plain pass. Deferral remains advisory and never blocks activation.Why This Change Was Made
The candidate's Doctor budget was anchored at the ledger's
validatingstep, which starts before the state snapshot andcandidate-doctor. Updaters since 2026.10.1 give each validation command its own ≥300s budget, so that anchor charged unrelated snapshot/doctor time to lint (121.85s + 152.78s > the 149s window) and clamped disposal to the remaining milliseconds. The candidate only sees the copied ledger, so it detects those updaters by the in-progresscandidate-state-snapshotstep and anchors at its own command start (with a 10s disposal margin for spawn/respawn). Older updaters keep thevalidatinganchor. The lint parent computes the anchor once and hands it to its worker.Update behavior: the budget anchor is candidate-side and takes effect when updating to a release containing it from 2026.10.1+ updaters. The advisory rendering runs in the installed updater and takes effect for updates driven from a release containing it.
Evidence
src/commands/doctor-lint.update-budget.test.ts: new fixture modeling the real copied ledger (validating280s ago + in-progresscandidate-state-snapshot): agent checks run, sourcevalidation-command, disposal 287s out. Fails before the change; the old-updater case still defers. 6/6, 60.3s wall.src/infra/update-candidate-canary.lint.test.ts: advisory for 0 and 3 checks run, exit 0, renders! candidate-doctor-lint. Fails before; 7/7 after, 72.1s wall (new tests are ms; time is worker prep).src/commands/doctor-lint-process.test.ts15/15 (26.1s),src/flows/doctor-health.update-budget.test.tsandsrc/cli/program/register.maintenance.lazy.test.tspass.pnpm tsgo:core,git diff --checkclean.--timeoutbelow 300s is not modeled (pre-existing).Published-driver proof (Docker update cells)
Fleet-size cells (2026-10-13)
Ran
scripts/e2e/published-driver-update-docker.shlocally with two proof-only, uncommitted changes to the cell: the fixture config gets N agent entries, and the cell can install a local tarball as the driver. Each cell starts from the published driver's real state. It seeds state through Doctor, installs the managed service, creates durable and incognito sessions, and seeds a retained credential sidecar. It then runsopenclaw update --tag <candidate> --yes --json. The cell's existing assertions all passed in every run: runfinished/succeeded, service replaced,/readyz200, running version verified, durable session content preserved, incognito content removed, sidecar bytes unchanged.The slowdown comes from fleet size: 60 agents need a 120 s inspection allowance, and snapshot plus repair Doctor take about 55–70 s inside the cell. That is enough to exhaust the old
validating-anchored window. No test hooks were added.validating60 agent scopes need a 120000ms inspection allowance, with 91092ms remaining in the validation inspection window (validation-ledger)update-validation-budgetdeferrals; agent-scope checks ran (73 lint warnings, e.g. per-agentcore/doctor/codex-session-routes)200000ms allowance, with 141908ms remaining ... (validation-command). Step carriesadvisory: "Doctor deferred 1 inspection until after activation (0 ran). Run \openclaw doctor --fix` after the update."` instead of a plain passSlow-host cells (2026-10-14): reported phase lengths, throttled hardware
These rerun the same published-driver cell on throttled hardware to reproduce the reported shape: a slow state snapshot followed by a slow repair Doctor. Each container gets
docker run --cpus=1 --device-read-bps=/dev/vda:10mb --device-write-bps=/dev/vda:10mb.State is about 465 MB of realistic content. A proof-only script wrote 1,200 transcript messages of 100 KB each, spread over 30 agents, through the serving Gateway's
sessions.createandchat.injectRPCs, on top of the fleet's agent databases. No product code or test hooks changed. Every cell passed the cell's existing assertions (finished/succeeded, service replaced,/readyz200, running version verified, durable content kept, incognito removed, sidecar unchanged).--jsonvalidating60 agent scopes need a 120000ms inspection allowance, with 0ms remaining in the validation inspection window (validation-ledger)--jsonvalidatingupdate-validation-budgetdeferral; per-agent checks ran for 120.3 s (73 lint warnings)✓ candidate-state-snapshot (231.06s),✓ candidate-doctor (158.46s)150 agent scopes need a 300000ms inspection allowance, with 139124ms remaining ... (validation-command), with the advisory text. The published 2026.10.3 updater renders the step as✓✓ candidate-state-snapshot (214.28s),✓ candidate-doctor (113.92s)Human terminal output from the last cell (unchanged apart from removed ANSI color codes):
Together these cover the reported failure: a slow snapshot plus a slow repair Doctor (reported 121.85 s + 152.78 s; reproduced 231 s + 158 s and 214 s + 114 s) no longer exhausts lint's window. When the fleet genuinely needs more than the window, the step shows
!with the follow-up command. That marker needs an installed updater containing this change; published 2026.10.3 still shows✓.Remaining limits:
--jsonand don't print the snapshot/Doctor step durations, so they are compared by lint start offset (+366.9 s vs +378.5 s) under identical throttling and state.--timeoutbelow 300 s is not modeled. Both are unchanged from the description above.