- [Codex / Responses Stream Transition-Cliff Adaptive Promotion and First-Byte Budget Expansion] (Fixes #3816, PR #3817, Thanks to @mclinyeshi, @cubelikeplayDaniel):
- Transition Cliff Adaptive Promotion and Heartbeat Keep-Alive: Resolved a critical issue in Codex Desktop calling deep reasoning models like
gemini-4-argon-high, where upstream pauses streaming while buffering monolithicfunctionCallpayloads (such as large scripts or diagrams) after thinking output, causing the gateway to prematurely terminate the connection at the 120-second steady-state timeout and resulting in false HTTP 200 empty responses followed by client reconnect loops; introduced state-aware lifecycle tracking (InitialTtft->Thinking/Streaming->Transition) tocreate_codex_sse_streamandcreate_legacy_sse_stream, automatically promoting to theTransitionphase upon steady-state silence, granting an independenttransition_secs(180s) grace window, and streaming continuous: ping\n\nheartbeats to keep the downstream connection alive while upstream completes full buffer synthesis. (Fixes #3816, PR #3817, Thanks to @mclinyeshi, @cubelikeplayDaniel) - First-Byte Budget Ceiling Expansion: Raised
MAX_FIRST_BYTE_BUDGET_SECSfrom 150s to 180s, preventing massive-context prefill requests under peak upstream load from exhausting the initial byte budget too early and triggering unnecessary fallback retries culminating in 504 Gateway Timeout. (Fixes #3816, PR #3817, Thanks to @mclinyeshi, @cubelikeplayDaniel) - Regression Test Coverage: Added the
test_codex_stream_survives_transition_cliff_after_thinkingunit test, simulating post-reasoning monolithic tool buffering to verify that the stream survives the silence gap and deliversresponse.completedcleanly. (PR #3817, Thanks to @cubelikeplayDaniel)
- Transition Cliff Adaptive Promotion and Heartbeat Keep-Alive: Resolved a critical issue in Codex Desktop calling deep reasoning models like
- [Codex / Responses 流式过渡断崖自适应跃迁与首字超时预算扩容] (Fixes #3816, PR #3817, Thanks to @mclinyeshi, @cubelikeplayDaniel):
- 过渡断崖自适应跃迁与心跳保活: 修复 Codex Desktop 调用
gemini-4-argon-high等深思考模型在输出思考块后,上游整包缓冲巨型functionCall(如复杂代码或思维导图文件)引发长静默时,网关单方面在 120 秒稳态超时截断连接导致 HTTP 200 无输出并触发客户端频繁重连的硬伤;为create_codex_sse_stream与create_legacy_sse_stream引入状态机阶段追踪,在检测到思考或前导文本后的长静默时自动跃迁至Transition阶段,赋予独立的transition_secs(180s) 宽限期并持续发送: ping\n\n保活连接,给予上游充足时间完成巨型工具调用的整包生成。(Fixes #3816, PR #3817, Thanks to @mclinyeshi, @cubelikeplayDaniel) - 首字节预算硬上限扩容: 将上游首字节等待预算基准硬上限
MAX_FIRST_BYTE_BUDGET_SECS由 150 秒提升至 180 秒,避免超大上下文 Prefill 且首选端点排队时过早耗尽首字预算触发多端点重传放大并在最后抛出 504 Gateway Timeout。(Fixes #3816, PR #3817, Thanks to @mclinyeshi, @cubelikeplayDaniel) - 回归测试覆盖: 补齐
test_codex_stream_survives_transition_cliff_after_thinking单元测试,模拟思考后上游长静默整包下发工具调用场景,确保流式驱动器成功跃迁并完整交付response.completed。(PR #3817, Thanks to @cubelikeplayDaniel)
- 过渡断崖自适应跃迁与心跳保活: 修复 Codex Desktop 调用
What's Changed
- fix(proxy,codex): 修复 Codex/Responses 流式过渡断崖误判超时导致 200 无输出及首字预算硬上限截断 (Fixes #3816) by @cubelikeplayDaniel in #3817
Full Changelog: v5.0.2-beta.8...v5.0.2-beta.9