Open
Conversation
Contributor
Author
补充说明一下问题的原因
|
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.
📑 Description
This PR fixes repeated outbound replies observed in Telegram when heartbeat or tool-call loops occur.
Two targeted safeguards are included:
messagetool sends within the same processing round (samechannel + chat_id + content), evenif the LLM repeatedly calls the same tool.
Additionally, this PR fixes a state-reset issue: the
messagetool dedup state was previously reset on everySetContextcall, which made same-round dedup ineffective.🛠️ Type of Change
🤖 AI Code Generation
🔆 Related Issue
N/A
📎 Technical Context (Skip for Docs)
Tool call: message({"content":"HEARTBEAT_OK"})across many iterations.messagetool dedup state was reset too frequently (SetContexton each tool execution), so duplicatesuppression in the same round did not hold.
Files changed
pkg/channels/telegram/telegram.gopkg/tools/message.goSetContextto explicitBeginRound().pkg/agent/loop.goBeginRound()once per inbound round before tool iterations.pkg/tools/message_test.goFollow-up suggestion (not in this PR)
messagetool-calls:ALWAYS use tools(pkg/agent/context.go)HEARTBEAT_OKwhen no action needed (pkg/heartbeat/service.go)HEARTBEAT_OKis treated as an internalcompletion signal instead of a tool-send objective.
🧪 Test Environment
📳 Evidence (Optional)
Click to view Logs/Screenshots
LLM requested tool calls ... tools=[message]Tool call: message({"content":"HEARTBEAT_OK"})go test ./pkg/tools -run MessageTool✅go test ./pkg/agent✅go test ./pkg/channels/telegram ./pkg/channels/slack ./pkg/channels/discord ./pkg/channels/line✅ (where testfiles exist)
☑️ Checklist