Doctor: expose dry-run preview reports#84472
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 1:25 PM ET / 17:25 UTC. Summary PR surface: Source +234, Tests +166. Total +400 across 8 files. Reproducibility: yes. for source-level review: the PR head routes dry-run through the normal config finalizer and legacy Doctor contribution chain where writes can still be authorized. I did not run a mutating live scenario because this review is read-only. 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Make Doctor preview mode enforce a command-wide no-write boundary before config finalization, legacy contributions, state migrations, and final persistence, then document and prove the CLI/JSON contract with a repairable isolated state. Do we have a high-confidence way to reproduce the issue? Yes for source-level review: the PR head routes dry-run through the normal config finalizer and legacy Doctor contribution chain where writes can still be authorized. I did not run a mutating live scenario because this review is read-only. Is this the best way to solve the issue? No. The public preview direction is useful, but this is not the best fix until dry-run is enforced as command-wide no-write and documented with real repair-preview proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3ad77774f0e5. Label changesLabel justifications:
Evidence reviewedPR surface: Source +234, Tests +166. Total +400 across 8 files. View PR surface stats
Security concerns:
Acceptance criteria:
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
Review history (1 earlier review cycle)
|
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Moonlit Diff Drake Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
6ca0b39 to
99f3e29
Compare
99f3e29 to
852500f
Compare
c1ac8e1 to
c7aa398
Compare
bb6ca95 to
d1584bc
Compare
|
@clawsweeper re-review Please re-review the rebuilt #84472 branch at current head Context:
Validation already recorded in the PR body:
Known remaining proof gap, also recorded in the PR body:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
b951d04 to
1d513af
Compare
|
Rebased #84472 onto current Validation after rebase:
@clawsweeper please re-review current head. |
|
🦞👀 I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes. Request: please re-review current head. |
|
ClawSweeper assist: This needs a full correctness re-review of current head Evidence:
Suggested next action: Use Source: #84472 (comment) |
|
@clawsweeper review Updated head b3563d3 fixes the dry-run/diff config preflight path so preview mode passes migrateState: false and migrateLegacyConfig: false, with regression coverage for dry-run, diff, and repair mode. PR body includes the new built-launcher proof for |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Summary
Rebuild #84472 narrowly on current
mainto expose Doctor repair previews without carrying the old broad migration stack.This draft now focuses on the public preview surface for already-structured Doctor repairs:
openclaw doctor --dry-runpreviews structured repair output without applying config repairs.openclaw doctor --diffimplies dry-run and includes structured repair diffs when checks provide them.openclaw doctor --dry-run --json/--diff --jsonemits a machine-readable preview report.Dry-run coverage proposal
This PR should not try to make every Doctor lint family previewable. After the 44/44 structured lint pass, the proposed dry-run bar is selective: dry-run should preview areas where Doctor already has, or should soon have, a concrete mutation path. Pure diagnostics, live service/account probes, optional inventory checks, and advisory findings should remain lint-only unless they gain a real repair owner.
Current checked-in structured repair substrate:
High-value dry-run families:
core/doctor/session-lockscore/doctor/session-transcriptscore/doctor/session-snapshotscore/doctor/config-audit-scrubcore/doctor/state-integritycore/doctor/sandbox/registry-filescore/doctor/ui-protocol-freshnesscore/doctor/browser-clawd-profile-residuecore/doctor/shell-completioncore/doctor/plugin-registrycore/doctor/configured-plugin-installscore/doctor/skills-readinesscore/doctor/gateway-services/extraLikely follow-up candidates, if the preview can be made truthful and scoped:
core/doctor/heartbeat-templatecore/doctor/legacy-plugin-manifestscore/doctor/legacy-plugin-dependenciescore/doctor/stale-plugin-runtime-symlinksNon-goal: dry-run parity for every lint finding. Gateway health/daemon, auth/profile readiness, channel/device/account probes, workspace inventory, disk-space, tool-result-cap, systemd linger, memory search, and other diagnostic/advisory checks can stay lint-only unless a separate PR proves a concrete repair effect.
Rebuild note
This PR branch was rebuilt from the historical
doctor-dry-run-contribution-guardbranch. The old branch mixed the dry-run preview surface with a broad older doctor migration stack. The replacement is intentionally smaller: CLI wiring, preview report plumbing, JSON output behavior, dry-run preflight guardrails, and focused tests around the existing structured repair runner.Validation
Current head
b3563d3f3404c61c7c8409ba6eb5329c254cbbc0:pnpm build- passedpnpm exec vitest run src/commands/doctor-config-flow.test.ts -t "does not run state or legacy config migrations for dry-run previews|does not run state or legacy config migrations for diff previews|keeps migrations enabled for repair runs" --reporter=dot --config test/vitest/vitest.commands.config.ts- 3 passed, 39 skippedpnpm exec vitest run src/commands/doctor-config-flow.test.ts -t "does not run state or legacy config migrations for dry-run previews" --reporter=verbose --config test/vitest/vitest.commands.config.ts- passedpnpm exec vitest run src/commands/doctor-config-flow.test.ts -t "does not run state or legacy config migrations for diff previews|keeps migrations enabled for repair runs" --reporter=verbose --config test/vitest/vitest.commands.config.ts- 2 passed, 40 skippedpnpm exec oxlint src/commands/doctor-config-flow.ts src/commands/doctor-config-flow.test.ts- passedgit diff --check- passedNot passing locally on current Windows checkout:
node scripts/run-vitest.mjs run src/commands/doctor-config-flow.test.ts --reporter=dothas one pre-existing Windows path assertion failure inwarns when hooks transformsDir points outside the hook transforms root; expected/virtual/.openclaw/hooks/transforms, received a Windows-normalized\virtual\.openclaw\hooks\transforms. This PR does not modify that path-formatting code.Real behavior proof
Behavior or issue addressed:
openclaw doctor --dry-run --diff --json --non-interactivenow completes through the built launcher and emits a clean dry-run preview report while dry-run/diff config preflight skips state and legacy config migrations.Real environment tested:
Windows source checkout at
b3563d3f3404c61c7c8409ba6eb5329c254cbbc0, Node.js v24.14.0. The CLI was built first withpnpm build, then run with isolatedHOME,USERPROFILE,OPENCLAW_HOME, andOPENCLAW_STATE_DIRunder%TEMP%.Exact steps or command run after this patch:
pnpm buildnode openclaw.mjs doctor --dry-run --diff --json --non-interactiveEvidence after fix:
The command exited
0in 73.8s from isolated proof rootC:\Users\giodl\AppData\Local\Temp\openclaw-doctor-launcher-proof-f622d14d1b00488899570333a0acab39.Stdout:
{ "mode": "doctor-repair-preview", "dryRun": true, "diff": true, "ok": true, "checksRun": 1, "checksRepaired": 0, "checksValidated": 0, "findings": [], "remainingFindings": [], "changes": [], "warnings": [], "effects": [], "diffs": [], "skipped": [] }Observed result after fix:
The built CLI produced only the final JSON preview on stdout and no stderr. The isolated proof root contained runtime cache/state files under the isolated
OPENCLAW_STATE_DIR, but noopenclaw.json,.clobbered*, or last-known-good config files were created.What was not tested:
Cross-platform live Doctor repair scenarios were not run for this draft rebuild. The raw source command
node --import tsx src/entry.ts doctor --dry-run --diff --json --non-interactivestill hung beforedoctorCommandstartup in this Windows checkout, so the successful real CLI proof uses the built source launcher path (node openclaw.mjs ...) afterpnpm build.