Repository navigation
fix(antigravity): finish empty terminal streams and continue model turns - #7899
ResidualBlood wants to merge 8 commits into
Conversation
|
All contributors have signed the CLA. ✅ |
|
Follow-up on the running instance: empty compatibility streams must not switch accounts. After the malformed-call correction, a content-less
This also means #7753 should not be merged as written. Switching accounts on a signature-only |
A candidate finishReason with no text, thinking, or function call was classified as an empty stream, retried, and temp-unscheduled. Treat a non-content-filter finishReason as a finished step instead. Antigravity rejects the next request when that empty model turn is last. Append a [Continue] user turn in wrapV1InternalRequest.
golangci-lint errcheck rejects unchecked map type assertions.
A signature-only MALFORMED_FUNCTION_CALL was treated as a finished step and returned stop to the client. Keep that reason on the empty-stream failover path. STOP and MAX_TOKENS still finish.
An empty compatibility stream was retried on the same account and then failed over, which walks the pool and temp-unschedules each account. Retry the current account only, then stop. Do not unschedule it.
9282e1b to
027e24f
Compare
- 合入上游 Wei-Shaw#7899:Antigravity 空 STOP 收尾的流正常结束,最后一轮为 model 时追加续写提示,避免上游 400 - compat 空流错误改为同账号重试,不换号也不临时停用账号 - 本仓修正:finishReason 检测先做子串判断再用 gjson 取值,避免每行 SSE 完整 JSON 解码 - 本仓修正:MALFORMED_FUNCTION_CALL 在本仓输出可见提示文本,相应测试改为断言该行为 测试:service、handler、antigravity、apicompat unit 测试通过。
- 同步上游 v0.2.14:易支付回调签名复用伪造入账修复(Wei-Shaw#7888)、新装实例不再使用可猜测的管理员凭据(Wei-Shaw#7893)、前端依赖审计修复 - 安全:拒绝顶层重复 model 键(Wei-Shaw#7909),本仓补充大小写不敏感比较并并入已有请求体遍历 - 性能:剥离 namespace 时按需重建 input(Wei-Shaw#7910) - Antigravity 空收尾流正常结束并续写(Wei-Shaw#7899),本仓修正 finishReason 检测性能与测试 - 前端小修:RPM 覆盖数值(Wei-Shaw#7900)、透传规则开关(Wei-Shaw#7902)、用户名编辑(Wei-Shaw#7903) 测试:go build、go test -tags=unit ./... 全部通过,golangci-lint 0 issues;前端 lint、typecheck、vitest 全量通过;集成测试交 CI。
…ish-reason-continuation
… for empty streams
- 同一请求在不同账号上用尽同账号重试时,只冷却第一个账号,其余账号只排除并记录 gateway.failover_temp_unschedule_skipped - 只取 failover 循环部分;Antigravity MALFORMED_FUNCTION_CALL 部分不合,fork 的 Wei-Shaw#7899 已把兼容空流视为请求级错误且不换号 - fork 的 NextAccountStop 早返回保留在冷却逻辑之前
- 带入上游 11-17 至 11-18 已合的 PR,同步基准更新为 2af3f1e:GPT-6.2 Sol/Astra(Wei-Shaw#8906)、Ultra Fast 分组强制与渠道倍率(Wei-Shaw#8812 Wei-Shaw#8914)、首字前空闲换号受预算约束(Wei-Shaw#8920)、缓存创建 TTL 明细(Wei-Shaw#8174)及两项性能优化;Wei-Shaw#8577 与 Wei-Shaw#8598 fork 已有等价实现。 - 缓存创建 TTL 改用上游 Wei-Shaw#8174,撤回 fork 先前带入的 Wei-Shaw#8237;冲突处保留 fork 的 advisor 用量解析。 - 合入 19 个开放 PR:VS Code IDE 上下文(Wei-Shaw#8929)、Claude Code CCH 签名恢复(Wei-Shaw#8889,默认关闭)、等响应头时发 ping(Wei-Shaw#8964)、408 换号、账号恢复调度与批量编辑等修复,以及 Antigravity 假 429、裸 429 冷却范围、容量 503 换号、空流不冷却(Wei-Shaw#8975 含 Wei-Shaw#8627 新版)。 - compat 空流与 MALFORMED_FUNCTION_CALL 保留 fork 带的 Wei-Shaw#7899 行为,相关上游测试按 fork 行为调整;GPT-6.2 模型名后缀的推理档位补上校验。 - 后端全量 unit、golangci-lint、前端 lint/typecheck/vitest 与 CI 集成测试通过。
Summary
Two Antigravity compat-stream behaviors that showed up together on a local
0.2.13deployment (3040209), plus the model-turn 400 that follows an empty finished step.Does not replace #7753. That PR still owns the #7751 failover change: a signature-only
MALFORMED_FUNCTION_CALLshould switch accounts immediately instead of burning same-account retries. This branch keeps that packet on the existing empty-stream failover path.What we hit locally
Image running: patched
weishaw/sub2apion top of3040209,POST /v1/chat/completions, modelsgemini-3.8-flash-lowandgemini-3.8-flash-medium, OpenCode as the client.Empty
STOPwas retried and the account was temp-unscheduled. A candidate withfinishReason=STOPand no text / thinking /functionCallwas classified asempty_stream. Ops showed repeated 502s on accounts 3 and 5, then a short unschedule. That matches the storm in Antigravity empty_stream storms: a terminal finishReason with no content is retried and unschedules the account #7895. A non-content-filter terminalfinishReasonis now a finished step.SAFETYand the other content-filter reasons still fail over. Usage-only and unparseable streams still fail over.The next turn then got
400 Requests ending with a model turn are not supported.The client writes the empty assistant message into history and sends the next request ending on a model turn. The same 400 already happened before the finish-reason change (8 times earlier the same day), so it is an existing Antigravity restriction.wrapV1InternalRequestnow appends{role:user, parts:[{text:"[Continue]"}]}when the lastcontentsentry ismodelorassistant. A request that already ends onuseris unchanged. Both the OpenAI compat path and nativeForwardGeminigo through this wrapper. This is the same guard the OpenCode plugin@cortexkit/opencode-antigravity-authapplies at its wire boundary.A first cut of (1) also treated
MALFORMED_FUNCTION_CALLas a finished step. That regressed [Bug] Antigravity: MALFORMED_FUNCTION_CALL falls through to stop_reason=end_turn and returns HTTP 200 with empty content #7081 / fix(antigravity): trigger failover retry on empty stream caused by MALFORMED_FUNCTION_CALL #7607. OpenCode sessionses_eeb3938f0ffe52itIOlyOtaBpF(explore,gemini-3.8-flash-low) ended withfinish: stopand no text after the gateway loggedMALFORMED_FUNCTION_CALL. The parent planner recorded an empty subagent result. The follow-up commit puts a content-lessMALFORMED_FUNCTION_CALLback on the empty-stream failover path.STOPandMAX_TOKENSstill finish.After that correction, the remaining failure is Antigravity MALFORMED_FUNCTION_CALL empty stream retries the same account, then finishes as HTTP 200 after keepalive #7751, unchanged. OpenCode session
ses_eeb1dfefeffe3Zo5RC5JEnMJXZ(coder,gemini-3.8-flash-medium) ended with{"message":"empty_stream","type":"upstream_error"}. Request0a289c07, account 3, waited about 33s, then got a signature-onlyMALFORMED_FUNCTION_CALL. The 15s pre-content keepalive had already committed HTTP 200, so failover could not switch accounts. Gateway log:empty Antigravity compatibility stream after keepalive, HTTP 200. This branch does not change that committed-200 behavior. fix(antigravity): switch accounts on malformed empty streams #7753 is the open fix for switching accounts before the response is committed.Related
finishReasonretried and unscheduled the account.MALFORMED_FUNCTION_CALLmust not be returned asend_turn.empty_streamon an already committed 200.empty_streamreports this was showing up as.Test plan
TestAntigravityCompatTerminalFinishReasonIsFinishedStep(emptySTOP, chat completions and responses)TestAntigravityCompatMalformedFunctionCallStillFailovers(RetryableOnSameAccount=true, nofinish_reason: stop)TestAntigravityCompatContentFilterFinishReasonStillFailoversTestWrapV1InternalRequest_AppendsContinuationAfterModelTurnTestWrapV1InternalRequest_LeavesUserEndingUntouchedResidualBlood/sub2apibranchfix/antigravity-finish-reason-continuationis green afterafc1e6cb4