-
[Prevent OOM Crashes on Cyclic JSON Schema Expansion & Array Normalization] (PR #3694, Fixes #3690, Ref #3682, Thanks to @cubelikeplayDaniel):
-
Cyclic Self-Reference Termination & Safe Degradation: Introduced active traversal tracking
active_refsduring recursive reference flattening for branching schemas ($b \ge 2$, e.g. recursive binary treesleft: $ref, right: $ref). Upon detecting self-references within the active chain, expansion degrades safely into a terminal empty object annotated with"(Cyclic $ref: ...)", completely preventing $2^{64}$ exponential subtree replication and eliminating Linux VPS/server OOM crashes (SIGKILL 137). (PR #3694, Fixes #3690, Thanks to @cubelikeplayDaniel) -
Schema Array Normalization & Terminal ARRAY Items Guard: Refined tool schema normalization for array nodes that erroneously include
properties. Strips illegalpropertieswhile guaranteeing compliantitems; enforces a terminal guard ensuring all finalized ARRAY schemas carry validitems, preventing Gemini Protobuf 400 INVALID_ARGUMENT rejection on union array types. (PR #3694, Ref #3682, Thanks to @cubelikeplayDaniel)
-
Cyclic Self-Reference Termination & Safe Degradation: Introduced active traversal tracking
-
[Adaptive Streaming Peek Timeout for Reasoning Models & TTFT Protection] (PR #3694, Ref #3693, Thanks to @cubelikeplayDaniel):
-
Extended Peek Grace Period for Reasoning Models: Implemented
calculate_adaptive_peek_timeout_fullacross Claude and OpenAI endpoints for thinking/reasoning models (thinkingConfig,reasoning_effort,o1/o3/o4series). Extends the first-chunk pre-read (Peek) timeout baseline from 30s to 60s (and dynamically scales up to 90s/120s for large prompt contexts), preventing premature 30s timeout cancellations and pool rotation retry storms caused by deep reasoning TTFT preheating. (PR #3694, Ref #3693, Thanks to @cubelikeplayDaniel)
-
Extended Peek Grace Period for Reasoning Models: Implemented
-
[Zero-Downtime Atomic Account Pool Reload & 503 Elimination] (PR #3694, Thanks to @cubelikeplayDaniel):
-
Smooth Lossless Account Reload: Eliminated premature flushing of the global
self.tokensmap duringload_accountswhich previously caused concurrent requests to hit transient503 Token pool is emptyerrors. Redesigned reload into an asynchronous local batch load followed by atomicretain(removing deleted accounts) andinsert(updating active accounts), maintaining 100% pool availability during hot reloads. (PR #3694, Thanks to @cubelikeplayDaniel)
-
Smooth Lossless Account Reload: Eliminated premature flushing of the global
-
[Anti-Regression Rate Limit Protection & Order-Agnostic ErrorInfo Scanning] (PR #3694, Thanks to @cubelikeplayDaniel):
-
Anti-Regression Lock Duration Check: Added anti-regression validation in
parse_from_error_with_mode. When an account already holds a longer, unexpired lock (e.g. 300s quota exhaustion backoff), subsequent concurrent generic 429 errors with shorter default delays (60s) are ignored, preserving the longer cooldown window. (PR #3694, Thanks to @cubelikeplayDaniel) -
Full Details Array Scanning: Iterates over all entries in Google RPC
detailsarrays rather than only index 0, preventing missed rate limit classifications whengoogle.rpc.ErrorInfois preceded by other items likegoogle.rpc.Help. (PR #3694, Thanks to @cubelikeplayDaniel)
-
Anti-Regression Lock Duration Check: Added anti-regression validation in
-
[Authorization Header Sensitive Masking & Prompt Single-Pass Code Restoration] (PR #3694, Thanks to @cubelikeplayDaniel):
-
Header Value Sensitivity Flagging: Explicitly marked
Authorizationheader values sent to upstream Google endpoints assensitive, automatically masking Bearer tokens as[sensitive]across all debug and tracing logs. (PR #3694, Thanks to @cubelikeplayDaniel) -
Single-Pass Non-Recursive Code Restoration: Replaced iterative string substitution with regex-based atomic single-pass placeholder restoration in
PromptSanitizer, eliminating 2^N expansion risks if code snippets contain placeholder patterns. Extended identity boundaries with trailing punctuation (! ? ; ! ? ;) to prevent greedy truncation of subsequent developer instructions. (PR #3694, Thanks to @cubelikeplayDaniel)
-
Header Value Sensitivity Flagging: Explicitly marked
-
[JSON Schema 递归展开防 OOM 崩溃与数组规范化] (PR #3694, Fixes #3690, Ref #3682, Thanks to @cubelikeplayDaniel):
-
循环自引用展开阻断与安全降级: 针对包含分支因子 $b \ge 2$ 的递归数据结构(如二叉树
left: $ref, right: $ref),在展开路径中引入活跃引用集合active_refs;一旦检测到循环引用立即安全降级为带有"(Cyclic $ref: ...)"提示的终态空对象并中止展开,彻底阻断 $2^{64}$ 指数级节点裂变爆炸,杜绝 Linux VPS/服务器遭遇物理内存耗尽触发 OOM (SIGKILL 137) 崩溃。(PR #3694, Fixes #3690, Thanks to @cubelikeplayDaniel) -
工具 Schema 规范化与终态 ARRAY 守卫: 修正具备
properties与type: "array"的工具 Schema 规范化逻辑,安全剥离非法的properties并保底注入合规items;增加终态铁律守卫,确保所有最终为 ARRAY 的节点必持合规items,防止联合数组类型触发 Gemini Protobuf 400 INVALID_ARGUMENT 校验拦截。(PR #3694, Ref #3682, Thanks to @cubelikeplayDaniel)
-
循环自引用展开阻断与安全降级: 针对包含分支因子 $b \ge 2$ 的递归数据结构(如二叉树
-
[推理模型自适应流式预读 Peek 宽限与首包防误杀] (PR #3694, Ref #3693, Thanks to @cubelikeplayDaniel):
-
思考与推理模型自适应预读阶梯放宽: 针对 Claude 与 OpenAI 协议端点中思考/推理模型(
thinkingConfig、reasoning_effort、o1/o3/o4系列及其思考变体),实现calculate_adaptive_peek_timeout_full;将流式首包预读超时底线从 30 秒自适应阶梯扩展至 60 秒(大上下文根据 Token 估算自动扩展至 90 秒 / 120 秒),彻底解决长前缀思考预热与高推理深度导致的 30 秒超时误杀与全池轮换重试雪崩。(PR #3694, Ref #3693, Thanks to @cubelikeplayDaniel)
-
思考与推理模型自适应预读阶梯放宽: 针对 Claude 与 OpenAI 协议端点中思考/推理模型(
-
[账号池零停机原子同步加载与并发闪断消除] (PR #3694, Thanks to @cubelikeplayDaniel):
-
零停机平滑无损重载: 消除
load_accounts期间预先全量清空全局self.tokens容器导致的并发请求遭遇503 Token pool is empty闪断故障;重构为局部暂存集合异步载入,再通过retain安全剔除已失效账号并原子覆写新增/有效账号,确保账号池在高并发热重载过程中全程 100% 在线。(PR #3694, Thanks to @cubelikeplayDaniel)
-
零停机平滑无损重载: 消除
-
[限流防倒退校验与 ErrorInfo 顺序无关解析] (PR #3694, Thanks to @cubelikeplayDaniel):
-
限流防倒退保护: 在
parse_from_error_with_mode中增加防倒退校验,当账号已处于更长且未过期的锁定状态(如配额耗尽 300 秒退避)时,自动忽略后续并发请求返回的无具体延时的较短通用 429 间隔(60 秒),防止长锁定被瞬态短报错冲刷倒退。(PR #3694, Thanks to @cubelikeplayDaniel) -
多错误明细顺序无关扫描: 遍历扫描
details数组中的所有对象寻找reason,杜绝因google.rpc.ErrorInfo位于非零索引(如第 0 项为google.rpc.Help)引发的限流原因漏判。(PR #3694, Thanks to @cubelikeplayDaniel)
-
限流防倒退保护: 在
-
[鉴权安全加固与 Prompt 代码块防递归展开] (PR #3694, Thanks to @cubelikeplayDaniel):
-
OAuth 鉴权头敏感标记防护: 向 Google 上游发送请求的 HeaderMap 中的
AuthorizationHeaderValue 显式标记为sensitive,确保在所有日志追踪与 Debug 打印中自动脱敏为[sensitive],杜绝 Bearer Token 明文泄漏。(PR #3694, Thanks to @cubelikeplayDaniel) -
Prompt Sanitizer 单次正则替换与边界截断: 将受保护代码块占位符的多轮循环串行替换升级为基于正则的单次原子还原,杜绝代码块内若包含占位符 token 导致的二次展开与字符串膨胀风险;并在身份标识正文中补充
! ? ; ! ? ;等标点边界,防止贪婪匹配吞噬紧随其后的开发者指令。(PR #3694, Thanks to @cubelikeplayDaniel)
-
OAuth 鉴权头敏感标记防护: 向 Google 上游发送请求的 HeaderMap 中的
What's Changed
- fix(proxy): 修复 JSON Schema 循环引用指数膨胀 OOM 与端点全链路可靠性加固 (Fixes #3690, Ref #3693) by @cubelikeplayDaniel in #3694
Full Changelog: v4.9.8-beta.9...v4.9.8-beta.10