Repository navigation
fix(cli): make doctor --json imply read-only lint mode - #122662
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 11:57 AM ET / 15:57 UTC. ClawSweeper reviewWhat this changesThe PR makes bare Merge readinessThis maintainer PR remains necessary: current main rejects bare Doctor JSON, while the updated branch routes it to the existing read-only lint owner and preserves the previously reviewed session-selector validation. Priority: P2 Review scores
Verification
How this fits togetherDoctor is OpenClaw’s CLI diagnostic and repair surface. Command parsing selects lint, repair, or SQLite maintenance behavior, then sends operator or automation-friendly output to stdout. flowchart LR
A[Operator or deployment script] --> B[Doctor CLI arguments]
B --> C[Mode selection]
C --> D[Read-only lint]
C --> E[Repair or SQLite maintenance]
D --> F[JSON findings]
E --> G[Existing mode output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +11, Tests +69, Docs +2. Total +82 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep a single parsed-option inference at the Doctor command owner, with the raw-argv resolver limited to preserving clean machine output for the selected mode. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main’s Doctor action rejects bare Is this the best way to solve the issue? Yes. Reusing the established lint command at Doctor’s mode-selection boundary is preferable to creating a parallel preflight implementation or changing downstream output behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1f8fdf4ef0a8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
ClawSweeper P2 (selector-only JSON invocations) addressed in
|
|
Merged via squash.
|
* fix(cli): make doctor json imply lint * fix(cli): preserve doctor session selector errors
What Problem This Solves
Cloud supervisors and deployment scripts need one machine-readable preflight command.
openclaw doctor --lint --jsonis that command, but bareopenclaw doctor --json— the invocation every operator tries first — exits 2 with "doctor lint options require --lint. Useopenclaw doctor --lint ...." (src/cli/program/register.maintenance.ts). The flag combination is unambiguous; rejecting it just to demand a second flag is pointless friction on the exact path headless bootstrap scripts take.Why This Change Was Made
Third step of the cloud-container deployment track (#122477, #122530): make the obvious preflight invocation work.
doctor --jsonnow implies--lint: read-only checks, machine-readable JSON on stdout, non-interactive — byte-identical output todoctor --lint --json(proven black-box).--lint --json,--post-upgrade --json,--state-sqlite/--session-sqlitecombinations behave exactly as before (src/cli/doctor-output-mode.tsreserves machine output for them first).doctor --jsoncombined with--repair/--fix/--forcefails fast with exit 2 and a clear message — repair is interactive and side-effectful; a JSON repair report is intentionally not defined.--jsonhelp text anddocs/cli/doctor.mdnow positiondoctor --jsonas the deployment preflight.User Impact
openclaw doctor --jsongoes from an exit-2 error to the working read-only preflight.Evidence
--jsonon pre-change code exits 2 — test fails pre-fix for the intended reason; conflict cases; machine-mode compatibility).--jsonand--lint --jsonoutputs byte-identical;--json --repair/--fix/--forceexit 2.pnpm build(3m29s), docs inventory, formatting,git diff --check: all pass.Docs: https://docs.openclaw.ai/cli/doctor