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) <noreply@anthropic.com>
This commit is contained in:
parent
ac68b6d53c
commit
aabe47ac39
1 changed files with 4 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue