Skip to content

Commit ecfede6

Browse files
committed
perf(sdk): release the chat chunk buffer once the response is committed
On a successful turn the buffered chunks are dead weight (the recovered-partial fallback prefers the onFinish message), yet they were retained through the end-of-turn idle wait. Clear the buffer once the response is committed so a completed turn no longer holds a full copy of its streamed output while idle.
1 parent 6aeb2b9 commit ecfede6

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • packages/trigger-sdk/src/v3

packages/trigger-sdk/src/v3/ai.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7408,6 +7408,7 @@ function chatAgent<
74087408
if (capturedResponseMessage) {
74097409
responseCommitted = true;
74107410
capturedPartialResponse = capturedResponseMessage;
7411+
turnBufferedChunks.length = 0;
74117412
}
74127413

74137414
if (runSignal.aborted) return "exit";

0 commit comments

Comments
 (0)