Commit Graph
3 Commits
Author SHA1 Message Date
雪莹ちゃん 8d224796aa gateway: an empty reply from Gemini/Antigravity asks the next member and rests no account (#1221)
A reply that said nothing is a failure of the model or request, not the
account: the account doesn't rest (lateRests skips emptyReply), and the
group's other members of the same model, likely to end empty too, are
asked last (matesLast) while the next member is tried.

From PR #1222 by SnowGlow-aww, reviewed at 9037dd84f. Put onto main
5b14ebf49 by hand: gateway.go's failover loop had main's codexReset block
(#1628) where this one goes, so the empty-reply branch follows it; the new
test file's trailing blank line (the review's only blocker, gofmt) is gone.

Run (-tags nogui, sandbox HOME, private GOCACHE):
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows;
  build on all three.
- -race: TestGeminiEmptyReplyGroupFailover, TestLateRestsEmptyReply,
  TestGeminiEmptyRepliesAskedAgain, TestGeminiEmptyReplyIsAnError,
  Antigravity*, CodexReset*: pass.
- Broken by hand: the failover branch off -> TestGeminiEmptyReplyGroupFailover
  red; lateRests' emptyReply clause removed -> TestLateRestsEmptyReply red.
- go test ./...: all pass; internal/provider timed out at 10m under the
  machine's load (other suites running) and passed alone with -timeout 30m
  (666s). It's untouched here.
2026-10-13 08:54:20 +08:00
yetone 8d3cf5f86e gateway: a Gemini reply that says nothing is asked again on the same account before it fails, so a long conversation that ends with only reasoning a few times running goes on instead of stopping the agent (#667, tianshuo886)
antigravity/gemini-3.8-flash, deep into a long Pi session, ended its turn with only its reasoning three times in a row; the request's own tries (3, 1s and 2s apart) ran out, Pi got "an empty reply" and stopped until the user typed continue. streamTranslated now asks such a reply again in place: once while the stream is still held (the request's tries and the next account still follow), up to twice once the agent has the stream, when nothing else would. A model that never answers is asked at most 6 times and still ends with the error. What reasoning the agent already has stays; the next try's follows it in the same message.

TestGeminiEmptyRepliesAskedAgain (chat and Anthropic: three empties running end in "hello", one message_start; one that never answers errors within 6 calls) is new and fails without the change. go vet, go build (GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass.
2026-10-06 01:14:50 +08:00
yetone a742ee10b3 antigravity: a Gemini reply that says nothing is an error, asked again, not a turn ended as it should (#667: antigravity/gemini-3.8-flash handed pi content [] and zero usage as a normal stop, the agent's run ending mid-task; #636 Bug 3) — Antigravity's Code Assist stream (and any Gemini one) now and then ends with a STOP and no parts, with only reasoning, or with no candidate at all. translate passed the decoder's KStop on and finished the client's stream as it does any reply: Chat's finish_reason "stop" and [DONE], Anthropic's end_turn and message_stop, Responses' response.completed, and a non-streamed reply of 200 with no content — nothing an agent can tell from an answer, and nothing the holdWriter took for a failure, so nobody asked again. Now a reply from a Gemini upstream (CodeAssist, Gemini) holds its end (KStop, KUsage) until something is said in it — text, a call, a search, an image — and one that ended with nothing said, not cut at its length nor by a safety filter (still a refusal, #248), ends with an error event, "<provider>: an empty reply (the model answered nothing; try again)", or a 502 when not streamed. As a 502 before any content it is held, asked again of the same account (lastRetries) or of the next one, and an agent told it retries rather than ends its turn, as Cursor's and Devin's empty replies already are. Other upstreams aren't changed: Claude ending a turn with nothing after a tool's result is its answer. TestGeminiEmptyReplyIsAnError (Factory's Gemini route, which shares the decoder and translate: STOP with no parts, only reasoning, no candidate; Chat, Anthropic and Responses streamed and Chat not; asked again; text and reasoning cut at MAX_TOKENS still go as they came) fails on the old code with the issue's wire shape and passes. Against the owner's real Antigravity account in a sandbox gateway (temp HOME, port 3488): a prompt asking gemini-3.8-flash-low for no output gave, on the old build, finish_reason stop with no content 3/3, and on this one the error event after the retries 3/3; ordinary replies on Chat (streamed and not), Anthropic and Responses, and a bash tool call, are unchanged. go vet, builds (darwin, GOOS=linux -tags nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass (a first run had TestClaudeAccountNamedAsItsLogin and an internal/gui fetching test fail, timing tests that passed on the rerun). 2026-10-03 19:07:36 +08:00