fix(controller): seed config writer cache from disk on cold start#349
Merged
fix(controller): seed config writer cache from disk on cold start#349
Conversation
On process restart, lastWrittenContent is null, causing the first write() to always hit disk even if the config file already has identical content. This triggers an unnecessary OpenClaw reload on every controller restart. Read the existing file to seed the in-memory cache on the first write() call, so cold starts skip the write when content matches.
Contributor
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. Reviewed: empty catch block scope, sentinel reset behavior, documentation maintenance obligations, test coverage changes, mtime-based test assertions, and watchTrigger interaction. All issues scored below confidence threshold (highest was 75/100 for the bare catch block and docs — both borderline and unlikely to cause real problems in practice). 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Contributor
Author
|
/cr |
|
✅ CR topic created in Feishu topic group Refly CR. |
lefarcen
approved these changes
Mar 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastWrittenContentisnull, so the firstwrite()always writes to disk even if the file already has identical contentwrite()callTest plan
openclaw_config_write_skipped_unchangedshould appear)🤖 Generated with Claude Code