From 2d5f320168607c9e06fd8ce341d1f4c9fb4c2a98 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 8a0b7abd1..785fe1e70 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -740,7 +740,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) }