openclaw - 💡(How to fix) Fix config.patch on agents.defaults.model.primary triggers gateway restart despite hot-reload docs [1 comments, 2 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#74975Fetched 2026-05-01 05:39:23
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
closed ×1commented ×1

config.patch for agents.defaults.model.primary should be hot-applied without restarting the gateway, according to the configuration reload docs. In practice, patching only this path through the gateway API causes the gateway reload watcher to diff unrelated runtime/materialized fields (plugins.entries.*.config, plugins.entries.memory-core, commands, messages) and then restart the gateway.

This was reproduced without OpenClaw Console in the path. The request was made directly with openclaw gateway call config.patch; gateway logs show actor=cli, not a console client.

Docs reference: https://docs.openclaw.ai/zh-CN/gateway/configuration#%E5%93%AA%E4%BA%9B%E4%BC%9A%E7%83%AD%E5%BA%94%E7%94%A8%EF%BC%8C%E5%93%AA%E4%BA%9B%E9%9C%80%E8%A6%81%E9%87%8D%E5%90%AF

Error Message

Gateway call failed: Error: gateway closed (1012): service restart Gateway target: ws://127.0.0.1:18789 Source: local loopback Config: /Users/nle/.openclaw/openclaw.json Bind: loopback

Root Cause

config.patch for agents.defaults.model.primary should be hot-applied without restarting the gateway, according to the configuration reload docs. In practice, patching only this path through the gateway API causes the gateway reload watcher to diff unrelated runtime/materialized fields (plugins.entries.*.config, plugins.entries.memory-core, commands, messages) and then restart the gateway.

This was reproduced without OpenClaw Console in the path. The request was made directly with openclaw gateway call config.patch; gateway logs show actor=cli, not a console client.

Docs reference: https://docs.openclaw.ai/zh-CN/gateway/configuration#%E5%93%AA%E4%BA%9B%E4%BC%9A%E7%83%AD%E5%BA%94%E7%94%A8%EF%BC%8C%E5%93%AA%E4%BA%9B%E9%9C%80%E8%A6%81%E9%87%8D%E5%90%AF

Fix Action

Fix / Workaround

config.patch for agents.defaults.model.primary should be hot-applied without restarting the gateway, according to the configuration reload docs. In practice, patching only this path through the gateway API causes the gateway reload watcher to diff unrelated runtime/materialized fields (plugins.entries.*.config, plugins.entries.memory-core, commands, messages) and then restart the gateway.

This was reproduced without OpenClaw Console in the path. The request was made directly with openclaw gateway call config.patch; gateway logs show actor=cli, not a console client.

  1. Patch only the default model path:

Code Example

openclaw gateway status --json

---

openclaw gateway call config.get --params '{}' \
  | sed '1d' \
  | jq -r '.hash'

---

openclaw gateway call config.patch --params '{
  "raw":"{\"agents\":{\"defaults\":{\"model\":{\"primary\":\"openai/gpt-5.4\"}}}}",
  "baseHash":"<hash from config.get>"
}'

---

[gateway] config.patch write actor=cli ... changedPaths=agents.defaults.model.primary restartReason=config.patch

---

[reload] config change detected; evaluating reload (agents.defaults.model.primary, agents.defaults.maxConcurrent, agents.defaults.subagents, plugins.entries.deepseek.config, plugins.entries.openai.config, plugins.entries.memory-core, commands, messages)
[reload] config change requires gateway restart (plugins.entries.deepseek.config, plugins.entries.openai.config, plugins.entries.memory-core, commands)
[gateway] signal SIGUSR1 received
[gateway] received SIGUSR1; restarting

---

Gateway call failed: Error: gateway closed (1012): service restart
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /Users/nle/.openclaw/openclaw.json
Bind: loopback

---

{
  "source": "config-io",
  "event": "config.write",
  "argv": [
    "/opt/homebrew/Cellar/node/25.9.0_2/bin/node",
    "/opt/homebrew/lib/node_modules/openclaw/dist/index.js",
    "gateway",
    "--port",
    "18789"
  ],
  "result": "rename"
}
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug / config reload regression

Summary

config.patch for agents.defaults.model.primary should be hot-applied without restarting the gateway, according to the configuration reload docs. In practice, patching only this path through the gateway API causes the gateway reload watcher to diff unrelated runtime/materialized fields (plugins.entries.*.config, plugins.entries.memory-core, commands, messages) and then restart the gateway.

This was reproduced without OpenClaw Console in the path. The request was made directly with openclaw gateway call config.patch; gateway logs show actor=cli, not a console client.

Docs reference: https://docs.openclaw.ai/zh-CN/gateway/configuration#%E5%93%AA%E4%BA%9B%E4%BC%9A%E7%83%AD%E5%BA%94%E7%94%A8%EF%BC%8C%E5%93%AA%E4%BA%9B%E9%9C%80%E8%A6%81%E9%87%8D%E5%90%AF

Version / environment

  • OpenClaw: OpenClaw 2026.4.26 (be8c246)
  • Node: v25.9.0
  • OS: macOS 26.4.1
  • Gateway: local loopback on ws://127.0.0.1:18789

Reproduction

  1. Ensure the gateway is running and RPC is healthy:
openclaw gateway status --json
  1. Get the current config hash:
openclaw gateway call config.get --params '{}' \
  | sed '1d' \
  | jq -r '.hash'
  1. Patch only the default model path:
openclaw gateway call config.patch --params '{
  "raw":"{\"agents\":{\"defaults\":{\"model\":{\"primary\":\"openai/gpt-5.4\"}}}}",
  "baseHash":"<hash from config.get>"
}'

I also reproduced while restoring the value back to openai/gpt-5.5.

Expected behavior

Only agents.defaults.model.primary should be considered changed, and the gateway should hot-apply the model change without restarting.

Actual behavior

The direct config.patch handler initially computes the correct minimal changed path:

[gateway] config.patch write actor=cli ... changedPaths=agents.defaults.model.primary restartReason=config.patch

Immediately after the config file write, the reload watcher re-diffs and reports unrelated runtime/materialized paths:

[reload] config change detected; evaluating reload (agents.defaults.model.primary, agents.defaults.maxConcurrent, agents.defaults.subagents, plugins.entries.deepseek.config, plugins.entries.openai.config, plugins.entries.memory-core, commands, messages)
[reload] config change requires gateway restart (plugins.entries.deepseek.config, plugins.entries.openai.config, plugins.entries.memory-core, commands)
[gateway] signal SIGUSR1 received
[gateway] received SIGUSR1; restarting

When restoring the value, the CLI call itself observed the restart close:

Gateway call failed: Error: gateway closed (1012): service restart
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /Users/nle/.openclaw/openclaw.json
Bind: loopback

The config audit confirms the write was performed by the gateway process itself:

{
  "source": "config-io",
  "event": "config.write",
  "argv": [
    "/opt/homebrew/Cellar/node/25.9.0_2/bin/node",
    "/opt/homebrew/lib/node_modules/openclaw/dist/index.js",
    "gateway",
    "--port",
    "18789"
  ],
  "result": "rename"
}

Notes / suspected cause

This looks like the gateway config reload watcher is recomputing changed paths after the file write using a different compare shape than the config.patch handler. The direct patch diff is correct (agents.defaults.model.primary only), but the follow-up reload diff appears to include runtime/materialized fields such as plugin config, commands, and messages, which then forces a restart.

This is distinct from a client sending an oversized patch or full resolved config: the reproduction uses a minimal patch and goes directly through openclaw gateway call config.patch.

extent analysis

TL;DR

The gateway config reload watcher is likely using a different comparison method than the config.patch handler, causing unnecessary restarts when patching the agents.defaults.model.primary path.

Guidance

  • Verify that the config.patch handler is correctly computing the minimal changed path by checking the gateway logs for the changedPaths message.
  • Investigate the config reload watcher's comparison method to determine why it is including runtime/materialized fields in the diff.
  • Consider modifying the config reload watcher to use the same comparison method as the config.patch handler to ensure consistent behavior.
  • Test the patching process with different paths and values to see if the issue is specific to agents.defaults.model.primary or a more general problem.

Example

No code snippet is provided as the issue seems to be related to the internal workings of the OpenClaw gateway and its configuration reload mechanism.

Notes

The issue may be specific to the OpenClaw version (2026.4.26) or the Node version (v25.9.0) being used. Further investigation is needed to determine the root cause and develop a fix.

Recommendation

Apply a workaround by modifying the config reload watcher's comparison method to match the config.patch handler, if possible, to prevent unnecessary restarts.

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

Only agents.defaults.model.primary should be considered changed, and the gateway should hot-apply the model change without restarting.

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 on agents.defaults.model.primary triggers gateway restart despite hot-reload docs [1 comments, 2 participants]