Skip to content

Commit e5e2b18

Browse files
authored
chore: reduction close copied tool output stream (#1008)
1 parent 664af32 commit e5e2b18

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

adk/middlewares/reduction/reduction.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ func (t *toolReductionMiddleware) WrapStreamableToolCall(_ context.Context, endp
439439
}
440440
truncResult, err := cfg.TruncHandler(ctx, detail)
441441
if err != nil {
442+
origResp.Close()
442443
return nil, err
443444
}
444445
if !truncResult.NeedTrunc {
@@ -535,6 +536,7 @@ func (t *toolReductionMiddleware) WrapEnhancedStreamableToolCall(ctx context.Con
535536
}
536537
truncResult, err := cfg.TruncHandler(ctx, detail)
537538
if err != nil {
539+
origResp.Close()
538540
return nil, err
539541
}
540542
if !truncResult.NeedTrunc {

0 commit comments

Comments
 (0)