-
[Upstream WAF 429 Identity Sanitization, Request-Level Anti-Cascade & Prompt Rewrite Rules] (Fixes #3904, #3908, #3901, #3915, Ref #3903, #3912, PR #3913, Thanks to @jeikl, @lbjlaq, @sinderson123-afk):
-
Singleton Identity Invariant & Multi-Identity Deduplication: Enforced global deduplication across
systemInstruction.parts, retaining only the primary official Antigravity identity. Thoroughly stripped pure whitespace and duplicate identity declarations injected by clients such as DSH, pi, and OpenCode, preventing upstream Google WAF from rejecting mixed identity prompts with 429 RESOURCE_EXHAUSTED when tools are present. (Fixes #3904, #3908) -
Version Token Matching & Appositive Normalization: Prioritized multi-segment version tokens (e.g.
gemini-3.8-flash-low, eliminating truncation togemini-3and leftover8-flash-low model.). Normalized ASCII comma appositives following Antigravity identity declarations to periods (AG, a coding agent harness.$\to$AG. a coding agent harness.) and folded malformed punctuation sequences (e.g..,,。,), removing upstream WAF triggers. (Fixes #3908, #3915) -
Request-Level 429 Isolation & Configurable Grace Retry: Refined failure count tracking to
account + modelgranularity, preventing single-model rate limits from locking the entire account. Introduced in-placeGraceRetrywithout account lockout on initial attempt for request-level 429s withoutretryDelay. Addedrequest_429_grace_ms(default 1500ms, range 200–10000ms, configurable via UI/config andABV_REQUEST_429_GRACE_MSenvironment variable with hot reload). Returned 429all_accounts_limitedwithgateway_error.sourcewhen the entire gateway pool is cooling down, and aligned structuredQuotaFailure/RetryInfo/ErrorInfosignals across rotation and retry policies. (Fixes #3901) -
WAF Prompt Cleanup Rules (Prompt Rewrite) & Recommended Presets: Added the "Prompt Rewrite Rules" configuration section and modal editor under API Proxy settings. Supports single-line
*wildcard matching and\n/\r/\t/\\/\*escape sequences (empty replacement deletes matches), operating strictly on the System track prior to the first real user message while exempting code blocks and thinking blocks. Seeded 6 battle-tested recommended preset rules (OpenCode appositive, DSH identity, WorkBuddy identity, Codex CLI fingerprint, Anthropic Billing header metadata, etc.) with one-click loading and config export/import. (Ref #3903, #3913) -
Full 12-Locale i18n & Multi-Binary Cargo Build Fix: Completed full internationalization across all 12 supported languages for prompt rewrite and retry grace settings. Explicitly declared
default-run = "antigravity-tools"inCargo.toml, resolving binary ambiguity errors duringcargo runandtauri dev. (Ref #3913)
-
Singleton Identity Invariant & Multi-Identity Deduplication: Enforced global deduplication across
-
[Converge Upload Timeout Policy & Eliminate 504 Cross-Account Replay Amplification] (PR #3906, Ref #3763, #3821, #3639, #3893, #3899, Thanks to @jeikl, @mclinyeshi, @JeikCode):
-
Progress-Driven Upload Watchdog: Downgraded
upload_budgetfrom a hard deadline to a soft observational budget; only terminates uploads withUploadStalledafter continuousstall_secswithout transmission progress, backed by a global budget hard cap to prevent aborting active large transfers on slow connections. (PR #3906, Ref #3763) -
Eradicate Cross-Account Replay Amplification: Wired
UploadandUploadStalledintoTerminalDisposition::plan. In all text routing modes (CacheFirst / Balance / PerformanceFirst), upload failures retry once in place on the same account before stopping permanently—strictly avoiding unbinding sticky sessions or replaying large request bodies across secondary pool accounts. (PR #3906, Ref #3899) -
Large Body Byte Threshold & Endpoint Routing Alignment: Corrected
large_bodyclassification to rely purely on byte length (>= 2MB) rather thantoken >= 30kapproximations; prioritized healthy Sandbox endpoints when Daily is cooling down, properly tagging terminal states at endpoint boundaries. (PR #3906) - EWMA Transfer Rate Sampling & Pipeline UA 404 Short-Circuit: Lowered EWMA sampling threshold from 32KB/s to 4KB/s and sampled aborted/failed uploads to track slow networks realistically. Unified outdated User-Agent 404/403 short-circuiting in the pipeline to prevent spurious 900s model-breaker lockouts. (PR #3906)
-
Timeout Config Parity & Effective Values Panel: Dynamically aligned frontend timeout calculation formulas (
1 + extra_wait_ratio) and clamped input ranges to backend schemas; introducedget_effective_timeout_configand a live "Effective Settings" inspector in the settings panel. (PR #3906) -
Policy Documentation & Structured Telemetry: Authored
docs/UPLOAD_TIMEOUT_POLICY.mddetailing timeout matrix, migration, and rollback strategies. Added structured metrics includingprogress_pct,upload_budget_extended, andendpoint_attempts. (PR #3906)
-
Progress-Driven Upload Watchdog: Downgraded
-
[Sticky Session Transport Reset In-Place Retry & KV Cache Preservation] (PR #3899, Ref #3821, #3893, #3639, Thanks to @mclinyeshi):
-
Distinguish Transport Resets from First-Byte Timeouts: Accurately separated intra-budget TCP connection drops (e.g. Daily endpoint
client error (SendRequest)) from genuine first-byte timeouts, classifying in-budget resets asTransportReset(HTTP 502) without penalizing or locking accounts. (PR #3899, Ref #3821) -
In-Place Retry Under CacheFirst to Protect KV Cache: Guaranteed that CacheFirst mode never unbinds accounts on
TransportReset, retrying in place once to keep the session binding intact and prevent upstream KV cache (prompt cache) drops caused by unexpected mid-session account drift. Balance mode retries once in place before failing over. Non-cached image generation requests under CacheFirst are allowed to rotate to another account on failure without unbinding the session's primary text binding. (PR #3899)
-
Distinguish Transport Resets from First-Byte Timeouts: Accurately separated intra-budget TCP connection drops (e.g. Daily endpoint
-
[Sanitizer Punctuation Continuation Protection] (PR #3902, Ref #3508, Thanks to @ThermalEng, @jeikl):
-
Normalized Punctuation Splicing on Identity Continuation: Only stripped the trailing period of the official identity declaration when immediately followed by a comma continuation, preventing
".,"double-punctuation artifacts while preserving the terminal period on standalone declarations. Added robust regression tests for full-width commas and known client openings. (PR #3902, Ref #3508)
-
Normalized Punctuation Splicing on Identity Continuation: Only stripped the trailing period of the official identity declaration when immediately followed by a comma continuation, preventing
-
[OpenAI Prompt Pass-Through Integrity & Legacy Skill Instructions Cleanup] (Fixes #3914, Thanks to @l10kai):
-
Eliminate Legacy Skill Prompt Hijacking: Completely removed the legacy
enhance_gemini_skills_prompthardcoded logic, ceasing unconditional interception of</skills>and</skills_instructions>XML tags under OpenAI-compatible endpoints (/v1/chat/completionsand/v1/responses). Eliminated erroneous pseudo-instructions injecting fictitiousshell_commandtools and Windows PowerShell commands into non-Codex clients, fully restoring verbatim prompt pass-through and preventing tool-call hallucinations and conflicting instructions across agent frameworks (Oh My Pi, Cline, Roo Code, etc.). (Fixes #3914)
-
Eliminate Legacy Skill Prompt Hijacking: Completely removed the legacy
-
[Stream Lifecycle EOF Trailing Buffer Prioritized Flush & Spurious Interruption Fix] (Fixes #3911, Ref #3693, Thanks to @djj532):
-
Prioritized Safe Flush for Trailing EOF Buffer: Reordered stream lifecycle execution (
stream_lifecycle.rs) at upstream EOF and loop break points to safely flush and dispatch pending trailing buffers prior to!has_content()guard evaluation. Completely resolved the defect where trailing content or tool-call frames lacking terminal newlines (\n) following thinking blocks (thought=true) were held in the line buffer, prematurely triggeringupstream stream ended after thinking without contentand dropping valid terminal chunks. Retained strict error propagation when flushed buffers yield no content, preserving native client retry semantics. (Fixes #3911, Ref #3693)
-
Prioritized Safe Flush for Trailing EOF Buffer: Reordered stream lifecycle execution (
-
[上游 WAF 429 身份改写根治、请求级限流防连坐与风控提示词清理方案] (Fixes #3904, #3908, #3901, #3915, Ref #3903, #3912, PR #3913, Thanks to @jeikl, @lbjlaq, @sinderson123-afk):
-
单例身份不变量与多重身份清理: 跨
systemInstruction.parts全局去重,仅保留首处官方 Antigravity 身份;彻底清除 DSH/pi/OpenCode 等客户端多重身份声明叠加生成的纯空白与重复身份片段,杜绝多身份混合带 tools 时被 Google WAF 判定异常并抛出 429 RESOURCE_EXHAUSTED。(Fixes #3904, #3908) -
版本号识别优化与同位语标点规整: 版本 token 优先匹配完整版本号(如
gemini-3.8-flash-low,彻底根除被截断为gemini-3并残留8-flash-low model.的缺陷);规范化 AG 声明后的 ASCII 逗号与同位语续写为句号(AG, a coding agent harness.$\to$AG. a coding agent harness.),折叠处理畸形标点(如.,、。,),消除上游 WAF 触发特征。(Fixes #3908, #3915) -
请求级 429 防连坐与智能宽限重试: 失败计数粒度细化至账号+模型(account + model),避免单一模型限流波及全号;首轮 429 遭遇无
retryDelay的请求级限流时原地执行 GraceRetry 且不锁定账号;新增request_429_grace_ms(首轮请求 429 宽限延迟,默认 1500ms,范围 200–10000ms,支持环境变量ABV_REQUEST_429_GRACE_MS与热更新);网关全池冷却规范返回 429 状态码与all_accounts_limited,并通过gateway_error.source标明来源;优先解析QuotaFailure、RetryInfo、ErrorInfo结构化信号,与轮换策略协同。(Fixes #3901) -
风控提示词清理方案(Prompt Rewrite)与内置推荐预设: 反代设置新增「风控提示词清理方案」配置与编辑面板,支持单行通配符
*与\n/\r/\t/\\/\*转义,空替换即为删除,仅作用于首个真实 user 之前的 System 轨并豁免代码块与思考块;默认内置并支持一键载入 6 套实战推荐规则(OpenCode 同位语、DSH 身份声明、WorkBuddy 身份声明、Codex CLI 身份指纹、Anthropic Billing 计费头元数据等),支持规则热重载与配置导入导出。(Ref #3903, #3913) -
全语言国际化覆盖与多目标编译修复: 针对提示词清理规则与宽限延迟等新配置项补齐 12 种语言完整国际化覆盖;在
Cargo.toml中显式指定default-run = "antigravity-tools",彻底消除多 bin 目标时cargo run或tauri dev编译报错问题。(Ref #3913)
-
单例身份不变量与多重身份清理: 跨
-
[收敛上传超时策略并消除 504 跨账号重传放大] (PR #3906, Ref #3763, #3821, #3639, #3893, #3899, Thanks to @jeikl, @mclinyeshi, @JeikCode):
-
进展驱动上传看门狗: 将
upload_budget从固定硬时间切断降级为软预算与观测指标,仅在连续stall_secs无任何数据传输进展时才触发UploadStalled终态中止;全局总预算兜底硬上限,彻底避免网络平稳但速度较慢的大文件/大上下文上传被中途误掐断。(PR #3906, Ref #3763) -
杜绝跨账号重传放大: 全面接入
TerminalDisposition::plan,明确Upload与UploadStalled在所有文本调度模式(CacheFirst / Balance / PerformanceFirst)下仅允许在同账号原地重连重试 1 次,失败后直接终止(Stop),坚决不解绑粘性会话、不跨账号轮换重放同一份大请求体,彻底消除 504 导致的号池风暴与雪崩。(PR #3906, Ref #3899) -
端点调度与 large_body 字节判定优化: 修正
large_body判定,仅依据实际 Body 字节数(>= 2MB)触发,移除>= 30k tokens的误判;主端点冷却时大请求优先尝试健康的 Sandbox 端点,且端点遍历至末尾时严格打齐终态标记。(PR #3906) - EWMA 传输速率采样放宽与 UA 404 短路保护: EWMA 有效速率采样门槛从 32KB/s 宽限至 4KB/s,并在失败/中止的上传上正常采样以更贴近真实弱网环境;客户端 UA 过旧引发的 404/403 在 Pipeline 统一短路,不再误写 900 秒模型熔断与换号。(PR #3906)
-
前后端超时配置与生效值面板对齐: 超时配置公式动态对齐后端(
1 + extra_wait_ratio),前端精确夹取后端取值范围;新增get_effective_timeout_config命令并在设置面板提供「当前生效值」展示,明确区分单端点尝试次数与跨账号重试。(PR #3906) -
策略文档与结构化观测落地: 新增
docs/UPLOAD_TIMEOUT_POLICY.md详细阐释超时策略、终态矩阵、迁移与回滚路径;上传日志增加progress_pct、upload_budget_extended、endpoint_attempts等结构化指标。(PR #3906)
-
进展驱动上传看门狗: 将
-
[粘性会话连接重置原地重试与缓存锁定保护] (PR #3899, Ref #3821, #3893, #3639, Thanks to @mclinyeshi):
-
区分底层连接重置与首字超时: 准确区分预算内底层 TCP 连接中断(如 daily 端点
client error (SendRequest))与真正的首字超时,将预算内断流归类为TransportReset(502)且不惩罚账号,避免被误判为超时故障。(PR #3899, Ref #3821) - CacheFirst 模式原地重试与会话缓存锁定: 在 CacheFirst 调度模式下遭遇 TransportReset 坚决不解绑账号,在原地重试 1 次并维持会话绑定,彻底根除长会话因瞬间断流漂移至其他账号导致昂贵的前缀预填充缓存(KV Cache)雪崩失效的问题;Balance 模式下原地重试 1 次失败后才触发换号容灾;CacheFirst 下生图请求(不携带 KV 缓存)遭遇故障时允许平滑轮换账号且不解绑会话原有的文本绑定。(PR #3899)
-
区分底层连接重置与首字超时: 准确区分预算内底层 TCP 连接中断(如 daily 端点
- [身份改写标点清洗与续写保护] (PR #3902, Ref #3508, Thanks to @ThermalEng, @jeikl):
-
[OpenAI 协议提示词纯净透传与遗留技能伪指令清除] (Fixes #3914, Thanks to @l10kai):
-
拔除遗留技能提示词劫持: 彻底移除
enhance_gemini_skills_prompt硬编码逻辑,不再无条件劫持 OpenAI 兼容协议(/v1/chat/completions与/v1/responses)中的</skills>及</skills_instructions>XML 标签;消除向非 Codex 客户端注入虚构的shell_command工具及 Windows PowerShell 命令的错误伪指令,彻底恢复系统提示词原样纯净透传,杜绝主流 Agent 客户端(Oh My Pi、Cline、Roo Code 等)发生指令冲突与工具调用幻觉。(Fixes #3914)
-
拔除遗留技能提示词劫持: 彻底移除
-
[流式生命周期 EOF 残余缓冲区优先冲刷与误中断消除] (Fixes #3911, Ref #3693, Thanks to @djj532):
-
EOF 残余缓冲区优先安全冲刷: 调整流式生命周期管理(
stream_lifecycle.rs)在遇到上游 EOF 及跳出主循环时的执行顺序,优先对滞留的尾部数据缓冲区(buffer)执行 Trim 与行解析下发,彻底根治思考结束(thought=true)后紧跟的无换行符(\n)正文或工具调用尾帧因滞留缓冲区而被判空守卫(!has_content())提前拦截并报出upstream stream ended after thinking without content导致有效帧丢失的问题;冲刷后若确实无有效正文依然如实报错以触发原生重试,兼顾极端分片容错与故障重试契约。(Fixes #3911, Ref #3693)
-
EOF 残余缓冲区优先安全冲刷: 调整流式生命周期管理(
What's Changed
- fix(sanitizer): avoid doubled punctuation in identity continuation cause error 429 by @ThermalEng in #3902
- fix(proxy): keep CacheFirst sticky account on transport reset and first-byte terminals (Ref #3821, #3893, #3639) by @mclinyeshi in #3899
- test(sanitizer): harden identity continuation punctuation coverage (PR #3902, Ref #3508) by @jeikl in #3905
- fix(proxy): 收敛上传超时策略并消除 504 重传放大 (Ref #3763, #3821, #3639, #3893, #3899) by @jeikl in #3906
- fix(proxy,sanitizer): 修复 WAF 429 身份改写问题并新增风控提示词清理方案 by @jeikl in #3913
New Contributors
- @ThermalEng made their first contribution in #3902
Full Changelog: v5.0.4-beta.6...v5.0.4-beta.7