Missing finish_reason in streaming responses - Streaming responses omit finish_reason field
Description: Even when streaming does partially work, Foundry Local sometimes omits the finish_reason field in the final SSE chunk. The OpenAI spec requires the last chunk to include "finish_reason": "stop" (or "tool_calls", "length", etc.). Cloud providers (OpenAI, Azure OpenAI) always include it.
Impact: The GitHub Copilot SDK's sendAndWait() method relies on finish_reason to know when a turn is complete. When it's missing, the SDK never resolves the promise and the agent hangs. We had to write a custom sendMessage() helper that listens for session.idle / session.error events instead.
Ref: This is documented in the Foundry Local × Copilot SDK sample as a known pattern.
Missing
finish_reasonin streaming responses - Streaming responses omitfinish_reasonfieldDescription: Even when streaming does partially work, Foundry Local sometimes omits the
finish_reasonfield in the final SSE chunk. The OpenAI spec requires the last chunk to include"finish_reason": "stop"(or"tool_calls","length", etc.). Cloud providers (OpenAI, Azure OpenAI) always include it.Impact: The GitHub Copilot SDK's
sendAndWait()method relies onfinish_reasonto know when a turn is complete. When it's missing, the SDK never resolves the promise and the agent hangs. We had to write a customsendMessage()helper that listens forsession.idle/session.errorevents instead.Ref: This is documented in the Foundry Local × Copilot SDK sample as a known pattern.