microsoft / microsoft/agent-framework

.NET: [Bug]: Agent chat completions endpoint does not terminate SSE stream with data: [DONE]\n\n

Open
#8,526 1 comment 0 reactions 1 assignee View on GitHub

@westey-m is already working on this.

Since Sep 18, 2026.

.NET hosting reproduced
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

### Description

- The agent chat completions endpoint does not reliably write a data: [DONE]\n\n event at the end of the SSE stream. The stream closes without the terminator event that OpenAI-compatible clients expect.
- The SSE stream should terminate with data: [DONE]\n\n, consistent with the OpenAI SSE specification. Clients that rely on the [DONE] signal to detect stream completion will hang or timeout.
- Steps to reproduce the issue:
- Register an agent chat completions endpoint
- Send a request that produces a streaming SSE response
- Observe that the stream closes without a final data: [DONE]\n\n event
- We implemented an opt-in middleware that wraps the response body and appends data: [DONE]\n\n if the endpoint didn't already write it.

### Code Sample

```markdown

```

### Error Messages / Stack Traces

```markdown

```

### Package Versions

Microsoft.Agents.AI 1.17.0; Microsoft.Agents.AI.Hosting.OpenAI 1.17.0-alpha.260804.1; Microsoft.Agents.AI.Hosting.AGUI.AspNetCore 1.17.0-preview.260804.1

### .NET Version

NET 10.0

### Additional Context

This requires consumers to implement custom middleware or post-processing to detect stream end, which is fragile. The chat completions endpoint should terminate its SSE stream with data: [DONE]\n\n per the OpenAI SSE convention.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.