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)
|
return a.inner.SendPlaceholder(ctx, channel, chatID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *channelManagerAdapter) DismissToolFeedback(ctx context.Context, channel, chatID string) {
|
func (a *channelManagerAdapter) DismissToolFeedback(ctx context.Context, channel, chatID string, outboundCtx *bus.InboundContext) {
|
||||||
a.inner.DismissToolFeedback(ctx, channel, chatID)
|
a.inner.DismissToolFeedback(ctx, channel, chatID, outboundCtx)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,5 +48,7 @@ type ChannelManager interface {
|
||||||
// DismissToolFeedback clears any tracked tool feedback animation for the
|
// DismissToolFeedback clears any tracked tool feedback animation for the
|
||||||
// given channel/chat. Call this when a turn ends without a final response
|
// given channel/chat. Call this when a turn ends without a final response
|
||||||
// (e.g., ResponseHandled tools) to avoid orphaned animation goroutines.
|
// (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.setPhase(TurnPhaseCompleted)
|
||||||
ts.setFinalContent("")
|
ts.setFinalContent("")
|
||||||
if al.channelManager != nil && ts.channel != "" {
|
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",
|
logger.InfoCF("agent", "Tool output satisfied delivery; ending turn without follow-up LLM",
|
||||||
map[string]any{
|
map[string]any{
|
||||||
|
|
|
||||||
|
|
@ -195,12 +195,14 @@ func clearTrackedToolFeedbackMessage(
|
||||||
// DismissToolFeedback clears any tracked tool feedback animation for the
|
// DismissToolFeedback clears any tracked tool feedback animation for the
|
||||||
// given channel/chat. This is called when a turn ends without a final
|
// given channel/chat. This is called when a turn ends without a final
|
||||||
// response (e.g., ResponseHandled tools) to stop orphaned animation goroutines.
|
// 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)
|
ch, ok := m.GetChannel(channelName)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dismissTrackedToolFeedbackMessage(ctx, ch, chatID, nil)
|
dismissTrackedToolFeedbackMessage(ctx, ch, chatID, outboundCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepareToolFeedbackMessageContent(ch Channel, content string) string {
|
func prepareToolFeedbackMessageContent(ch Channel, content string) string {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue