openclaw - 💡(How to fix) Fix config.patch rejects compaction.model, customInstructions, postCompactionSections despite schema advertising them [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#60512Fetched 2026-04-08 02:50:09
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

config.patch (and the underlying config validator) rejects agents.defaults.compaction.model, agents.defaults.compaction.customInstructions, and agents.defaults.compaction.postCompactionSections as "Unrecognized key" — even though:

  1. config.schema.lookup returns full schema entries with type, hint label, and help text for all three
  2. The runtime schema file (dist/runtime-schema-*.js) defines all three keys
  3. The configuration reference docs documents all three with examples
  4. The 2026.4.2 changelog explicitly mentions compaction.model resolution (#56710)

Error Message

openclaw --version

OpenClaw 2026.4.2 (d74a122)

Schema says it's valid:

openclaw config schema --path agents.defaults.compaction.model

Returns: { type: "string", hint: { label: "Compaction Model Override", ... } }

But config.patch rejects it:

config.patch path=agents.defaults.compaction raw={"model":"anthropic/claude-sonnet-4-6"}

Error: invalid config: <root>: Unrecognized key: "model"

Root Cause

Root Cause (suspected)

Fix Action

Workaround

Direct file edit of openclaw.json + SIGUSR1 restart. The gateway loads and uses the keys correctly — it's only the write-time validator that rejects them.

Code Example

openclaw --version
# OpenClaw 2026.4.2 (d74a122)

# Schema says it's valid:
openclaw config schema --path agents.defaults.compaction.model
# Returns: { type: "string", hint: { label: "Compaction Model Override", ... } }

# But config.patch rejects it:
# config.patch path=agents.defaults.compaction raw={"model":"anthropic/claude-sonnet-4-6"}
# Error: invalid config: <root>: Unrecognized key: "model"
RAW_BUFFERClick to expand / collapse

Summary

config.patch (and the underlying config validator) rejects agents.defaults.compaction.model, agents.defaults.compaction.customInstructions, and agents.defaults.compaction.postCompactionSections as "Unrecognized key" — even though:

  1. config.schema.lookup returns full schema entries with type, hint label, and help text for all three
  2. The runtime schema file (dist/runtime-schema-*.js) defines all three keys
  3. The configuration reference docs documents all three with examples
  4. The 2026.4.2 changelog explicitly mentions compaction.model resolution (#56710)

Reproduction

openclaw --version
# OpenClaw 2026.4.2 (d74a122)

# Schema says it's valid:
openclaw config schema --path agents.defaults.compaction.model
# Returns: { type: "string", hint: { label: "Compaction Model Override", ... } }

# But config.patch rejects it:
# config.patch path=agents.defaults.compaction raw={"model":"anthropic/claude-sonnet-4-6"}
# Error: invalid config: <root>: Unrecognized key: "model"

Same rejection for customInstructions and postCompactionSections.

Root Cause (suspected)

The config validator likely uses a Zod/JSON-Schema with additionalProperties: false on the compaction object, and the newer keys were added to the hint registry and runtime schema but not to the validator's allowlist.

Workaround

Direct file edit of openclaw.json + SIGUSR1 restart. The gateway loads and uses the keys correctly — it's only the write-time validator that rejects them.

Environment

  • OpenClaw 2026.4.2 (d74a122)
  • macOS Tahoe (arm64)
  • Node 25.8.2
  • Affects both config.patch tool and presumably openclaw config set CLI

extent analysis

TL;DR

The config validator likely needs an update to include the new compaction keys in its allowlist, but a temporary workaround is to edit the openclaw.json file directly and restart the service with SIGUSR1.

Guidance

  • Verify that the openclaw.json file can be edited directly without issues by checking the file's permissions and ownership.
  • Use the openclaw config schema command to ensure the schema definitions for the new compaction keys are correct and match the documentation.
  • Consider filing an issue or pull request to update the config validator's allowlist to include the new keys.
  • Test the workaround by editing the openclaw.json file, restarting the service, and verifying that the new keys are accepted.

Example

No code snippet is provided as it is not necessary for this issue, but an example of the direct file edit could be adding the following to the openclaw.json file:

{
  "agents": {
    "defaults": {
      "compaction": {
        "model": "anthropic/claude-sonnet-4-6",
        "customInstructions": "...",
        "postCompactionSections": "..."
      }
    }
  }
}

Notes

This workaround may not be suitable for production environments or large-scale deployments, and a permanent fix should be prioritized.

Recommendation

Apply the workaround by editing the openclaw.json file directly and restarting the service, as it allows for temporary use of the new compaction keys until a permanent fix is available.

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…

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 - 💡(How to fix) Fix config.patch rejects compaction.model, customInstructions, postCompactionSections despite schema advertising them [1 participants]