You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cli/config.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -336,6 +336,34 @@ If dry-run fails:
336
336
-`Dry run note: skipped <n> exec SecretRef resolvability check(s)`: dry-run skipped exec refs; rerun with `--allow-exec` if you need exec resolvability validation.
337
337
- For batch mode, fix failing entries and rerun `--dry-run` before writing.
338
338
339
+
## Write safety
340
+
341
+
`openclaw config set` and other OpenClaw-owned config writers validate the full
342
+
post-change config before committing it to disk. If the new payload fails schema
343
+
validation or looks like a destructive clobber, the active config is left alone
344
+
and the rejected payload is saved beside it as `openclaw.json.rejected.*`.
345
+
346
+
Prefer CLI writes for small edits:
347
+
348
+
```bash
349
+
openclaw config set gateway.reload.mode hybrid --dry-run
350
+
openclaw config set gateway.reload.mode hybrid
351
+
openclaw config validate
352
+
```
353
+
354
+
If a write is rejected, inspect the saved payload and fix the full config shape:
355
+
356
+
```bash
357
+
CONFIG="$(openclaw config file)"
358
+
ls -lt "$CONFIG".rejected.*2>/dev/null | head
359
+
openclaw config validate
360
+
```
361
+
362
+
Direct editor writes are still allowed, but the running Gateway treats them as
363
+
untrusted until they validate. Invalid direct edits can be restored from the
364
+
last-known-good backup during startup or hot reload. See
Copy file name to clipboardExpand all lines: docs/help/faq.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1629,10 +1629,20 @@ for usage/billing and raise limits as needed.
1629
1629
`config.apply` replaces the **entire config**. If you send a partial object, everything
1630
1630
else is removed.
1631
1631
1632
+
Current OpenClaw protects many accidental clobbers:
1633
+
1634
+
- OpenClaw-owned config writes validate the full post-change config before writing.
1635
+
- Invalid or destructive OpenClaw-owned writes are rejected and saved as `openclaw.json.rejected.*`.
1636
+
- If a direct edit breaks startup or hot reload, the Gateway restores the last-known-good config and saves the rejected file as `openclaw.json.clobbered.*`.
1637
+
- The main agent receives a boot warning after recovery so it does not blindly write the bad config again.
1638
+
1632
1639
Recover:
1633
1640
1634
-
- Restore from backup (git or a copied `~/.openclaw/openclaw.json`).
1635
-
- If you have no backup, re-run `openclaw doctor` and reconfigure channels/models.
1641
+
- Check `openclaw logs --follow` for `Config auto-restored from last-known-good`, `Config write rejected:`, or `config reload restored last-known-good config`.
1642
+
- Inspect the newest `openclaw.json.clobbered.*` or `openclaw.json.rejected.*` beside the active config.
1643
+
- Keep the active restored config if it works, then copy only the intended keys back with `openclaw config set` or `config.patch`.
1644
+
- Run `openclaw config validate` and `openclaw doctor`.
1645
+
- If you have no last-known-good or rejected payload, restore from backup, or re-run `openclaw doctor` and reconfigure channels/models.
1636
1646
- If this was unexpected, file a bug and include your last known config or any backup.
1637
1647
- A local coding agent can often reconstruct a working config from logs or history.
1638
1648
@@ -1644,7 +1654,7 @@ for usage/billing and raise limits as needed.
1644
1654
- Use `config.patch` for partial RPC edits; keep `config.apply` for full-config replacement only.
1645
1655
- If you are using the owner-only `gateway` tool from an agent run, it will still reject writes to `tools.exec.ask` / `tools.exec.security` (including legacy `tools.bash.*` aliases that normalize to the same protected exec paths).
0 commit comments