Skip to content

fix(config): return actionable errors for retired settings - #178289

Merged
steipete merged 2 commits into
mainfrom
upd/upd-l1714
Oct 20, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/upd-l1714

Conversation

@steipete

@steipete steipete commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Config commands did plugin migration work before reporting a known retired core setting such as skills.workshop.approvalPolicy, and JSON failures lacked recovery guidance.

Refs #178177.

User Impact

openclaw config validate --json and openclaw config get gateway.mode --json report the invalid setting without loading plugin migration diagnostics for that known core error. JSON preserves the existing error.message and adds recovery guidance in the top-level repairHint field. The commands exit unsuccessfully without changing config or creating state.

Why This Change Was Made

The config snapshot owner already knows how to diagnose retired core keys, so it can return those findings before importing executable plugin diagnostics. Doctor still discovers and applies the complete core and plugin migration set. The existing repair-hint policy is shared across human and JSON output, preserving the separate advice for read failures and broken plugin packaging.

Evidence

  • The original regression fails on base 36b28bb0f51d9006bae3baafa47959b3332e3c8a: known core errors invoke Doctor plugin diagnostics once instead of zero. Prepared real CLI tests verify both commands, exit 1, the invalid key, the recovery hint, unchanged config bytes, and no created state. The minimal fixture did not reproduce the indefinite 30-second stall; it proves removal of the unnecessary plugin-discovery path.
  • CI repair: both reported JSON consumers failed on Node before this follow-up. They now retain their exact previous error.message assertions and additionally require repairHint. The real CLI regression requires the same additive contract. Human diagnostics and output ordering remain covered.
  • Pinned Bun: all 33 tests passed across config-guard.test.ts, config-validation.json.test.ts, config-cli.legacy.process.test.ts, and config-read-failure.test.ts (55.44s wrapper; CLI shard 42.71s, 79% transform).
  • Production type failure is inherited from main. Clean origin/main at 37e60afc6d2ffb3dab5dee16a52f2aae2554d4ab fails pnpm tsgo:prod; its core CI graph produces the same 810 diagnostics as check-prod-types, including control-ui-components.ts/HTMLElement. a2332caed768dab02dfa6586b478c8f89b819535 added src/gateway/chat-display-replay.test-support.ts, which is included by core's src/**/* and imports Control UI. The PR branch passes the production graphs, the CI graph command, and fresh core checks with both available compilers. No type boundary was weakened.
  • Exact CI graph command: OPENCLAW_CI_STATIC_EVIDENCE=1 node scripts/run-tsgo-core-test-shards.mjs --ci-graphs-json '["core","ui","extensions"]'. Branch exit 0; clean main exit 2. After normalizing checkout paths, all 810 core diagnostics match exactly.
  • Normal pnpm dev live proof was refused by the existing artifact-publication/offline-state guard; it was not bypassed. The supported prepared CLI process harness supplied isolated real-command proof.
  • Full check:changed/SQLite inventory remains omitted under the campaign's local gate budget. PR CI supplies broad proof; the inherited main type failure above remains visible.
  • Final scope: production +34/-23 (net +11); tests +108/-14 (net +94); docs +2. No schema, dependency, option, or migration changes.
  • The wider Node replay exposed a fixture-only portability bug in cli-config-lifetime.test.ts: CommonJS exports in provider-policy-api.js inherits this checkout's ESM package scope. The fixture now uses ESM syntax, preserving all assertions and making Node and Bun exercise the same provider-policy contract. No loader or production plugin behavior changed.
  • Scoped config/CLI and commands test types, production types, oxlint, oxfmt, git diff --check, and madge (zero cycles) passed. Independent Codex review found no actionable findings.
  • Node consumer replay: 447 passed, one existing skip, and two failures confined to the CommonJS fixture above. After the fixture correction, all six tests in that file passed on Node and Bun. Across the 29 selected Node files, that verifies 449 distinct passing cases plus the existing skip. All requested JSON consumers and the real legacy CLI cases passed on both runtimes. The other 28 passing Node files were reused without another broad run.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 20, 2026 08:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T09:14:28.457564Z 3eb66b3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: S labels Oct 20, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 126283587d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli/config-validation-output.ts Outdated
writeRuntimeJson(runtime, {
...formatCliJsonFailure(`${configFailureHeading(snapshot)}: ${shortenHomePath(snapshot.path)}`),
...formatCliJsonFailure(
`${configFailureHeading(snapshot)}: ${shortenHomePath(snapshot.path)}\n${formatInvalidConfigRepairHint(snapshot, "to repair, then retry.")}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve caller-specific recovery policy in JSON errors

This helper is also called by the root config guard, not only by config get and config validate. For machine-output commands such as onboard --json, that guard deliberately sets suppressDoctorStdout, and for OPENCLAW_CONFIG_READONLY=1/Nix it selects external-deployment guidance; this unconditional formatter instead places openclaw doctor --fix in the JSON error even though repair was suppressed or cannot modify the immutable file. Keep the generic writer neutral or let these callers supply the applicable recovery hint.

AGENTS.md reference: AGENTS.md:L75-L75

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR reports retired core settings before plugin migration diagnostics and adds repair guidance to JSON configuration errors.

Example: Run openclaw config validate --json with skills.workshop.approvalPolicy set to pending.

  • Before: Invalid-config diagnosis enters plugin migration diagnostics, and the JSON error omits the repair hint.
  • After: Core legacy findings return first, and the JSON error recommends openclaw doctor --fix.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The supplied process regressions support the focused diagnosis change, but caller-specific recovery policy is broken and CI confirms affected consumer expectations were not preserved.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied verification consists of prepared built-CLI process regressions for retired-key JSON output and read-only behavior, with the original plugin-heavy stall explicitly unreproduced.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Config commands can wait for unnecessary plugin diagnostics before identifying a retired setting, then omit the repair command from JSON errors.
Reason: The maintainer-authored direction provides useful, focused diagnostics; the PR correctly uses Related-style linkage rather than claiming to resolve the entire upgrade incident.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep open: this PR addresses a concrete diagnostic problem, but its shared JSON formatter introduces misleading recovery advice for externally managed configuration.

Priority: P2
Reviewed head: 126283587d1fb5076d41c1d2309ad1fd876d6901

Before merge

  • Preserve deployment-specific recovery guidance in JSON failures (P2) - With OPENCLAW_CONFIG_READONLY=1 or OPENCLAW_NIX_MODE=1 and invalid config, a JSON command rejected by ensureConfigReady now receives Run openclaw doctor --fix from this unconditional formatter. The guard already selects external-source editing or Nix rebuild guidance, and config-write-guard explicitly forbids local repair in these modes. JSON consumers therefore receive a recovery command that cannot repair their installation. Keep this renderer neutral by default and pass an applicable hint from config commands, or carry the guard's selected recovery guidance into the JSON output.
  • Explain or restore the original intent of Shared JSON renderer recovery policy - 980aa82: fix(cli): emit JSON when command configuration validation fails #145768 deliberately shared rendering while retaining caller-owned recovery policy; this PR explains adding hints but does not justify replacing immutable-deployment guidance.

Findings

  • [P2] Preserve deployment-specific recovery guidance in JSON failures — src/cli/config-validation-output.ts:18-19

Provenance

Agent review details

How this fits together

Configuration snapshots feed CLI admission and config commands; validation findings become human diagnostics or JSON failures, while Doctor owns repairs.

flowchart TD
  A[Config file] --> B[Snapshot validation]
  B --> C[Core legacy findings]
  B --> D[Plugin legacy diagnostics]
  C --> E[CLI error rendering]
  D --> E
  E --> F[Human or JSON output]
  F --> G[Doctor repair]
Loading

Technical review

Best possible solution:

Keep the core-first diagnosis, leave the shared JSON writer neutral by default, and let config commands supply the applicable repair hint.

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

Current-main source confirms plugin diagnostic discovery before returning core legacy findings and missing JSON repair guidance; the reported prolonged stall remains unproven, and no target code was run during this review.

Is this the best way to solve the issue?

The early return uses the existing core rules and preserves Doctor ownership, but adding caller-independent recovery policy to the shared renderer is broader than necessary.

Full review comments:

  • [P2] Preserve deployment-specific recovery guidance in JSON failures — src/cli/config-validation-output.ts:18-19
    With OPENCLAW_CONFIG_READONLY=1 or OPENCLAW_NIX_MODE=1 and invalid config, a JSON command rejected by ensureConfigReady now receives Run openclaw doctor --fix from this unconditional formatter. The guard already selects external-source editing or Nix rebuild guidance, and config-write-guard explicitly forbids local repair in these modes. JSON consumers therefore receive a recovery command that cannot repair their installation. Keep this renderer neutral by default and pass an applicable hint from config commands, or carry the guard's selected recovery guidance into the JSON output.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Invalid snapshot legacy collection changes intended behavior with a stated reason (290836c: The config I/O split preserved existing snapshot behavior; the PR now explains why known core findings should precede executable plugin diagnostics.)
  • Read-failure and plugin-packaging hint selection keeps the original intent (fac6042: Read failures must retain their cause without suggesting configuration mutation; the relocated helper preserves that distinction.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/cli/program/config-guard.test.ts src/commands/config-validation.json.test.ts src/cli/config-read-failure.test.ts --maxWorkers=1
  • pnpm test src/cli/config-cli.test.ts src/cli/config-cli.legacy.process.test.ts src/config/io.snapshot.test.ts --maxWorkers=1
  • git diff --check

What I checked:

  • Pinned change and current main: The introduced diff adds the core-first return and unconditional JSON repair hint; fetched main retains the previous implementations. (src/config/io.snapshot-shared.ts:90, 126283587d1f)
  • Caller-specific immutable-config guidance: The root guard selects external-deployment guidance through createConfigMutationError, then calls the changed JSON writer without passing that policy; its JSON output now recommends a repair forbidden by the immutable-config contract. (src/cli/program/config-guard.ts:280, 126283587d1f)
  • Existing review independently checked: The immutable-config concern in fix(config): return actionable errors for retired settings #178289 (comment) is supported by source. Its suppressDoctorStdout argument is narrower than stated: the existing guard already prints a Doctor hint while suppressing interactive recovery. (src/cli/config-validation-output.ts:19, 126283587d1f)
  • Diff-caused consumer test failures: CI annotations show exact-message failures at src/cli/program/config-guard.test.ts:387 and src/commands/config-validation.json.test.ts:96 caused by the appended hint. Keeping the generic writer neutral would preserve those existing consumer expectations. (src/cli/config-validation-output.ts:19, 126283587d1f)
  • Unattributed type-check failure: check-prod-types failed, but its annotation contains only exit code 2. Reading the job log was blocked at GitHub's redirected storage host, so no source cause or contributor responsibility is established. (126283587d1f)
  • Focused scope and supplied verification: The complete PR body reports base failures and passing prepared CLI regressions for both commands, unchanged config bytes, and no created state; it explicitly says the original prolonged stall was not reproduced. Doctor's addDoctorLegacyIssues still collects complete core and plugin findings. (src/cli/config-cli.legacy.process.test.ts:29, 126283587d1f)

Likely related people:

  • Peter Steinberger: Raw commit 290836c adds src/config/io.snapshot-shared.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 290836cafd2c; files: src/config/io.snapshot-shared.ts)
  • Jason (Json): Raw commit fac6042 adds src/cli/config-validation-output.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fac60421d454; files: src/cli/config-validation-output.ts)
  • Alix-007: Raw commit 980aa82 adds src/cli/config-validation-output.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 980aa822b161; files: src/cli/config-validation-output.ts)

PR surface

Source +13, Tests +91, Docs +2. Total +106 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 38 25 +13
Tests 2 104 13 +91
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 144 38 +106

Labels

Label changes:

  • add P2: The focused diagnostic improvement has clear value, while the introduced defect gives immutable-config users an unusable recovery command without changing their data.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The focused diagnostic improvement has clear value, while the introduced defect gives immutable-config users an unusable recovery command without changing their data.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 20, 2026, 5:07 AM ET / 09:07 UTC.

Keep the existing error.message contract and expose recovery guidance in repairHint. Use an ESM provider-policy fixture so isolated Node and Bun consumer tests exercise the same contract.
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Oct 20, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Landing despite one red job: check-prod-types. It fails with the same DOM-name diagnostics that main has been red on since a2332ca (fix in #178306). This PR's own production types pass (verified against clean main), and every other check is green.

@steipete
steipete merged commit eeb9d14 into main Oct 20, 2026
125 of 130 checks passed
@steipete
steipete deleted the upd/upd-l1714 branch October 20, 2026 09:24
roboclaw-bot added a commit that referenced this pull request Oct 20, 2026
Match the repairHint added by main in #178289 while preserving exact JSON equality, refusal before node mutation, and the unopened-state assertion.

Co-authored-by: VACInc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…penclaw#178289)

Refs openclaw#178177. With a removed legacy key such as skills.workshop.approvalPolicy, openclaw config validate --json and config get printed nothing and hung 30s+. The config snapshot owner now reports known legacy keys before loading plugin diagnostics; JSON failures keep error.message and add repairHint with the openclaw doctor --fix hint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant