- [Align Upstream Rules: Deprecate Model Terminal Turn Padding & Protect AI Coding Agent State Machines] (Fixes #3629):
- Deprecate Trailing User Padding for Payloads Ending with Model Turn: Aligned with Google upstream's latest protocol changes which allow requests ending with a
model/assistantturn. Completely deprecated injecting synthetic user turns ("ok go on") into trailing model turns. This eliminates issues where interactive AI Coding Agents (such as Cline, OpenCode, Pi Agent, Claude Code, etc.) waiting on human-in-the-loop confirmation gates (destructive Git operations, prompt questions) were bypassed by synthetic user approval, and prevents conversation history pollution and infinite loops caused by repeated"ok go on"injections after tool execution. (Fixes #3629)
- Deprecate Trailing User Padding for Payloads Ending with Model Turn: Aligned with Google upstream's latest protocol changes which allow requests ending with a
- [Precisely Remove Account Rotation Timeout Fuses & Outer Redundant Timeouts; Break Sticky Deadlock on First Chunk Retry] (PR #3628, Fixes #3626, Ref PR #3622, PR #3625, Thanks to @cubelikeplayDaniel):
- Remove Account Rotation Cumulative Timeout Fuses: Removed wall-clock cumulative 120s timeout fuses based on
request_startinclaude.rsandopenai.rsretry loops, preventing false HTTP 504 Gateway Timeout errors during normal multi-account failover. (Thanks to @cubelikeplayDaniel) - Remove Redundant Outer 120s Claude Stream Timeout: Removed the hardcoded outer 120s
tokio::time::timeoutwrapper inclaude.rs, fully delegating stream lifecycle to the inner staged gradient timeout pipeline and ensuring large code blocks and deep reasoning complete uninterrupted. (Thanks to @cubelikeplayDaniel) - Break Sticky Session Deadlock on First-Chunk Timeout Retry: Explicitly set
force_rotate = truewhen first-chunk Peek times out, breaking sticky affinity deadlocks on stalled accounts. (Thanks to @cubelikeplayDaniel)
- Remove Account Rotation Cumulative Timeout Fuses: Removed wall-clock cumulative 120s timeout fuses based on
- [Eliminate Fake Truncation on Stream Interruption & Extend Sliding Timeout to 120s to Guarantee Native Client Retries] (PR #3625, Ref #3621, PR #3622, Thanks to @cubelikeplayDaniel):
- Eradicate Fake Truncation & Synthetic End Frames: Completely removed
emit_interruption_truncationand syntheticmessage_stop/[DONE]frames, transparently passing through connection resets and timeouts so downstream clients (such as Claude Code CLI) immediately trigger official exponential backoff retries without corrupting conversation history with fake truncation text. (Thanks to @cubelikeplayDaniel) - Extend Steady-State Streaming Sliding Timeout to 120s: Extended the sliding window idle timeout from 45s to 120s to provide ample buffer for complex upstream code block pre-computation, eliminating false cutoff. (Thanks to @cubelikeplayDaniel)
- Frontend Timeout Alignment to 120s: Aligned frontend timeout settings to 120s and removed OpenAI localized hardcoded timeout values. (Ref #3621, PR #3622, PR #3625)
- Eradicate Fake Truncation & Synthetic End Frames: Completely removed
- [对齐上游新规废弃 Model 尾轮垫片,根治 AI 编码代理人机安全门击穿与死循环] (Fixes #3629):
- 废弃以 model 轮收尾时强行追加 user 垫片的防御逻辑: 谷歌上游最新报文已允许请求最后一轮为
model/assistant。彻底废弃向尾部注入合成 user 轮次 ("ok go on") 的历史防御逻辑,根治现代 AI 编码代理(如 Cline、OpenCode、Pi Agent、Claude Code 等)在人机交互安全确认门(如高危 Git 操作、问卷)中被网关伪造用户批准而直接击穿的问题,并消除多轮工具回执被"ok go on"污染导致的上下文膨胀与死循环。 (Fixes #3629)
- 废弃以 model 轮收尾时强行追加 user 垫片的防御逻辑: 谷歌上游最新报文已允许请求最后一轮为
- [精准移除轮换累计熔断与外层冗余超时并在首包重试时打破粘性死锁] (PR #3628, Fixes #3626, Ref PR #3622, PR #3625, Thanks to @cubelikeplayDaniel):
- 移除账号轮换累计超时硬熔断: 移除
claude.rs与openai.rs轮换循环中基于request_start的 120s 累计熔断硬判断,消除多账号正常故障排查时被误判为 504 Gateway Timeout 的问题。 (Thanks to @cubelikeplayDaniel) - 移除 Claude 外层 120s 冗余流超时套娃: 移除
claude.rs最外层死写的 120stokio::time::timeout限制,将流式传输完全交由内层stream_lifecycle梯度超时管道自适应管理,保障大代码块与超长思考顺利完成。 (Thanks to @cubelikeplayDaniel) - 打破首包重试粘性死锁: 在首包 Peek 超时重试处显式标记
force_rotate = true,强制轮换账号,根治粘性亲和停滞账号死锁。 (Thanks to @cubelikeplayDaniel)
- 移除账号轮换累计超时硬熔断: 移除
- [根除中途断流伪截断收尾并延长稳态超时至 120s,如实透传网络异常保障客户端原生重试] (PR #3625, Ref #3621, PR #3622, Thanks to @cubelikeplayDaniel):
- 彻底根除中途断流伪截断与伪造收尾: 彻底移除
emit_interruption_truncation及伪造message_stop/[DONE]逻辑,长连接发生中断或超时时如实向底层透传网络异常,确保 Claude Code CLI 等客户端能够立即感知并触发官方指数退避原生重试,杜绝虚假截断文本污染用户历史上下文。 (Thanks to @cubelikeplayDaniel) - 延长稳态推流滑动超时至 120 秒: 将稳态推流滑动窗口超时由 45s 调整为 120s,为上游模型生成大代码块与长图元数据的内部预计算提供充裕时间,消除误杀断流。 (Thanks to @cubelikeplayDaniel)
- 前端超时设置全面对齐 120s: 前端超时设置全面对齐 120s 并消除 OpenAI 局部硬编码。 (Ref #3621, PR #3622, PR #3625)
- 彻底根除中途断流伪截断与伪造收尾: 彻底移除
What's Changed
- fix(proxy): 根除中途断流伪截断收尾并延长稳态超时至120s,透传网络异常保障客户端原生重试 (Ref #3621, PR #3622) by @cubelikeplayDaniel in #3625
- fix(proxy): 精准移除轮换累计熔断与外层冗余超时并在首包重试时打破粘性死锁 (Fixes #3626, Ref PR #3622, PR #3625) by @cubelikeplayDaniel in #3628
Full Changelog: v4.9.7-beta.4...v4.9.7-beta.5