Doctor: expose state integrity findings#95979
Conversation
|
@clawsweeper review Please review current head |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed June 27, 2026, 11:24 AM ET / 15:24 UTC. Summary PR surface: Source +348, Tests +157. Total +505 across 4 files. Reproducibility: not applicable. this is a structured Doctor surface rather than a bug report. The PR body provides terminal proof for the opt-in lint and dry-run paths. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the opt-in structured state-integrity check after maintainer approval and exact-head gates, while keeping legacy Do we have a high-confidence way to reproduce the issue? Not applicable; this is a structured Doctor surface rather than a bug report. The PR body provides terminal proof for the opt-in lint and dry-run paths. Is this the best way to solve the issue? Yes; the implementation mirrors adjacent structured Doctor slices, keeps the check default-disabled for lint compatibility, and leaves real mutations in the legacy state-integrity path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4010b81a77f4. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +348, Tests +157. Total +505 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
@clawsweeper re-review Current head |
|
🦞🧹 I asked ClawSweeper to review this item again. |
50feea3 to
fe18439
Compare
|
@clawsweeper re-review Rebased after #95976 merged; current head is Validation refreshed in the PR body: focused state-integrity/contribution Vitest is green, changed-file oxfmt/oxlint are green, tsgo core/test-src are green, plugin SDK surface report is clean, and diff check is clean. No config, plugin, or public SDK contract change. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
fe18439 to
24d45fc
Compare
|
@clawsweeper re-review Current head |
|
🦞🧹 I asked ClawSweeper to review this item again. |
24d45fc to
109a54e
Compare
|
@clawsweeper re-review Current head |
|
🦞🧹 I asked ClawSweeper to review this item again. |
688361e to
eb3bd1a
Compare
|
Merged via squash.
Thanks @giodl73-repo! |
Summary
core/doctor/state-integrityas a structured Doctor health finding surface.HealthFindingoutput.noteStateIntegrityDoctor path.defaultEnabled: false; defaultdoctor --lintbehavior is unchanged, whiledoctor --lint --alland--only core/doctor/state-integrityinclude it.This is the next narrow structured Doctor rule slice after session artifacts. It intentionally keeps the existing Doctor state-integrity implementation authoritative for real
doctor/doctor --fixbehavior.Stack
Rebased onto current
mainat81e53202f2after #96471 merged. Current branch head isd0fb93fa2f(fix(doctor): preserve config permission findings).Validation
Current head
d0fb93fa2f:OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run src/flows/doctor-health-contributions.test.ts src/flows/doctor-lint-flow.test.ts src/commands/doctor-state-integrity.test.ts --reporter=dot- 88 tests passed, 1 Windows-only permission-mode test skipped, across 2 Vitest shardspnpm exec oxlint.CMD src/flows/doctor-health-contributions.ts src/flows/doctor-health-contributions.test.ts src/flows/doctor-lint-flow.ts src/flows/doctor-lint-flow.test.ts src/commands/doctor-state-integrity.ts src/commands/doctor-state-integrity.test.tspnpm exec oxfmt.CMD --check src/flows/doctor-health-contributions.ts src/flows/doctor-health-contributions.test.ts src/flows/doctor-lint-flow.ts src/flows/doctor-lint-flow.test.ts src/commands/doctor-state-integrity.ts src/commands/doctor-state-integrity.test.tspnpm tsgo:test:srcgit diff --checkReal behavior proof
Behavior or issue addressed:
Structured Doctor state-integrity findings now surface existing missing state-directory diagnostics through
core/doctor/state-integrity, and the structured repair adapter reports a dry-run effect for the same issue while real mutation remains owned by the legacy Doctor path. The structured check is opt-in for lint so defaultdoctor --lintcompatibility is preserved.Real environment tested:
Windows source checkout at PR head
d0fb93fa2f, using isolated temp state paths where needed,NO_COLOR=1, andOPENCLAW_DISABLE_AUTO_UPDATE=1. The lint-selection proof uses the source health-check runner because it directly proves default-vs---allselection without running unrelated lint checks. The focused CLI proof uses the public source CLI path with--only core/doctor/state-integrity.Exact steps or command run after this patch:
core/doctor/state-integrity, and calledrunDoctorLintChecks(...)once with default options and once withincludeAllChecks: true.node scripts/run-node.mjs doctor --lint --json --only core/doctor/state-integrityagainst an isolated missingOPENCLAW_STATE_DIR.dryRun: true.Evidence after fix:
Default-vs-all selection source harness:
{ "default": { "checksRun": 0, "checksSkipped": 1 }, "all": { "checksRun": 1, "checksSkipped": 0 }, "defaultEnabled": false }Public CLI structured finding through explicit opt-in, redacted:
Structured dry-run repair effect source harness, redacted:
{ "findings": [ { "checkId": "core/doctor/state-integrity", "severity": "error", "message": "State directory is missing. Sessions, credentials, logs, and config are stored there.", "path": "<TEMP_PROOF_ROOT>\\missing-state", "fixHint": "Run `openclaw doctor --fix` to create the state directory." } ], "repair": { "status": "repaired", "changes": [], "effects": [ { "kind": "state", "action": "would-create-state-dir", "target": "<TEMP_PROOF_ROOT>\\missing-state", "dryRunSafe": false } ] } }Observed result after fix:
Default lint selection skips the state-integrity check.
--allselection includes it. The explicit--onlypublic lint command ran exactly one check, emitted oneerrorfinding forcore/doctor/state-integrity, and exited 1. The structured repair adapter reported the matchingwould-create-state-direffect without mutating the missing state directory.What was not tested:
POSIX config permission live CLI output was not tested on this Windows host; that branch remains covered by the POSIX-only regression because Windows intentionally skips mode diagnostics. Command-wide dry-run report output was not tested because that public reporting surface is planned in #84472, not this PR.
Notes
The rebased diff is 4 files changed. The latest update resolves ClawSweeper's default-lint compatibility finding by making
core/doctor/state-integrityopt-in for lint while preserving--alland--onlyaccess.