← Back to PRs

#22501: fix(doctor): preserve logging config in doctor --fix

by Shuai-DaiDai open 2026-02-21 07:21 View on GitHub →
commands size: XS
Fixes #19432 The `openclaw doctor --fix` command was incorrectly removing the valid `logging` configuration section from `openclaw.json`, treating it as an "unknown config key". ## Changes - Added `preservedKeys` set in `stripUnknownConfigKeys()` function - Known valid config keys (like `logging`) are now preserved during the fix process ## Testing 1. Add logging config to openclaw.json: ```json "logging": { "file": "/path/to/gateway.log", "redactSensitive": "tools" } ``` 2. Run `openclaw doctor --fix` 3. Verify logging section is preserved --- This is my first contribution to OpenClaw. Please let me know if any adjustments are needed! <!-- greptile_comment --> <h3>Greptile Summary</h3> Added a `preservedKeys` set to prevent `openclaw doctor --fix` from removing the valid `logging` configuration section. The fix ensures that known valid config keys like `logging` are preserved during the config repair process, preventing data loss during doctor operations. <h3>Confidence Score: 4/5</h3> - Safe to merge with minor consideration about hardcoded approach - The fix correctly addresses the reported issue by preserving the `logging` config key. However, the hardcoded `preservedKeys` set approach may need expansion if other valid config keys face the same issue in the future. The `logging` key is confirmed to be valid in the OpenClawSchema (zod-schema.ts:160-192), so this fix is functionally correct. - No files require special attention <sub>Last reviewed commit: e601c6b</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs