Bug Description
When OpenClaw Gateway restarts (e.g., after system reboot), the configuration file ~/.openclaw/openclaw.json is being overwritten with a nearly empty file, causing complete loss of configuration.
Environment
- OS: Linux (Ubuntu/Debian based)
- Node: 24.x
- OpenClaw: v2026.3.7
Reproduction Steps
- Have a working OpenClaw configuration with ~470 lines (~11KB)
- Restart the system or restart OpenClaw Gateway
- After Gateway starts, check
~/.openclaw/openclaw.json
- The file is reduced to ~10 lines (~400 bytes)
- Gateway fails to start with error:
Gateway start blocked: set gateway.mode=local (current: unset)
Actual Behavior
The configuration file is completely wiped on Gateway restart. The audit log shows config size dropped from 11653 bytes to 421 bytes, with 28 configuration paths lost.
Impact
- Severity: Critical (P0)
- Gateway becomes non-functional after restart
- All configuration including channel credentials, API keys, cron jobs, agent settings are lost
Suggested Fix
- Add config integrity check before Gateway starts (verify key fields exist)
- Add pre-write backup (backup before any config modification)
- Add config operation logging (log read/merge/validate operations, not just write)
- Add config size change alert (>20% change should trigger warning)
Bug Description
When OpenClaw Gateway restarts (e.g., after system reboot), the configuration file
~/.openclaw/openclaw.jsonis being overwritten with a nearly empty file, causing complete loss of configuration.Environment
Reproduction Steps
~/.openclaw/openclaw.jsonGateway start blocked: set gateway.mode=local (current: unset)Actual Behavior
The configuration file is completely wiped on Gateway restart. The audit log shows config size dropped from 11653 bytes to 421 bytes, with 28 configuration paths lost.
Impact
Suggested Fix