Skip to content

fix(controller): skip redundant config writes to break Feishu restart loop#347

Merged
alchemistklk merged 1 commit intomainfrom
fix/feishu-config-write-restart-loop
Mar 22, 2026
Merged

fix(controller): skip redundant config writes to break Feishu restart loop#347
alchemistklk merged 1 commit intomainfrom
fix/feishu-config-write-restart-loop

Conversation

@alchemistklk
Copy link
Copy Markdown
Contributor

@alchemistklk alchemistklk commented Mar 22, 2026

Relates to #377

Summary

  • Feishu channel stuck in "重启中..." (Restarting) due to an infinite config write β†’ OpenClaw restart β†’ WS reconnect β†’ syncAll() β†’ config write loop
  • Root cause: OpenClawConfigWriter.write() unconditionally wrote the config file on every syncAll() call, triggering OpenClaw's file watcher even when content was unchanged
  • Fix: keep last-written content in memory and skip the write when it matches, breaking the loop after one legitimate write

Test plan

  • New test: writes config on first call
  • New test: skips write when content unchanged (mtime stays same)
  • New test: writes when content actually changes
  • New test: writes again when content reverts to original
  • New test: skips repeated identical calls (restart loop scenario)
  • New test: separate writer instances don't share state
  • Manual: connect a Feishu channel and verify it stabilizes to "已连ζŽ₯" without restart loop

πŸ€– Generated with Claude Code

… loop

The config writer unconditionally wrote the config file on every syncAll()
call, even when content was unchanged. This triggered OpenClaw's file watcher,
causing a reload/restart cycle: restart β†’ WS reconnect β†’ syncAll() β†’ write β†’
watcher fires β†’ restart again. Feishu channels were most affected because
their WebSocket initialization is slower than other channels, so the snapshot
was never ready before the next restart.

Keep the last-written content in memory and skip the write when it matches,
breaking the loop after the first legitimate write.
@alchemistklk
Copy link
Copy Markdown
Contributor Author

/cr

@slack-code-review-channel
Copy link
Copy Markdown

βœ… CR topic created in Feishu topic group Refly CR.

@alchemistklk alchemistklk merged commit 1decf95 into main Mar 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants