fix(channels): pass InboundContext to DismissToolFeedback for topic-aware keys
Telegram forum topics use scoped tracker keys like "chatID/topicID", resolved via ToolFeedbackMessageChatID with the InboundContext. The previous nil context caused the lookup to fall back to the raw chatID, missing the topic-scoped entry and leaving the animation goroutine orphaned in forum-topic conversations. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
937ed67b04
commit
380f28b25f
4 changed files with 10 additions and 6 deletions
|
|
@ -44,6 +44,6 @@ func (a *channelManagerAdapter) SendPlaceholder(ctx context.Context, channel, ch
|
|||
return a.inner.SendPlaceholder(ctx, channel, chatID)
|
||||
}
|
||||
|
||||
func (a *channelManagerAdapter) DismissToolFeedback(ctx context.Context, channel, chatID string) {
|
||||
a.inner.DismissToolFeedback(ctx, channel, chatID)
|
||||
func (a *channelManagerAdapter) DismissToolFeedback(ctx context.Context, channel, chatID string, outboundCtx *bus.InboundContext) {
|
||||
a.inner.DismissToolFeedback(ctx, channel, chatID, outboundCtx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,5 +48,7 @@ type ChannelManager interface {
|
|||
// DismissToolFeedback clears any tracked tool feedback animation for the
|
||||
// given channel/chat. Call this when a turn ends without a final response
|
||||
// (e.g., ResponseHandled tools) to avoid orphaned animation goroutines.
|
||||
DismissToolFeedback(ctx context.Context, channel, chatID string)
|
||||
// outboundCtx carries topic/thread info needed for channels that use
|
||||
// scoped tracker keys (e.g., Telegram forum topics); may be nil.
|
||||
DismissToolFeedback(ctx context.Context, channel, chatID string, outboundCtx *bus.InboundContext)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -705,7 +705,7 @@ toolLoop:
|
|||
ts.setPhase(TurnPhaseCompleted)
|
||||
ts.setFinalContent("")
|
||||
if al.channelManager != nil && ts.channel != "" {
|
||||
al.channelManager.DismissToolFeedback(ctx, ts.channel, ts.chatID)
|
||||
al.channelManager.DismissToolFeedback(ctx, ts.channel, ts.chatID, ts.opts.InboundContext)
|
||||
}
|
||||
logger.InfoCF("agent", "Tool output satisfied delivery; ending turn without follow-up LLM",
|
||||
map[string]any{
|
||||
|
|
|
|||
|
|
@ -195,12 +195,14 @@ func clearTrackedToolFeedbackMessage(
|
|||
// DismissToolFeedback clears any tracked tool feedback animation for the
|
||||
// given channel/chat. This is called when a turn ends without a final
|
||||
// response (e.g., ResponseHandled tools) to stop orphaned animation goroutines.
|
||||
func (m *Manager) DismissToolFeedback(ctx context.Context, channelName, chatID string) {
|
||||
// outboundCtx carries topic/thread info for channels that use scoped tracker
|
||||
// keys (e.g., Telegram forum topics); may be nil for non-topic channels.
|
||||
func (m *Manager) DismissToolFeedback(ctx context.Context, channelName, chatID string, outboundCtx *bus.InboundContext) {
|
||||
ch, ok := m.GetChannel(channelName)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
dismissTrackedToolFeedbackMessage(ctx, ch, chatID, nil)
|
||||
dismissTrackedToolFeedbackMessage(ctx, ch, chatID, outboundCtx)
|
||||
}
|
||||
|
||||
func prepareToolFeedbackMessageContent(ch Channel, content string) string {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue