Skip to content

[Bug]: doctor's fallback hint says to use config unset, but config unset refuses invalid configs and points back to doctor #202032

Closed

Description

@anmol0b

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When openclaw doctor --fix finishes with a config that is still invalid, and no migration covers the rejected key, its fallback hint says to run openclaw config unset <key>. But openclaw config unset (like set and patch) refuses to run on an invalid config, and says to run openclaw doctor --fix. The two commands point at each other, and neither one fixes the config.

Steps to reproduce

This was traced in source on main @ 59ca885.

  1. Put a key into openclaw.json that the schema rejects and that no Doctor migration covers.
  2. Run openclaw doctor --fix. The final validation finding (src/flows/doctor-config-validation-findings.ts:21-23) uses the fallback:
    Run `openclaw doctor --fix` to migrate or remove retired keys. If no migration applies, correct the value or use `openclaw config unset <key>` with the rejected key path, then rerun Doctor.
    
  3. Run openclaw config unset <rejected.path>. Config writes go through runConfigOperations, then loadValidConfigForWrite (src/cli/config-cli-runner.ts), then ensureValidConfigSnapshotForCli (src/cli/config-cli-validation.ts:55-67). That function exits 1 on any invalid snapshot and prints the repair hint "Run openclaw doctor --fix to repair, then retry." docs/cli/config.md also says config writers do not bypass the invalid-config guard.

The fallback hint was added in 952b5eb. No test covers it.

Expected behavior

Doctor's fallback hint names something that works on an invalid config, for example editing the file shown by openclaw config file, or another supported repair path. Or config unset is allowed to remove exactly the rejected paths from an invalid config, so the existing hint works.

Actual behavior

Doctor says to use config unset, config unset says to use doctor --fix, and the user is stuck in a loop.

OpenClaw version

main @ 59ca885

Operating system

Not OS-specific

Install method

Any

Model

NOT_ENOUGH_INFO (no model involved)

Provider / routing chain

NOT_ENOUGH_INFO (no provider involved)

Logs

NOT_ENOUGH_INFO (traced in source; message strings quoted above)

Impact and severity

Medium for recovery. This is the path users take when setup or an upgrade leaves a config that is invalid in a way no migration handles, and both suggested commands lead back to each other.

Activity

  1. added
    clawsweeper:intake:bug
    P2
    clawsweeper:fix-shape-clear
    clawsweeper:queueable-fix
    clawsweeper:source-repro
    impact:ux-friction
    issue-rating: 🦞 diamond lobster
    maturity:stable
    no-stale
    and removed
    clawsweeper:intake:bug
    on Nov 19, 2026
  2. clawsweeper commented on Nov 19, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    This issue establishes a current-source recovery loop with a narrow repair, and the related upgrade PR does not address the misleading fallback.

    Reproducibility: Current source establishes both sides of the loop, including rejection before deletion; no CLI reproduction or tests were run during this read-only review.

    Regression provenance
    Possible regression — suspected (reviewed change). No predecessor PR is attributed.

    Next step
    Replace Doctor’s unusable fallback and establish a failing regression showing that unresolved invalid configuration receives a working recovery path.

    Review details

    Best possible solution:

    Doctor should direct operators to locate and correct the active configuration file when automatic repair leaves validation errors.

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

    Current source establishes both sides of the loop, including rejection before deletion; no CLI reproduction or tests were run during this read-only review.

    Is this the best way to solve the issue?

    Correcting the fallback is the smallest complete repair; allowing mutations against invalid starting configurations would unnecessarily expand the config writer’s contract.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The recovery sequence has not been exercised through the CLI; isolated regression and command-level proof are still required.

    Codex review notes: model internal, reasoning medium; reviewed against d5f3e4d7b75a.

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P2: A source-proven recovery defect affects an advanced CLI configuration workflow, with no demonstrated widespread outage.
    • impact:ux-friction: The suggested recovery commands send operators back and forth instead of explaining the supported manual correction path.
    • maturity:stable: CLI Doctor is the primary M4 owner, its Doctor category scores are Stable, and actionable guided repair is an established contract.
    Evidence reviewed

    Acceptance criteria:

    • pnpm test src/flows/doctor-health-contributions.test.ts --maxWorkers=1
    • pnpm test src/cli/config-cli.test.ts --maxWorkers=1
    • Using isolated synthetic config/state with gateway.port set to a nonnumeric string, run pnpm openclaw doctor --fix --non-interactive and verify actionable fallback guidance.
    • Run pnpm openclaw config unset gateway.port against the invalid fixture and verify refusal leaves its bytes unchanged.
    • Run pnpm openclaw config file, correct the reported setting in that file, then run pnpm openclaw config validate and rerun Doctor.

    What I checked:

    How this review workflow works
    • 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; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed November 19, 2026, 3:16 PM ET / 20:16 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2clawsweeper:fix-shape-clearclawsweeper:queueable-fixclawsweeper:source-reproimpact:ux-frictionissue-rating: 🦞 diamond lobstermaturity:stableno-stale

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions