-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Feature] Doctor dry-run / diff mode #79166
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Problem
openclaw doctor --fixapplies changes without preview. There is no--dry-runor--previewflag to see what--fixwould change before it changes it.sessions cleanuphas--dry-run(doctor-state-integrity-BPSD4cAx.js);doctoritself does not.Originally filed as part of #65824 (item 6) and #65818. Re-audited against 2026.5.7 (eeef486) — no changes.
Source evidence (5.7 dist/ file names)
doctor-config-flow-Cqgy0iUL.js:1211—const shouldRepair = params.options.repair === true || params.options.yes === true— this is the sole repair gate. NodryRunparameter or branch exists anywhere in this flow.doctor-config-flow-Cqgy0iUL.js:901—if (!params.shouldRepair && params.pendingChanges)— thependingChangesobject contains the full proposed change set. WhenshouldRepairis false, the only output is deferredfixHintstext. When true (line 915), changes are written immediately. There is no intermediate "show what would change" path.doctor-config-flow-Cqgy0iUL.js:915—if (params.shouldRepair && params.pendingChanges) return { ... }— writes the config directly. No diff preview, no confirmation gate, no backup-then-apply pattern.doctor-config-flow-Cqgy0iUL.js:1248—if (pluginIssueLines.length > 0 && !shouldRepair && !fixHints.includes(...))— plugin config issues also follow the binary shouldRepair/don't-repair pattern with no preview.doctor-state-integrity-BPSD4cAx.js— the session cleanup path exposes--dry-run. The doctor config path indoctor-config-flow-Cqgy0iUL.jshas no equivalent.doctor-*.jsin 5.7 dist/. None containdryRunlogic for the--fixconfig repair path.openclaw doctor --helpshows--fix,--repair,--force,--non-interactive,--yes. No--dry-runor--preview.We have experienced
doctor --fixsilently stripping custom config fields in the past — fields that were valid and intentional but not in the expected schema. Without a preview, the user cannot catch these before they're applied.Workaround
oc-doctor-safe— creates a full config backup, runsdoctor --fix, shows a diff of changes, requires confirmation before keeping them, and supports rollback if the changes are unwanted.Proposed solution
Add
--dry-runtodoctor --fixthat:--fixpendingChangesobject at line 901 already contains these)The plumbing is already there —
pendingChangesat line 901 contains the full proposed change set beforeshouldRepairdecides whether to write. A--dry-runflag would simply serialize that object as a diff and exit before the write at line 915.This matches the pattern already established by
sessions cleanup --dry-run.Impact
High.
doctor --fixis the most common maintenance command and it mutates config without preview. A diff mode would prevent accidental field stripping and build operator confidence in the tool.Environment