Skip to content

fix(update): Doctor lint deferred with 0ms left after a slow state snapshot - #170374

Merged
RomneyDa merged 2 commits into
mainfrom
fix/170333-lint-budget-anchor
Oct 14, 2026
Merged

RomneyDa merged 2 commits into
mainfrom
fix/170333-lint-budget-anchor

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

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 "run openclaw doctor --fix after 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 validating step, which starts before the state snapshot and candidate-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-progress candidate-state-snapshot step and anchors at its own command start (with a 10s disposal margin for spawn/respawn). Older updaters keep the validating anchor. 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 (validating 280s ago + in-progress candidate-state-snapshot): agent checks run, source validation-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.ts 15/15 (26.1s), src/flows/doctor-health.update-budget.test.ts and src/cli/program/register.maintenance.lazy.test.ts pass.
  • oxfmt, oxlint, pnpm tsgo:core, git diff --check clean.
  • Known gap: 2026.9.6–9.x updaters (fresh budgets but no snapshot step) keep the stricter window; operator --timeout below 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.sh locally 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 runs openclaw update --tag <candidate> --yes --json. The cell's existing assertions all passed in every run: run finished/succeeded, service replaced, /readyz 200, 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.

Cell Driver → candidate Lint start after validating Lint result
Before published 2026.10.3 → published 2026.10.5-beta.3 (budget code identical to this PR's base), 60 agents +55.8 s, ran 2.2 s All agent inspections deferred: 60 agent scopes need a 120000ms inspection allowance, with 91092ms remaining in the validation inspection window (validation-ledger)
After published 2026.10.3 → this PR (e1cd822), 60 agents +69.5 s, ran 9.1 s 0 update-validation-budget deferrals; agent-scope checks ran (73 lint warnings, e.g. per-agent core/doctor/codex-session-routes)
After, deferral still needed this PR as the installed driver (relabeled 2026.10.1) → this PR, 100 agents snapshot +39.3 s (13.7 s), candidate Doctor +53.1 s (21.4 s), lint +74.5 s Window measured from the lint command: 200000ms allowance, with 141908ms remaining ... (validation-command). Step carries advisory: "Doctor deferred 1 inspection until after activation (0 ran). Run \openclaw doctor --fix` after the update."` instead of a plain pass

Slow-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.create and chat.inject RPCs, 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, /readyz 200, running version verified, durable content kept, incognito removed, sidecar unchanged).

Cell Driver → candidate Snapshot / repair Doctor Lint
Before published 2026.10.3 → published 2026.10.5-beta.3, 60 agents, --json lint started +366.9 s into validating Deferred, ran 4.8 s: 60 agent scopes need a 120000ms inspection allowance, with 0ms remaining in the validation inspection window (validation-ledger)
After published 2026.10.3 → this PR, 60 agents, --json lint started +378.5 s into validating No update-validation-budget deferral; per-agent checks ran for 120.3 s (73 lint warnings)
After, still over budget (published driver) published 2026.10.3 → this PR, 150 agents, human output ✓ candidate-state-snapshot (231.06s), ✓ candidate-doctor (158.46s) Window measured from the lint command: 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 ✓
After, still over budget (this PR as updater) this PR installed as driver (labeled 2026.10.1) → this PR, 150 agents, human output ✓ candidate-state-snapshot (214.28s), ✓ candidate-doctor (113.92s) See excerpt below

Human terminal output from the last cell (unchanged apart from removed ANSI color codes):

  ✓ candidate-state-snapshot (214.28s)
candidate-doctor: doctor --fix --non-interactive --no-workspace-suggestions
  ✓ candidate-doctor (113.92s)
candidate-doctor-lint: doctor --lint --json --severity-min error
  ! candidate-doctor-lint (6.39s)
    Doctor lint warning [core/doctor/lint-inspection]: update-validation-budget: Doctor lint inspection deferred until after activation: 150 agent scopes need a 300000ms inspection allowance, with 140944ms remaining in the validation inspection window (validation-command).: Run `openclaw doctor --fix` after activation to complete deferred checks and repairs.
    Doctor deferred 1 inspection until after activation (0 ran). Run `openclaw doctor --fix` after the update.
✅ OpenClaw updated to 2026.10.2 (from 2026.10.1).

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:

  • The before/after cells use --json and 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.
  • 2026.9.6–9.x updaters (no snapshot step) keep the stricter window, and operator --timeout below 300 s is not modeled. Both are unchanged from the description above.

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: M labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Lint starts after the ledger-based inspection window expires and defers all agent inspections.
  • After: Lint uses its own command window and runs agent inspections; genuine deferrals show ! when driven by the patched updater.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused and correct with real update proof and successful exact-head CI; one added mock-option assertion has limited regression value.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied Linux Docker cells exercise real openclaw update commands from published 2026.10.3 to the reviewed candidate under slow-state conditions, showing agent inspections running; patched-driver terminal output shows genuine deferral as ! followed by successful activation, satisfying the prior rank-up request.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Slow snapshots and preceding Doctor work consume lint's apparent inspection allowance, leaving checks deferred behind a green progress mark.
Reason: The maintainer-authored change corrects accounting for newer drivers and makes incomplete coverage visible while retaining the intended successful-update policy.

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
Reviewed head: e1cd8220eb2d660898fb1fb90947e42a3f2791c0

Before merge

None.

Findings

None.

Tests

  • Low-value test src/commands/doctor-lint-process.test.ts: Remove the new 'hands the worker this command’s budget anchor' case: it only inspects an option passed to a mocked process runner and never verifies that the worker consumes the anchor or preserves the deadline.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Inspection-budget origin changes intended behavior with a stated reason (8ef68bb: Use conservative optional-work admission against the published driver's shared validation window, preserving required repairs.)
  • Lint worker disposal deadline keeps the original intent (7723e49: Publish completed checks before slow disposal and bound the isolated worker without accepting independent process failures.)
  • Successful lint advisory classification keeps the original intent (1e48d0c: Keep optional findings and policy advisories visible without blocking valid updates, retaining physical failure facts.)
  • Documented optional-inspection deferral keeps the original intent (95d7123: Defer optional candidate lint while keeping required checks, standalone lint, and explicit selections intact.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced budget repair: The pinned introduction recognizes an in-progress snapshot receipt, anchors newer-driver inspection and disposal windows at command start, and passes that anchor to the lint worker. (src/flows/doctor-update-budget.ts:115, e1cd8220eb2d)
  • Current-main gap: Fetched main retains the original ledger-based budget and lacks the successful-deferral advisory classifier; its newer post-adoption diagnostic work does not replace either repair. (src/flows/doctor-update-budget.ts:25, 98116a50c5e3)
  • Published-driver contract: The latest stable source records candidate-state-snapshot before preparing private state and starts a fresh budget for each validation command, supporting the candidate-side detection. (src/infra/update-candidate-canary.ts:219, 59cb44796b0f)
  • Published-driver and patched-driver proof: The complete current body records throttled Docker upgrades from published 2026.10.3 to the reviewed head with agent inspections running, plus patched-driver terminal output showing ! for genuine deferral and successful activation; retained session content and credential-sidecar checks passed. (e1cd8220eb2d)
  • Intent and related contribution: In [Bug]: update validation lint defers agent checks with 0ms left and still passes #170333, DonnieFi supplied the slow-snapshot observation and steipete confirmed that optional deferral must remain advisory; fix(update): mark budget-deferred doctor lint as advisory #170381 overlaps on presentation but does not repair budget anchoring.
  • Exact-head CI: Paginated check results contain no failed or pending checks and include a successful openclaw/ci-gate for the reviewed head. (e1cd8220eb2d)

PR surface

Source +80, Tests +122, Docs +4. Total +206 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 106 26 +80
Tests 3 130 8 +122
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 240 34 +206

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #170333
Summary: The closed report records the observed starvation and presentation concern; this PR repairs both, while the sibling draft overlaps only on advisory rendering.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: Large-state updates unnecessarily defer optional inspections and misleadingly display a clean pass, while activation remains available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-12T23:24:36.025Z sha e1cd822 :: needs maintainer review before merge. :: none

Reviewed October 14, 2026, 2:24 AM ET / 06:24 UTC (Revision 2).

DonnieFi added a commit to DonnieFi/openclaw that referenced this pull request Oct 13, 2026
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
@RomneyDa
RomneyDa marked this pull request as ready for review October 13, 2026 04:28
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 14, 2026
@RomneyDa
RomneyDa merged commit c7dd7b9 into main Oct 14, 2026
234 checks passed
@RomneyDa
RomneyDa deleted the fix/170333-lint-budget-anchor branch October 14, 2026 12:26
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…apshot (openclaw#170374)

* fix(update): show budget-deferred Doctor lint as advisory

* fix(doctor): anchor rehearsal budget at each validation command's start
steipete added a commit that referenced this pull request Oct 15, 2026
…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
RomneyDa added a commit that referenced this pull request Oct 16, 2026
…apshot (#170374)

* fix(update): show budget-deferred Doctor lint as advisory

* fix(doctor): anchor rehearsal budget at each validation command's start

(cherry picked from commit c7dd7b9)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: update validation lint defers agent checks with 0ms left and still passes

1 participant