From 6b90fe48ce35bcbde25d2aa1381b2670e613f1a4 Mon Sep 17 00:00:00 2001 From: Amir Mamaghani Date: Wed, 4 Mar 2026 19:25:19 +0100 Subject: [PATCH] fix(streaming): skip streamer acquisition when SendResponse is false Heartbeat messages set SendResponse=false but the streaming path was unconditionally acquiring a streamer, causing HEARTBEAT_OK to leak to Telegram via streamer.Finalize(). --- pkg/agent/loop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 1889ba322..cb972764c 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -803,7 +803,7 @@ func (al *AgentLoop) runLLMIteration( // Check if both the provider and channel support streaming streamProvider, providerCanStream := agent.Provider.(providers.StreamingProvider) var streamer bus.Streamer - if providerCanStream && !constants.IsInternalChannel(opts.Channel) { + if providerCanStream && opts.SendResponse && !constants.IsInternalChannel(opts.Channel) { streamer, _ = al.bus.GetStreamer(ctx, opts.Channel, opts.ChatID) }