From aabe47ac3946ae475cb59415ce8ef91e891c5400 Mon Sep 17 00:00:00 2001 From: Amir Mamaghani Date: Fri, 20 Mar 2026 13:50:08 +0100 Subject: [PATCH] fix(streaming): set streamActive only after successful Finalize Move onFinalize hook to run after Streamer.Finalize succeeds, so that if Finalize fails the streamActive flag stays false and the regular placeholder fallback path remains available. Addresses review feedback from @alexhoshina. Co-Authored-By: Claude Opus 4.6 (1M context) --- pkg/channels/manager.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/channels/manager.go b/pkg/channels/manager.go index 802529dff..ff3fa399c 100644 --- a/pkg/channels/manager.go +++ b/pkg/channels/manager.go @@ -269,8 +269,11 @@ type finalizeHookStreamer struct { } func (s *finalizeHookStreamer) Finalize(ctx context.Context, content string) error { + if err := s.Streamer.Finalize(ctx, content); err != nil { + return err + } s.onFinalize() - return s.Streamer.Finalize(ctx, content) + return nil } // initChannel is a helper that looks up a factory by name and creates the channel.