openclaw - ✅(Solved) Fix [Bug]: 2026.4.24 schema validator rejects `agents.defaults.agentRuntime` from prior 4.x configs; gates ALL CLI commands including `doctor --fix` [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#72872Fetched 2026-04-28 06:31:08
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
commented ×1cross-referenced ×1mentioned ×1referenced ×1

After upgrading from an earlier 2026.4.x release to 2026.4.24 via npm, every openclaw <subcmd> invocation fails with a config-validation error before the subcommand runs. The validator rejects agents.defaults.agentRuntime, a key whose shape didn't change but apparently isn't in the 2026.4.24 schema. There's no auto-migration; openclaw doctor --fix is also blocked because the validator gates it.

This is the same class as #70407 (dreaming.storage) and #60334 (agents.list[*].allowedModels / tools.exec.allowlist) — different field, same shape: schema diff between minor releases without a migration path on a hot path that gates all CLI commands.

Error Message

After upgrading from an earlier 2026.4.x release to 2026.4.24 via npm, every openclaw <subcmd> invocation fails with a config-validation error before the subcommand runs. The validator rejects agents.defaults.agentRuntime, a key whose shape didn't change but apparently isn't in the 2026.4.24 schema. There's no auto-migration; openclaw doctor --fix is also blocked because the validator gates it.

  • Surface a clear hint in the error: "agents.defaults.agentRuntime was renamed to <X> in 2026.4.24; run openclaw doctor --fix to migrate" — and have doctor --fix exempt itself from the validator gate so it can actually do the migration, OR
  • Fail soft on legacy keys at validation time (warn-and-continue) and only hard-fail on keys that affect runtime semantics this release. Manually edit ~/.openclaw/openclaw.json and remove the agentRuntime block from agents.defaults. After that, the CLI works again — but the operator has to know to do this, the error message doesn't say which key to remove vs. which key to migrate, and the recovery requires a JSON editor rather than the tool the error message points at.

Root Cause

After upgrading from an earlier 2026.4.x release to 2026.4.24 via npm, every openclaw <subcmd> invocation fails with a config-validation error before the subcommand runs. The validator rejects agents.defaults.agentRuntime, a key whose shape didn't change but apparently isn't in the 2026.4.24 schema. There's no auto-migration; openclaw doctor --fix is also blocked because the validator gates it.

Fix Action

Workaround

Manually edit ~/.openclaw/openclaw.json and remove the agentRuntime block from agents.defaults. After that, the CLI works again — but the operator has to know to do this, the error message doesn't say which key to remove vs. which key to migrate, and the recovery requires a JSON editor rather than the tool the error message points at.

PR fix notes

PR #73257: fix(config): guard legacy agentRuntime regression

Description (problem / solution / changelog)

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: users upgrading to 2026.4.24 reported Config invalid on agents.defaults.agentRuntime, which could block CLI workflows including the suggested doctor --fix recovery path.
  • Why it matters: config-schema regressions on startup paths can turn minor upgrades into CLI outages and break operational recovery.
  • What changed: added targeted regression tests to lock two guarantees — agents.defaults.agentRuntime is accepted by schema validation, and config guard allowlisted commands (including doctor fix) do not hard-exit on invalid snapshots while still surfacing diagnostics.
  • What did NOT change (scope boundary): no runtime config parser behavior was changed in this PR; this is guardrail coverage only.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #72872
  • Related #70407
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: a prior release path reportedly rejected a legacy/expected config key during startup validation, and that class of regression can evade detection when coverage does not assert both schema acceptance and allowlisted command behavior.
  • Missing detection / guardrail: no focused regression tests were locking agents.defaults.agentRuntime acceptance + doctor fix allowlist behavior in the config guard test path.
  • Contributing context (if known): repeated regressions in neighboring config keys show this startup validation surface is high-impact and needs explicit test locks.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • src/config/zod-schema.agent-defaults.test.ts
    • src/cli/program/config-guard.test.ts
  • Scenario the test should lock in:
    • schema accepts agents.defaults.agentRuntime values
    • invalid snapshot mentioning Unrecognized key: "agentRuntime" does not hard-exit allowlisted commands, including doctor fix, while still printing diagnostics.
  • Why this is the smallest reliable guardrail: both checks run in fast unit suites and directly cover the two failure surfaces (schema acceptance and startup guard behavior) without introducing broader integration harness cost.
  • Existing test that already covers this (if any): existing config-guard allowlist tests partially covered non-exit behavior; this PR adds the agentRuntime-specific assertion.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

None (test-only guardrail additions).

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: Linux (dev harness)
  • Runtime/container: local Node + pnpm worktree
  • Model/provider: N/A
  • Integration/channel (if any): N/A
  • Relevant config (redacted): synthetic invalid snapshot in test (agents.defaultsUnrecognized key: "agentRuntime")

Steps

  1. Run pnpm test -- src/config/zod-schema.agent-defaults.test.ts src/cli/program/config-guard.test.ts
  2. Run pnpm check:changed
  3. Confirm both pass with updated assertions.

Expected

  • Schema test accepts agents.defaults.agentRuntime.
  • Config-guard allowlist test verifies doctor fix does not hard-exit and still emits key diagnostics.

Actual

  • Both expectations pass.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    • targeted tests pass for schema + config guard paths
    • pnpm check:changed passes after updates
  • Edge cases checked:
    • allowlisted command path includes explicit doctor fix check for non-exit
  • What you did not verify:
    • full cross-version upgrade flow on affected macOS host
    • packaged npm global install reproduction end-to-end

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: this PR is test-only; if runtime behavior regresses in a new path, these tests may not catch every variant.
    • Mitigation: tests target the two highest-signal contracts for this incident class (schema acceptance + config-guard allowlist behavior), and can be extended if new repro details emerge.

Changed files

  • src/cli/program/config-guard.test.ts (modified, +11/-3)
  • src/config/zod-schema.agent-defaults.test.ts (modified, +11/-0)

Code Example

"agents": {
     "defaults": {
       "model": "anthropic/claude-opus-4-7",
       "models": { /* ... */ },
       "compaction": { "mode": "safeguard" },
       "maxConcurrent": 4,
       "subagents": { "maxConcurrent": 8 },
       "agentRuntime": { "id": "claude-cli" }
     }
   }

---

$ openclaw plugins list
   Config invalid
   File: ~/.openclaw/openclaw.json
   Problem:
     - agents.defaults: Unrecognized key: "agentRuntime"

   Run: openclaw doctor --fix

---

$ openclaw doctor --fix
   Config invalid
   File: ~/.openclaw/openclaw.json
   Problem:
     - agents.defaults: Unrecognized key: "agentRuntime"

   Run: openclaw doctor --fix
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails) — config schema rejects a key the prior release wrote.

Summary

After upgrading from an earlier 2026.4.x release to 2026.4.24 via npm, every openclaw <subcmd> invocation fails with a config-validation error before the subcommand runs. The validator rejects agents.defaults.agentRuntime, a key whose shape didn't change but apparently isn't in the 2026.4.24 schema. There's no auto-migration; openclaw doctor --fix is also blocked because the validator gates it.

This is the same class as #70407 (dreaming.storage) and #60334 (agents.list[*].allowedModels / tools.exec.allowlist) — different field, same shape: schema diff between minor releases without a migration path on a hot path that gates all CLI commands.

Steps to reproduce

  1. Have a working OpenClaw 2026.4.x install (this Mac was working on 2026.4.20 → 2026.4.23 over the past month) with agents.defaults.agentRuntime written to openclaw.json. The block looks like:

    "agents": {
      "defaults": {
        "model": "anthropic/claude-opus-4-7",
        "models": { /* ... */ },
        "compaction": { "mode": "safeguard" },
        "maxConcurrent": 4,
        "subagents": { "maxConcurrent": 8 },
        "agentRuntime": { "id": "claude-cli" }
      }
    }
  2. npm install -g openclaw@latest (lands on 2026.4.24).

  3. Run any CLI subcommand:

    $ openclaw plugins list
    Config invalid
    File: ~/.openclaw/openclaw.json
    Problem:
      - agents.defaults: Unrecognized key: "agentRuntime"
    
    Run: openclaw doctor --fix
  4. Run the suggested repair:

    $ openclaw doctor --fix
    Config invalid
    File: ~/.openclaw/openclaw.json
    Problem:
      - agents.defaults: Unrecognized key: "agentRuntime"
    
    Run: openclaw doctor --fix

    doctor --fix itself goes through the validator gate, so the suggested workaround is unreachable.

Actual behavior

  • openclaw plugins list / install / inspect, openclaw gateway status / restart, openclaw config get / set, openclaw doctor --fix — all exit with code 1 before doing anything.
  • The gateway daemon (already running, started under launchd before the upgrade) keeps serving — only the operator-facing CLI is broken.
  • Any plugin's diagnostic that shells out to openclaw <subcmd> (doctor scripts, install-local.sh, package install hooks) returns false negatives.

Expected behavior

  • Either auto-migrate / soft-strip unknown keys with a deprecation warning, OR
  • Surface a clear hint in the error: "agents.defaults.agentRuntime was renamed to <X> in 2026.4.24; run openclaw doctor --fix to migrate" — and have doctor --fix exempt itself from the validator gate so it can actually do the migration, OR
  • Fail soft on legacy keys at validation time (warn-and-continue) and only hard-fail on keys that affect runtime semantics this release.

The "validator runs before every CLI subcommand, including the repair tool" path is the load-bearing problem — it makes a tiny schema diff into a total CLI outage.

Workaround

Manually edit ~/.openclaw/openclaw.json and remove the agentRuntime block from agents.defaults. After that, the CLI works again — but the operator has to know to do this, the error message doesn't say which key to remove vs. which key to migrate, and the recovery requires a JSON editor rather than the tool the error message points at.

Environment

  • OS: macOS 25.3 (Darwin 25.3.0)
  • Node.js: v22 (via /opt/homebrew/opt/node@22)
  • OpenClaw: v2026.4.24 (installed via npm install -g openclaw@latest)
  • Channel: none (this install runs gateway + a plugin, no channel adapters)

Suggested fix

Two interlocking changes:

  1. Make the unknown-key gate soft. When the validator hits a legacy key in agents.defaults, emit a warning and continue — don't reject the entire config. Hard-rejecting legacy values (wrong types, invalid enums) makes sense; rejecting unknown keys on a frequently-extended namespace converts every minor schema diff into a CLI outage.
  2. Lift the validator off doctor --fix. The repair tool needs to be reachable when the config is already broken. Same applies to a future openclaw config strip-unknown style command.

Related

  • #70407 — same pattern in v2026.4.21, field dreaming.storage
  • #60334 — same pattern in v2026.4.2, fields agents.list[*].allowedModels / tools.exec.allowlist
  • #38249 — feature request for openclaw doctor --config-diff for upgrade-safe migration

Offer

Happy to send a PR if a maintainer can point at where the schema-validation gate lives. My read is loader-NucjcOgv.js is one entry-point, but a diff of the validator-call sites is what'd actually scope the fix. Won't open a PR without an ack on the direction since this touches a hot-path config invariant.

extent analysis

TL;DR

Manually editing the openclaw.json file to remove the agentRuntime block from agents.defaults is a temporary workaround to resolve the config-validation error.

Guidance

  • The issue is caused by a schema change in OpenClaw 2026.4.24 that rejects the agents.defaults.agentRuntime key, which was written by a prior release.
  • To mitigate the issue, manually remove the agentRuntime block from agents.defaults in ~/.openclaw/openclaw.json.
  • A long-term fix would involve making the unknown-key gate soft, allowing the validator to emit a warning and continue, rather than rejecting the entire config.
  • The doctor --fix command should be exempt from the validator gate to allow for migration and repair.

Example

No code snippet is provided as the issue is related to configuration and schema validation.

Notes

The provided workaround requires manual editing of the openclaw.json file, which may not be ideal. A more robust solution would involve updating the OpenClaw code to handle legacy keys and provide a clear migration path.

Recommendation

Apply the workaround by manually editing the openclaw.json file to remove the agentRuntime block, as this is the most straightforward way to resolve the issue in the short term. A more permanent fix would require changes to the OpenClaw codebase.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Either auto-migrate / soft-strip unknown keys with a deprecation warning, OR
  • Surface a clear hint in the error: "agents.defaults.agentRuntime was renamed to <X> in 2026.4.24; run openclaw doctor --fix to migrate" — and have doctor --fix exempt itself from the validator gate so it can actually do the migration, OR
  • Fail soft on legacy keys at validation time (warn-and-continue) and only hard-fail on keys that affect runtime semantics this release.

The "validator runs before every CLI subcommand, including the repair tool" path is the load-bearing problem — it makes a tiny schema diff into a total CLI outage.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: 2026.4.24 schema validator rejects `agents.defaults.agentRuntime` from prior 4.x configs; gates ALL CLI commands including `doctor --fix` [1 pull requests, 1 comments, 1 participants]