# v0.9.5 Release Notes

> v0.9.4 -> v0.9.5

## Summary

Hardens SSE streaming against upstreams that stall, loop, or emit malformed frames. Runaway streams now end with a retryable timeout instead of running until the caller gives up, and isolated bad frames no longer fail the request. Documentation catches up with the new streaming behavior and the CLI-backed provider added earlier.

<details>
<summary>翻譯</summary>

強化 SSE 串流，應對上游停滯、重複輸出或送出格式錯誤 frame 的情況。失控的串流改為以可重試的逾時錯誤結束，不再一路跑到呼叫端放棄；零星的壞 frame 也不再讓請求失敗。文件同步補上新的串流行為與先前加入、以 CLI 驅動的供應商。

</details>

## Changes

### FEAT

- Add `WatchIdle` stream watchdog on every SSE response: three consecutive probes (about 50s) with no data, or with data but no parsable content, close the stream with a `[Timeout]` error wrapping `context.DeadlineExceeded`; time spent waiting on a slow consumer is not counted, and SSE keep-alive comments keep the stream alive (@pardnchiu) [8424729]
- Add degenerate repetition detection through `TouchIdle`: when the last 16 KiB of streamed text, reasoning, or tool arguments uses four or fewer distinct bytes, or loops a segment of up to 4 KiB, the stream ends with `[Timeout] ... degenerate repetition` wrapping `context.DeadlineExceeded`, so callers retry it like a timeout (@pardnchiu) [8424729]
- Add `DecodeFrame` so every SSE parser skips undecodable frames and fails with `[Upstream] ... 3 consecutive frames` only after three in a row; previously Claude, Gemini, Mistral and Chat/Responses streams failed on the first bad frame, while Grok, Codex and image streams silently dropped them forever (@pardnchiu) [8424729]

<details>
<summary>翻譯</summary>

- 新增 `WatchIdle` 串流監控，套用於所有 SSE 回應：連續三次探測（約 50 秒）無資料，或有資料但無可解析內容，即關閉串流並回傳包裝 `context.DeadlineExceeded` 的 `[Timeout]` 錯誤；等待慢速 consumer 的時間不計入，SSE keep-alive comment 會維持串流存活
- 透過 `TouchIdle` 新增重複輸出偵測：串流的文字、推理或 tool 參數最後 16 KiB 只有 4 種以下的 byte，或在循環 4 KiB 以內的片段時，以包裝 `context.DeadlineExceeded` 的 `[Timeout] ... degenerate repetition` 結束串流，呼叫端會比照逾時重試
- 新增 `DecodeFrame`，所有 SSE parser 遇到無法解析的 frame 改為略過，連續三次才回傳 `[Upstream] ... 3 consecutive frames`；先前 Claude、Gemini、Mistral 與 Chat／Responses 串流遇到第一個壞 frame 就失敗，Grok、Codex 與生圖串流則永遠靜默略過

</details>

### UPDATE

- Update SSE parsers to stop capping streams at `StreamBodyLimit` (64 MiB), which silently truncated long responses as a normal end; the constant remains for non-SSE audio downloads (@pardnchiu) [8424729]

<details>
<summary>翻譯</summary>

- 調整 SSE parser 不再以 `StreamBodyLimit`（64 MiB）限制串流，該限制會把過長回應靜默截斷成正常結束；常數保留給非 SSE 的音訊下載使用

</details>

## Scope

- `core/` — FEAT, UPDATE (`idle.go`, `stream.go`)
- `core/claude/`, `core/gemini/`, `core/mistral/` — FEAT, UPDATE (`stream.go`)
- `core/xai/`, `core/openaiCodex/` — FEAT, UPDATE (`responses.go`, `send.go`)
- `core/grok/`, `core/grokOauth/` — FEAT (`send.go`)
- `core/openai/` — FEAT, UPDATE (`image.go`)
- `doc/` — DOC (`doc.md`, `doc.zh.md`, `architecture.md`, `architecture.zh.md`, `README.zh.md`)
- `README.md` — DOC

---

Generated by [SKILL](https://github.com/pardnchiu/skill-version-generate)
