Skip to content

fix(doctor): classify critical disk exhaustion as error - #125644

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-doctor-disk-severity
Aug 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-doctor-disk-severity

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Doctor’s human output calls less than 100 MB free CRITICAL because config writes, session transcripts, and log rotation may fail silently and cause data loss. The structured health finding nevertheless used severity: "warning". As a result, openclaw doctor --lint --all --severity-min error --json filtered the critical disk condition out, returned ok: true, and exited successfully.

Why This Change Was Made

Reuse the existing critical threshold for both the structured finding severity and requirement. Below 100 MB is now error / critical-free-space; 100–500 MB remains warning / low-free-space. Human output and thresholds are unchanged.

User Impact

Automation and operators relying on Doctor’s error gate can no longer miss imminent write failures and data-loss risk due to critically low disk space.

Evidence

  • Pre-fix focused regression: 1 failed / 23 passed because 50 MB was classified as warning.
  • Post-fix: node scripts/run-vitest.mjs run src/commands/doctor-disk-space.test.ts → 24/24 pass on rebased head.
  • node scripts/run-tsgo.mjs -p tsconfig.core.json → rc 0.
  • oxlint + oxfmt on touched files → rc 0 / clean.
  • Codex autoreview → clean, 0.99, no actionable findings (rerun after rebase).

Doctor's human output labels less than 100 MB free as CRITICAL because config,
session, and log writes may fail silently and lose data. The structured lint
finding still used warning, so --severity-min error filtered it out, returned
ok=true, and exited successfully. Share the threshold decision between the
structured severity and requirement: critical is error, low space remains
warning. Update the regression contract accordingly.
@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS maintainer Maintainer-authored PR labels Aug 18, 2026
@steipete
steipete marked this pull request as ready for review August 18, 2026 06:01
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 2:08 AM ET / 06:08 UTC.

ClawSweeper review

What this changes

This PR makes Doctor emit an error-level structured finding, rather than a warning, when the OpenClaw state partition has under 100 MB free.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: current main still reports critical disk exhaustion as a warning, so this small producer-level fix remains necessary and appears correct. The remaining merge gate is exact-head validation; the intentional exit-status change for existing error-gated automation should be acknowledged.

Priority: P2
Reviewed head: 66d0ed4b43203b3e52cc245cfb41ba12ac16fd6d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused, net-neutral owner-boundary repair with a matching regression assertion.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work, so the external-contributor real-behavior-proof gate does not apply; the PR body supplies focused test and static-check results.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work, so the external-contributor real-behavior-proof gate does not apply; the PR body supplies focused test and static-check results.
Evidence reviewed 7 items Current-main defect: Current main unconditionally marks every disk-space finding as warning even when its requirement is critical-free-space.
Changed owner boundary: The PR computes the existing critical threshold once and uses it for both structured severity and requirement, preserving the warning band.
Lint consumer contract: Doctor filters findings by severity and derives its exit code from the same filtered threshold; warning findings do not meet an error minimum.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw doctor --lint --all --severity-min error --json

Result: FAIL (partial)

pnpm openclaw doctor --lint --all --severity-min error --json
runner@runnervmzvulz:~/work/clawsweeper/clawsweeper/target-pr$ pnpm openclaw doctor --lint --all --severity-min error --json
$ node scripts/run-node.mjs doctor --lint --all --severity-min error --json
pnpm openclaw doctor --lint --all --severity-min error --json
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.88 kB
[log]
[success] rolldown v1.2.0 Finished in 44.72 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.8s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 14.3s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 4439ms (slowest: built plugin control-plane loads 3653ms)


Assertions:

  • FAIL expect_output: "ok":
  • FAIL expect_output: "findings":

How this fits together

Doctor collects health findings from core checks and renders them for operators or lint automation. The disk-space contribution feeds the severity filter, JSON output, and lint exit code.

flowchart LR
A[State directory] --> B[Disk-space probe]
B --> C[Doctor disk finding]
C --> D{Free space below 100 MB}
D -->|Yes| E[Error severity]
D -->|No, below 500 MB| F[Warning severity]
E --> G[Lint filter and exit status]
F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Existing automation using openclaw doctor --lint --all --severity-min error will now exit nonzero below 100 MB free; that compatibility change is intentional but should be accepted as part of the fix.
  • Resolve merge risk (P1) - The supplied check snapshot still has two checks in progress, so exact-head green validation remains pending.
  • Complete next step (P2) - No repair lane is needed because this open maintainer-authored PR already contains the narrow source-level correction; await exact-head validation.
Agent review details

Security

None.

PR surface

Source 0, Tests 0. Total 0 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 3 0
Tests 1 2 2 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 5 5 0

Review metrics

Metric Value Why it matters
Production vs test delta production +3/-3 (net 0); tests +2/-2 (net 0) The fix centralizes the existing threshold decision without production growth and updates one focused regression expectation.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-disk-space.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the critical error gate (recommended)
    Merge with the intended behavior that existing error-threshold automation fails when the state partition has less than 100 MB free.

Technical review

Best possible solution:

Keep severity classification at the disk-space finding producer, as this PR does, and merge after exact-head checks confirm the intended critical error gate.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: current main emits a warning for a 50 MB critical finding, while the lint severity contract excludes warnings at --severity-min error. No test was executed because this review is read-only.

Is this the best way to solve the issue?

Yes. Assigning severity at the disk-space finding producer is the narrow canonical repair; changing global lint filtering would incorrectly alter unrelated warning behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1c3e512096bc.

Labels

Label justifications:

  • P2: This is a bounded Doctor automation correctness fix with limited runtime blast radius.
  • merge-risk: 🚨 compatibility: Error-threshold automation that previously succeeded during critical disk exhaustion will intentionally begin exiting nonzero.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored work, so the external-contributor real-behavior-proof gate does not apply; the PR body supplies focused test and static-check results.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame assigns the mismatched severity line and disk-health registration to Peter Steinberger. (role: pre-PR source-line author and recent Doctor contributor; confidence: medium; commits: aa2d3df8e639; files: src/commands/doctor-disk-space.ts, src/flows/doctor-health-contributions-initial.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 1cf7ec9 into main Aug 18, 2026
283 checks passed
@steipete
steipete deleted the codex/autoqa-doctor-disk-severity branch August 18, 2026 06:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
)

Doctor's human output labels less than 100 MB free as CRITICAL because config,
session, and log writes may fail silently and lose data. The structured lint
finding still used warning, so --severity-min error filtered it out, returned
ok=true, and exited successfully. Share the threshold decision between the
structured severity and requirement: critical is error, low space remains
warning. Update the regression contract accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant