Skip to content

fix(telegram): preserve topic context for final replies#2791

Open
bogdanovich wants to merge 2 commits intosipeed:mainfrom
bogdanovich:check/telegram-topic-final-response
Open

fix(telegram): preserve topic context for final replies#2791
bogdanovich wants to merge 2 commits intosipeed:mainfrom
bogdanovich:check/telegram-topic-final-response

Conversation

@bogdanovich
Copy link
Copy Markdown

Summary

Preserve the inbound message context when publishing normal final agent replies. This keeps Telegram forum topic metadata attached to the outbound message, so replies to topic messages are delivered back to the same topic instead of falling back to the default thread.

This is separate from the message tool path: explicit message tool sends can already carry their own context, but the regular final assistant response was still rebuilt with only channel and chat_id.

Changes

  • Add an internal final-response publisher that can receive the original inbound context.
  • Use it for synchronous final replies and steering final replies.
  • Keep the existing public PublishResponseIfNeeded wrapper for callers that do not have inbound context.
  • Add a regression test for Telegram topic final replies.

Validation

  • go test ./pkg/agent -run TestProcessMessageSync_PreservesInboundTopicOnFinalResponse -count=1
  • go test ./pkg/agent

@bogdanovich bogdanovich force-pushed the check/telegram-topic-final-response branch from 9ceb0c9 to 6c964e0 Compare May 8, 2026 06:11
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.

1 participant