fix: flush_memories history destruction, OpenClaw overwrite, set dedup, chat_id guard - #6687
Closed
aaronlab wants to merge 1 commit into
Closed
Conversation
…p, chat_id crash
1. run_agent.py: Remove premature messages.pop() in flush_memories when
memory_tool_def is None. The pop removed the sentinel before the
finally block ran, causing the while loop to strip ALL remaining
messages — destroying the entire conversation history. Let the
finally block handle sentinel cleanup as designed.
2. hermes_cli/setup.py: Change overwrite=True to overwrite=False in
OpenClaw migration. The comment says "no overwrite" but the code
contradicts it, silently overwriting existing Hermes configuration
with stale OpenClaw data on repeated setup wizard runs.
3. hermes_cli/model_switch.py: Remove duplicate "opencode-go" from the
set literal. The set {"opencode-zen", "opencode-go", "opencode",
"opencode-go"} contains "opencode-go" twice (copy-paste error).
4. tools/send_message_tool.py: Wrap int(chat_id) and int(thread_id) in
try/except to handle non-numeric values from channel name resolution
instead of letting ValueError propagate as a raw traceback.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Thanks for the thorough multi-part fix, @aaronlab — closing as redundant. All four changes are dead or already-fixed on current
Good catches on real issues — they just all got resolved independently in the weeks since you opened this. Appreciate the contribution. |
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
flush_memorieswheremessages.pop()removes the sentinel before thefinallyblock runs. Whenmemory_tool_defis None (no memory tool registered), thefinallywhile-loop fails to find the sentinel and keeps popping until the entiremessageslist is empty — destroying all conversation history. Fix: let thefinallyblock handle cleanup as designed.overwrite=True. This silently overwrites existing Hermes configuration with stale OpenClaw data when setup wizard is run again. Fix: align code with comment (overwrite=False)."opencode-go"entry from set literal on line 665 (copy-paste error).int(chat_id)andint(thread_id)in try/except to prevent unhandledValueErrorwhen Telegram channel name resolution returns non-numeric values (e.g.,"@channelname"format).Test plan
flush_memorieswith no memory tool registered does not corruptmessageslistswitch_modelwith all three OpenCode provider variants_send_telegramwith non-numeric chat_id returns clean error🤖 Generated with Claude Code