bugfix: fix duplicate Telegram message sending#105
Conversation
Two issues caused duplicate messages to be sent to users: 1. System messages (from subagent): processSystemMessage set SendResponse:true, causing runAgentLoop to publish outbound. Then Run() also published outbound using the returned response string, resulting in two identical messages. Fix: processSystemMessage now returns empty string since runAgentLoop already handles the send. 2. Message tool double-send: When LLM called the "message" tool during processing, it published outbound immediately. Then Run() published the final response again. Fix: Track whether MessageTool sent a message in the current round (sentInRound flag, reset on each SetContext call). Run() checks HasSentInRound() before publishing to avoid duplicates.
|
please fix conflicts |
Merge upstream/main into bugfix/fix-duplicate-telegram-messages. Conflict resolutions: - pkg/agent/loop.go: Adopt upstream's processSystemMessage which removes runAgentLoop call entirely (subagents now communicate via message tool directly). Keep PR's HasSentInRound() check in Run() for normal message processing path. - pkg/tools/message.go: Merge both changes - keep sentInRound tracking from PR and adopt upstream's *ToolResult return type with Silent: true.
|
done |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
|
Thanks for your contribution! We are forming the PicoClaw Dev Group to accelerate the evolution of the project. Any developer with more than one merged PR is invited to join. Would you like to join the PicoClaw Dev Group? If so, please send an email to |
…elegram-messages bugfix: fix duplicate Telegram message sending
|
I want to understand the scenario in which you discovered this bug. In some cases, deduplication based solely on whether a tool has been called can lead to message loss. |
…m-messages bugfix: fix duplicate Telegram message sending
Summary
processSystemMessagesetSendResponse: truecausingrunAgentLoopto publish outbound, thenRun()also published outbound using the returned response stringmessagetool double-send: when LLM called the "message" tool during processing, it published outbound immediately, thenRun()published the final response againsentInRoundtracking toMessageToolsoRun()can skip duplicate publishingTest plan
go build ./...passesgo test ./...passes (existing integration test failures are unrelated — Claude CLI root restriction)messagetool still works correctly when called by LLM