Gemini 4 Hydrogen's xhigh variant was sent with thinkingLevel "high":
thinkingConfig's level chain had no xhigh case, so any effort at or
above high came out as high. Google lists LOW, MEDIUM, HIGH and XHIGH
for that model. A variant whose own level is xhigh is now asked at
xhigh; a model with no xhigh variant still goes at high, as before.
The same fix shipped in the antigravity plugin 0.1.18 (df7d7ae0 in
magpie-community/plugins); this is the built-in's side, which still
serves accounts not yet moved.
Run: go test ./internal/gateway -run CodeAssist on mote: ok.
Broken by hand: with the new branch off, TestCodeAssistAntigravityLevels
is red on both hydrogen-xhigh rows ("at high, want xhigh").
Not tried: a real Code Assist request at xhigh; no account here is
served Gemini 4, so Google taking "xhigh" there rests on its model list.
Claude Desktop on antigravity/gemini-4-carbon failed 403 of 408 requests:
400 "Request contains an invalid argument", 502 empty reply after 170-230s,
and 200s marked failed with output tokens.
Changed, in internal/gateway:
- A tool name starting with a digit or a dash (MCP tools named for an id)
goes to Google as _x_<name> and comes back without it; a property with no
name is left out of the Antigravity schema. Both turned the whole request
away on a live call.
- A MALFORMED_FUNCTION_CALL / UNEXPECTED_TOOL_CALL finish carries the call
in finishMessage; it is now made the call instead of reading as an empty
reply (tokens spent, then asked again for nothing).
- passing(): a 502 empty reply is asked again once, not lastRetries times on
top of the in-place emptyRetries.
Run (mica): go test -run 'TestCodeAssist|TestEmptyReply' ./internal/gateway;
the new tests are red on the old code (names, malformed case).
Live (owner account, gemini-3.8-flash): names with a digit/dash first, a
space, unicode, a slash and an empty property key each 400; 64 and 100 char
names are 200.
Not tried: real gemini-4-carbon (the account lacks it, 404), so the user's
exact 400 is not reproduced; the finishMessage form is Google's documented
shape, not captured from Carbon.
What the user saw: Codex on Google Vertex AI (gemini-3.8-flash) failed
every compaction that came right after a tool's output with
"Google Vertex AI: Requests ending with a model turn are not supported."
Why: codexInput turns compaction_trigger into a user message holding the
compaction prompt; mergeTurns and then buildCodeAssistSent merged it with
the function_call_output's user turn, so Gemini got one user content
holding a functionResponse and text. Vertex answers that with the
"ending with a model turn" 400 although the last role is user; #1533
showed the same history with the two as separate user contents gets 200.
What changed:
- buildCodeAssistSent (every Gemini-shaped request: Vertex AI, Factory's
Gemini, Gemini CLI's and Antigravity's Code Assist, Google sign-in)
puts what the user said after tools' responses in a user turn of its
own, and never merges text into a responses turn or the other way.
Tools' images stay with their response; parallel calls' responses stay
in one turn. A Claude model on Antigravity keeps its single tool_result
turn as before.
- It also never ends contents with the model's turn: a user turn goes
after it ("Continue.", or compactLastText when an agent compacts with
the ask in its system prompt). prefillRefusal knows Gemini's wording.
- docs/subsystems/gateway-routing.md says both.
Tests: gemini_model_last_test.go uses #1533's exact Responses request
(read_sample / call_diagnostic_1 / compaction_trigger) on /v1/responses
and Codex's path against a fake Vertex that refuses as the real one did;
with the split disabled it fails with the reporter's exact message, and
TestGeminiToolResponseTurnHoldsNoText fails for all four builders.
ump45nose's fork patch on #1533 (93a2afca) found the same cause and
split the turn on Vertex AI only; this does it for every Gemini builder,
and takes its Anthropic case (a tool_result beside text in one message)
into the end-to-end test, which fails on the old code too.
TestBuildCodeAssistForGemini, TestCodeAssistToolImagesAfterEveryResponse
and TestGeminiHistoryOpeningWithModel held the old one-turn merge (from
637b2458, a choice, not a fix for a report) and now expect the question
in a turn of its own.
Run: go test ./internal/gateway ./internal/provider, the full
go test -tags nogui ./... (queue lock), gofmt -l, go vet -tags nogui for
darwin, linux and windows.
Not tried against real Vertex AI: no Vertex credentials on this machine.
Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com>
fitAutoModeClassifier asks a model to think at its least level (#250). On
a Gemini 3 Flash whose models.dev levels include minimal (gemini-3.5-flash,
3.1-flash-lite, 3-flash-preview), that level is minimal. thinkingConfig
sends minimal only to an Antigravity variant whose id says minimal, and
everything else fell through to high. So the classifier, asked to think
least, went at the most, with 2112 tokens to think and answer in.
Sending minimal instead isn't safe. Gemini CLI's 3.5 Flash goes out as
3.8 Flash where that is rolled out (geminiFlags.wire), and 3.8 Flash has
no minimal: AI Studio answers it with a 400.
Reasoning off (minimal or none) with no variant level now goes at low,
which every Gemini 3 text model lists. An image model may have no low
(3.1 Flash Image has minimal and high), so it still goes at high, as
before. Every other case is unchanged: a variant's own level, low, medium,
high, no effort, and Gemini 2.5's budgets. The comment saying Flash takes
minimal, low, medium and high is corrected. Factory's Gemini route
(buildGemini) builds its request with the same code, and gets the same
change.
TestCodeAssistReasoningOffAtLow sends Claude Code's classifier request
(autoModeAsk) to Gemini CLI's gemini-3.5-flash and to Antigravity's
gemini-3.1-flash-lite, with models.dev's levels. Both go at low. It also
asks an image model at low, which fits to minimal; that goes at high.
* With the parent's codeassist.go it fails with: the classifier on
gemini's gemini-3.5-flash: "minimal" at "high", want minimal at low.
Antigravity's 3.1-flash-lite fails the same way.
* Without the image check it fails with: gemini-3.1-flash-image asked
low: at "low", want high.
Verified with the commit before. Not tried live.
Checked with the owner's real Antigravity account: two Reads that each
return a PNG fail on claude-sonnet-4-6 and claude-opus-4-6-thinking
before, and both answer with each file's own colour after. Gemini on
Antigravity keeps each image beside its response.