- [Unified Streaming Lifecycle Across Protocols: Codex/Legacy Adopt the Pipeline, Gemini Gains Thinking-Phase Awareness] (Ref #3816, PR #3817, Thanks to @cubelikeplayDaniel):
- Codex / Legacy Converged onto the Shared Lifecycle: Replaced the hand-rolled
select!drivers increate_codex_sse_streamandcreate_legacy_sse_streamwithProtocolStreamHandleradapters driven byrun_stream_lifecycle, centralizing 3s heartbeats, initial-TTFT grace, thinking/streaming phase promotion, steady-state sliding timeouts, and abnormal finalization. Removed the duplicated phase state machines and timeout branches while preserving Responses event streams,text_completionframes, tool-call caching, grounding citations, and session-persistence acknowledgements. (Ref #3816, PR #3817, Thanks to @cubelikeplayDaniel) - Generic Termination Hooks in the Pipeline: Added optional
emit_error_finalize,finalize_without_content, andfinalize_barrierhooks so Codex'serror + response.failed, Legacy's error frame + single[DONE], thinking-only EOFresponse.incomplete, and "emitresponse.completedonly after session persistence succeeds" contracts remain unchanged after the migration. (Ref #3816, PR #3817) - Gemini Thinking-Phase Awareness: Added
is_thinking_activetracking toGeminiStreamHandlerso thinking blocks, visible text, tool calls, andfinishReasoncorrectly driveInitialTtft → Thinking → Streaming/Transition, preventing thinking periods from being misclassified as a transition cliff. (Ref #3816, PR #3817) - Regression Coverage: Added Legacy normal/error single-
[DONE]tests and a Gemini thinking-phase transition test; all 22 OpenAI streaming, 6 Gemini streaming, and 10 lifecycle tests pass. (Ref #3816, PR #3817)
- Codex / Legacy Converged onto the Shared Lifecycle: Replaced the hand-rolled
- [四协议流式生命周期统一:Codex/Legacy 接入流水线,Gemini 补齐思考阶段] (Ref #3816, PR #3817, Thanks to @cubelikeplayDaniel):
- Codex / Legacy 收敛至统一生命周期: 将
create_codex_sse_stream与create_legacy_sse_stream由手写select!驱动改为ProtocolStreamHandler适配器,统一交由run_stream_lifecycle接管 3s 心跳、首字宽限、思考/正文阶段跃迁、稳态滑动超时与异常收尾;删除两套重复的 phase 状态机与超时分支,保留 Responses 事件流、text_completion帧、工具调用缓存、grounding 引文与会话落盘 ack 语义。(Ref #3816, PR #3817, Thanks to @cubelikeplayDaniel) - 流水线通用终止钩子: 新增
emit_error_finalize、finalize_without_content与finalize_barrier三个可选钩子,使 Codex 的error + response.failed、Legacy 的错误帧 + 单次[DONE]、思考-only EOF 的response.incomplete以及落盘成功后再下发response.completed等协议契约在接入流水线后保持完全一致。(Ref #3816, PR #3817) - Gemini 思考阶段补齐: 为
GeminiStreamHandler增加is_thinking_active状态,思考块、正文、工具调用与finishReason可正确驱动InitialTtft → Thinking → Streaming/Transition阶段机,避免思考期被误判为过渡断崖。(Ref #3816, PR #3817) - 回归测试覆盖: 新增 Legacy 正常收尾/异常中断单次
[DONE]用例与 Gemini 思考阶段迁移用例;OpenAI 22 项、Gemini 6 项、流水线生命周期 10 项定向测试全部通过。(Ref #3816, PR #3817)
- Codex / Legacy 收敛至统一生命周期: 将
Full Changelog: v5.0.2-beta.9...v5.0.3-beta.0