Emit ordinary stop events for Zed-hosted Gemini models (#64263)
Previously, the Gemini per-event mapper shared by Zed-hosted models and
BYOK recorded `finishReason`, but did not emit
`LanguageModelCompletionEvent::Stop` for ordinary text completions such
as:
```json
{
"candidates": [
{
"index": 0,
"content": {
"role": "model",
"parts": [
{
"text": "What can I help you with today?"
}
]
},
"finishReason": "STOP"
}
]
}
```
The BYOK stream wrapper compensated by emitting the recorded stop reason
at EOF. The hosted path called the per-event mapper without that
wrapper, so completed text responses could reach consumers without a
`Stop` event.
This PR emits the stop event from the shared per-event mapper, after
processing the chunk’s content, while preserving tool-use and refusal
handling. It also removes the BYOK EOF-to-success fallback: a direct
stream ending without a completion signal now reports an unexpected-end
error instead of synthesizing successful completion.
Release Notes:
- N/A
46ee98a8e0Cole Miller committed on 9/15/2026, 9:04:22 PM· committed by GitHubparentf092e5e