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().
This commit is contained in:
Amir Mamaghani 2026-03-04 19:25:19 +01:00
parent 79111425b0
commit 6b90fe48ce

View file

@ -803,7 +803,7 @@ func (al *AgentLoop) runLLMIteration(
// Check if both the provider and channel support streaming // Check if both the provider and channel support streaming
streamProvider, providerCanStream := agent.Provider.(providers.StreamingProvider) streamProvider, providerCanStream := agent.Provider.(providers.StreamingProvider)
var streamer bus.Streamer 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) streamer, _ = al.bus.GetStreamer(ctx, opts.Channel, opts.ChatID)
} }