Skip to content

GitHub Copilot compatibility issue with streaming responses containing empty choices chunks #43585

Description

@Cokedog320

Description

Description:

When using OpenCode Go as an OpenAI-compatible Chat Completions endpoint with GitHub Copilot in VS Code, some models fail because the streaming response contains multiple chunks with an empty choices array before the actual content chunks.

The same model works correctly with non-streaming requests.

Environment:

Issue:

A non-streaming request returns a valid OpenAI Chat Completions response with choices:

{
"object": "chat.completion",
"choices": [
{
"message": {
"role": "assistant",
"content": "Hello!"
}
}
]
}

However, when stream=true is used, the response starts with multiple chunks containing an empty choices array:

data: {"object":"chat.completion.chunk","choices":[]}

before the actual content chunks:

data: {"choices":[{"index":0,"delta":{"content":"Hello!"}}]}

GitHub Copilot fails to parse this streaming response and returns:

Response contained no choices.

Expected behavior:

Streaming responses should follow the OpenAI Chat Completions streaming format and avoid sending empty choices chunks, or ensure compatibility with clients that require valid choices in streaming chunks.

Actual behavior:

OpenCode Go sends several empty choices chunks before the assistant content, causing compatibility issues with GitHub Copilot.

Additional information:

The same endpoint and model work correctly when stream=false is used. This appears to be a streaming response formatting compatibility issue rather than an authentication or model availability issue.

Possible fix:

Filter out empty choices chunks in the streaming adapter or ensure every emitted chunk follows the expected OpenAI-compatible streaming format.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions