Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/copilot-sdk/src/chat/classes/AbstractChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export class AbstractChat<T extends UIMessage = UIMessage> {
debug: init.debug,
optimization: init.optimization,
yourgptConfig: init.yourgptConfig,
streamMode: init.streamMode,
};

// Use provided state or create default
Expand Down Expand Up @@ -1495,6 +1496,18 @@ export class AbstractChat<T extends UIMessage = UIMessage> {
continue;
}

// single-turn: ALL assistant content (including intermediate tool-calling
// messages from earlier server iterations) is already accumulated into the
// one streaming message via message:delta. Inserting them from done.messages
// creates duplicate bubbles after streaming ends. Skip ALL assistant messages
// in single-turn mode — tool execution display is driven by streamState.toolResults.
if (
this.config.streamMode === "single-turn" &&
msg.role === "assistant"
) {
continue;
}

// The current streamed turn already becomes an assistant message from
// streamState/tool_calls handling. Skip the duplicate copy from the
// done payload, but keep assistant tool_call messages from earlier
Expand Down