e4e9eb0928becfa4e48484dde85ef5032671d582
58
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6e6a18edac |
gateway: a Code Assist variant at xhigh is asked at xhigh (plugins#1169)
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.
|
||
|
|
ea4ab91906 |
gateway: a recording a tool returns reaches Gemini as inlineData (Parlevent_ on X)
A Chat tool message's input_audio part was dropped: toolOutput read a tool result's text and images only, so after |
||
|
|
e6e0585bd3 |
antigravity: reword Hermes', OpenCode's, Codex CLI's and pi's identity lines, which Google refuses since 11-14 evening
Since about 18:43 on 11-14 Antigravity answers 429 "Resource has been exhausted" to a system instruction holding "You are Hermes Agent" (Hermes' current persona), "You are OpenCode", Codex CLI's "You are a coding agent running in the Codex CLI" or pi's "a coding assistant running inside pi", whatever quota is left (@ZhouYimingsjtu, @Lmohn39 on X). Hermes' earlier persona is still refused as "You're … created by", so it keeps its "built by". Tried on a real account (gemini-3-flash), each alone: Codex GPT-6's prompt, Claude Code, Gemini CLI, Qwen Code, Cline, Kilo, goose, Amp, Droid, Kimi, Aider and Cursor pass as written. agTurnedAway gains the four lines; agSaidAs rewords them "You're …" and "running within pi", the smallest change that passed 5/5 on the real account (gemini-3-flash: pi 1.5.0's full default prompt, both Hermes personas, OpenCode's first lines, Codex CLI's prompt; claude-sonnet-4-6: pi 5/5), through the antigravity plugin's cloak, which has the same lines (plugins a617ecfd, antigravity 0.1.16, agy-cli 0.1.48, antigravity-cloak 0.1.9). The refusal's hint names the agent: new OpenCode, Codex CLI and pi hints, Hermes' covers both personas, word for word the plugins' and the Routing page's (client.js HINTS, i18n zh/zh-TW/ja/de). Run (mica; mote was over its 18 cores): - go test ./internal/gateway -run 'Antigravity|Cloak|CodeAssist': ok - go test ./internal/gui: ok - GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway ./internal/gui: ok - node --test i18n-keys, i18n-en-no-cjk, routing-ag-turned-away (both engines): 38 pass - gofmt -l: clean Broken by hand: with the pi and OpenCode lines out of agTurnedAway, TestAntigravityCloakRewordsEveryLineItTurnsAway and TestAntigravityHermesHint go red. Not run: the full go test ./... (mica had another session's full suite running, mote over load) and the whole GUI suite; the change is strings in four tables plus the hint switch. |
||
|
|
3e38e4ba21 |
antigravity: Codex's GPT-5 line goes reworded in a user's turn too
@daoche_wuzui (X, v0.1.4131, Antigravity Cloak 0.1.7) still got 429s on
Antigravity. Since 11-14, Google answers a bare 429 "Resource has been
exhausted (e.g. check quota)" when either of Codex's identity lines
("You are Codex, an agent based on GPT-5" / "You are Codex, a coding
agent based on GPT-5") is in a user turn. The plugin, the cloak
middleware and the gateway reworded system/developer text only. A
mid-thread developer item becomes a user "<system-reminder>" message in
responses.go, and a pasted AGENTS.md does the same, so the line reached
Google in a user turn as written.
Real account, gemini-3.8-flash, plugin fetch directly:
- each Codex line in a user turn: 429 3/3; reworded "built on GPT-5": 200 3/3
- billing header, Agent SDK, Claude Code, Hermes and RFC lines in a
user turn: 200 3/3 each, so only Codex's two lines are reworded there
- Codex line in the model turn or a functionResponse: 200, left as is
- "You are Codex." alone, "based on GPT-5" alone: 200
So the refusal is about the content, not the account or the model.
Through a sandbox magpie (sandbox HOME, port 3476), plugin 0.1.12 +
cloak 0.1.7, /v1/messages with the line in a user turn: 429 3/3
"Antigravity: Resource has been exhausted". With 0.1.13 + 0.1.8 in place
and the plugin host restarted: 200 3/3. A real Claude Code and a real
Codex request capture still 200 2/2.
- gateway: codeAssistBody rewords Codex's two lines in non-model turns
for an Antigravity account (antigravityCloakMessages), on a copy; Gemini
CLI accounts and prompt=as-written go untouched.
- mover min 0.1.12 -> 0.1.13 (plugins fb7bbebd: plugin 0.1.13, cloak
0.1.8; both in the dist branch's index.json, checked after publish run
43566168677; its npm job is red on middleware-system-prompt only,
plugins#887).
Run on mica at e0f856ec0 (this change on origin/main
|
||
|
|
1248dc16c7 |
gateway: Gemini's own tools (Google Search, URL context, code execution) reach Gemini (daoche_wuzui on X)
daoche_wuzui (X, v0.1.4095): magpie's Gemini route ignored Gemini's built-in
tools. A generateContent body's googleSearch/urlContext/codeExecution were
dropped in parseGemini, so the model never searched and no
groundingMetadata came back.
- ir.Request carries GoogleTools. parseGemini keeps googleSearch (and
google_search_retrieval), urlContext and codeExecution; chat's tools
read them in both shapes ({"googleSearch":{}} and {"type":"url_context"}).
- buildCodeAssistSent, shared by Code Assist, AI Studio, Vertex and plugins
spoken to on Code Assist, sends them when no function is declared
(Google refuses built-ins beside functionDeclarations), Gemini models only.
- A plugin whose API is googleapis.com (Antigravity) now searches itself
for Anthropic web_search, like the built-in Gemini accounts.
- The Gemini reply carries groundingMetadata (chunks + webSearchQueries),
streamed and not; executableCode/codeExecutionResult parts are read
as text instead of being lost.
Run:
- mote-run at 3dc1f13ed (before rebasing onto 27 newer commits):
go test -tags nogui ./internal/gateway ./internal/provider ok (916s, 139s);
go vet both; GOOS=windows go vet ./... ok; GOOS=linux go vet -tags nogui
./... ok; gofmt -l clean.
- At 80f1e05a3 (the rebase after it only took agent, claude and davsync commits): go vet and GOOS=windows go vet of gateway and provider ok; go test -run "Gemini|CodeAssist|Search|Google|Antigravity|AIStudio|Vertex|Chat|Plugin" ./internal/gateway ok (83s); go test ./internal/provider ok (136s).
- Broken by hand, each red: googleToolsFor, googlePlugin, the reply's
grounding, the ranCode decode, chatGoogleTool.
- Real account, sandbox HOME (Antigravity plugin, gemini-3.8-flash-low),
the plugin patched in the sandbox to log what magpie sent it:
- generateContent with googleSearch+urlContext+codeExecution: the three
tools reached the plugin, the reply had groundingMetadata (3 chunks,
webSearchQueries).
- streamGenerateContent: groundingMetadata in the stream.
- /v1/chat/completions with {"googleSearch":{}},{"type":"url_context"}:
both reached the plugin, a grounded answer came back.
- /v1/messages web_search_20250305: googleSearch sent, the reply had
server_tool_use + web_search_tool_result.
Not tried: an AI Studio key or Vertex account (unit tests only); the
Gemini CLI account (Google refuses individual Code Assist now); real
code-execution parts (Antigravity's model wrote code as text); whether
Antigravity honours urlContext (a fetch gave the same stale page with and
without it). Anthropic web_fetch is not mapped to urlContext. The full
./... suite is queued behind six runs on mote's suite.lock and had not
run when this was pushed.
|
||
|
|
b325718f0a |
antigravity: turned-away lines go reworded, not broken up; Antigravity min 0.1.12 (#1118)
Since 11-14 Google's check reads past invisible characters. A system prompt with Claude Code's billing line and Agent SDK line, broken up with two U+200B in every word as the cloak sent them, was turned away 5 of 5 with the bare 429 "Resource has been exhausted". Claude Desktop's Code tab through magpie to Antigravity failed every turn (hc295971796 on X, tweet 2121429628019781849), and on v0.1.4110 with the Antigravity Cloak plugin Antigravity hit 429 very often (daoche_wuzui, tweet 2121432333769433178). The built-in cloak (codeassist.go) now rewords each line Google turns away, in plain words: - the x-anthropic-billing-header line is left out to its line's end; a system part or message holding only it is dropped; - "built on Anthropic's Claude Agent SDK" -> "built on the Claude Agent SDK by Anthropic"; - Codex's "based on GPT-5" -> "built on GPT-5"; - Hermes' "created by Nous Research" -> "built by Nous Research"; - omp's RFC "keywords" -> "key words". A copy an older magpie or middleware broke up (U+200B, U+2060, soft hyphen, inside or between words) is matched and reworded as the line. The Code tab's main line passes as written and is kept. The plugins repo's packages carry the same rewording (plugins 5bb41941: opencode-antigravity-auth 0.1.12, opencode-agy-cli-auth 0.1.41, middleware-antigravity-cloak 0.1.7 on the dist branch). The Antigravity mover's min goes to 0.1.12, the version dist has (these packages are not on npm); the cloak middleware is Official and updates itself. Run: - real Antigravity account, sandbox HOME, gemini-3.8-flash, 10 sequential requests each through the new plugin: Code tab main prompt as Claude Desktop sends it 10/10 200, Agent SDK subagent line 10/10, an old two-U+200B copy 10/10, Codex GPT-5 10/10, Hermes' earlier persona 10/10, omp's RFC line 10/10. The zero-width break went 0/5. - mote-run: gofmt -l; go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet of internal/gateway, provider, cli; go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/ ./internal/cli/ ./internal/middleware/: all ok (gateway 926s); vet clean, gofmt clean. Broken by hand: codeassist.go from origin/main with these tests: 6 fail (TestAntigravityCloakClaudeCode2316, ...RewordsEveryLineItTurnsAway, ...AnswersHermesAndCodexByDefault, TestOnlyAntigravityIsSentThePrompt Reworded, ...LineWrappedOrWidened, ...TurnsCodexsGPT5ThreadAwayOnce). Not tried: models other than gemini-3.8-flash; the whole go test ./... (only the four packages this touches); Claude Desktop itself (its Code tab's system prompt was captured and replayed instead). |
||
|
|
0b64846bf7 |
gateway: Antigravity's cloak says omp's RFC 2119 line as "key words", and finds every turned-away line in any white space
eric_li8983 (X, 11-14): oh-my-pi (omp) on Windows with an Antigravity
account got "Antigravity answered 429 to this system prompt" for omp's
first line, "RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY,
OPTIONAL." (omp 18.20.0's system-prompt.md, advisor/system.md and
live-instructions.md all start with it, byte for byte).
The built-in Antigravity path didn't know the line at all, and matched
the other turned-away lines only with single spaces. On a real account
on 11-14, Google's check turned omp's line away wrapped with LF or CRLF,
indented, with a tab, two spaces or a no-break space, so a literal match
misses copies that are refused. Now:
- agTurnedAway has omp's line, and each line is matched in any case with
any run of white space between its words (agLineRe, agSpace: JavaScript's
\s, as the plugin matches), Codex's and Hermes' lines too.
- omp's line goes as "RFC 2119 key words: …" (RFC 2119's own term), its
white space as it was, rather than broken up by zero-width spaces: a
broken-up copy was still refused 1 to 3 times in 10 (U+200B, U+2060 or
a soft hyphen alike), "key words" 0 in 30 (plugin numbers below).
- A refusal of it gets its own hint (antigravityRFCHint, word for word the
plugin's RFC_HINT), shown on the Routing page (AG_RFC) in en, zh, zh-TW,
ja and de.
The plugin half is magpie-community/plugins 4170d0e8 (antigravity 0.1.11,
agy-cli 0.1.40, antigravity-cloak 0.1.6); the next commit raises the
mover min to it.
Real account (sandbox HOME, copy of the live Antigravity account,
gemini-3.8-flash, sequential, through the plugin's same rewrite): omp's
literal prompt 10/10, the full template 10/10, the line wrapped after
"REQUIRED," 10/10. Zero-width before it: 3, 1 and 5 bare 429s in 12 each.
Run at this tree (rebased on
|
||
|
|
8c0c2e8b6b |
gateway: Antigravity tool names, malformed calls and empty-reply retries (fwxkogaia on X)
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. |
||
|
|
65cb76ca2e |
gateway: Copilot's Gemini gets tool schemas of six shapes it took as 400 (ProgCZ, tmhyt1 on X)
Copilot answered 400 to an MCP tool schema with an array-level enum, a root
oneOf or anyOf, prefixItems, an anyOf beside its own type, or an object
without properties at the root. copilotGeminiToolShapes (after
copilotGeminiToolUnions) writes each as the nearest schema it takes:
properties {} added; same-type anyOf merged (null kept as anyOf with null);
an anyOf with an untyped branch dropped, so geminiTypes types the node;
array enum moved to string items or dropped; root union an object with the
branches' properties, none required; prefixItems / items-as-list one items
schema. Nested oneOf and fit schemas go byte for byte. Antigravity's
plainSchema had the same array-level enum and now moves it to items. A
same-type object anyOf that wasn't provably disjoint is now merged instead
of refused (TestCopilotGeminiKeepsUnprovenUnions uses mixed types now).
Real Copilot account, sandbox magpie (own HOME, only the copilot login),
gemini-3.8-flash and gemini-4-argon, build without the pass -> with it:
array enum 400->200, root oneOf 400->200, prefixItems 400->200, root anyOf
(strings, objects, untyped) 400->200, anyOf beside type 400->200, root
{"type":"object"} 400->200, fit control 200->200. Nested object-without-
properties and nested typeless same-type anyOf were already 200 on the old
build, so the reports' failing forms are the root and type-beside ones.
Run: new TestCopilotGeminiTakesToolShapes (8 rows, red on the old code with
the call unwired), TestCopilotGeminiToolShapesLeavesFitSchemas,
TestAntigravitySchemaArrayEnumMovesToItems, -run Copilot|Antigravity|Schema
on internal/gateway ok (mote); vet darwin, windows, linux nogui ok.
Not tried: the full gateway and provider package run (mote busy, still
going when tagged); Google AI, Vertex and Antigravity with real accounts;
the GUI suite (no GUI file touched).
|
||
|
|
3297243184 |
gateway: Antigravity gets DeepSeek Harness's @-path paragraph reworded (plugins#1028)
DeepSeek Harness's desktop app puts one paragraph on @ paths in every
system prompt. With it word for word, gemini-4-argon on Antigravity
answered most requests in about 3s, with no thinking, and stopped after
one shallow step. The reporter found that removing just that paragraph
fixed it, and a recorded DSH request with the paragraph reworded was
answered normally 20 of 20 times. The antigravity plugin 0.1.7 now sends
it reworded; this is the same for magpie's built-in Antigravity.
codeAssistBody, for an Antigravity account and unless the prompt is set
to go as written, now sends antigravityReword(antigravityCloak(system)).
antigravityReword replaces each exact paragraph in agReworded with a
rewording that says the same, and leaves the rest alone. The caller's
request keeps the system prompt as written, as it does for the cloak.
Run (mica, at origin/main
|
||
|
|
7b5c069c3a |
gateway: Vertex AI gets a tool's image in a user turn of its own, no "Requests ending with a model turn" after view_image (Voo_Ler on X)
What the user saw: Codex on Google Vertex AI stopped right after "Viewed an
image" with "Requests ending with a model turn are not supported".
Why: Codex's view_image answers with a function_call_output whose output is
[input_text, input_image] (as ~/.codex/sessions rollouts record it). The
Gemini build kept a tool's images in the same user turn as its
functionResponse. Vertex AI answers a response turn mixing in anything else
with that 400 although the last role is user (#1533 showed it for text, and
|
||
|
|
3d8510f324 |
gateway: an image Gemini doesn't read goes as PNG or a note, not a refused turn (fwxkogaia on X)
A Claude Desktop conversation on antigravity/gemini-4-carbon was turned away several times with "Antigravity: Request contains an invalid argument." (Anthropic to Gemini, 1.3 MB, the last input a tool result). Antigravity's model list says what Gemini 4 reads: png, jpeg, webp, heic, heif among the images. magpie passed an image block's media type through as it came, so a GIF, an SVG, or an image block with no type went to Google as it was, and since a history keeps it, every later turn failed. geminiInline now sends such an image as a PNG when Go can read it (a GIF's first frame), names a type from the bytes when the block gave none, and puts a short note in its place when it can't be read. It covers images in messages and in tool results, for every Gemini route that builds through buildCodeAssistSent. Run: TestGeminiRequestHasOnlyImageTypesGeminiReads (Antigravity and Gemini routes), red with the two call sites put back, green with them. On mote: go test -run 'Gemini|Antigravity|CodeAssist|Vertex|Image|Agy|Factory|Zed' ./internal/gateway ok, go vet for darwin, windows and linux nogui clean. Not reproduced: the reporter's own request. The owner's Antigravity account answers every generate call 403 (no licence) and Gemini 4 Carbon is listed disabled, Ultra only, so the live call could not be tried. The image type is the cause the model list supports, not one seen in their request; the other suspects (tool schemas, thinking level, tool_result shape, size: Carbon's window is 1M) already have handling or don't fit. The full suite was not run. |
||
|
|
3ebb1ba2cb |
gateway: Antigravity's refused lines get two zero-width spaces a word, not one after the first letter (shzutbi1 on X)
Claude Code's chats on Antigravity answered 429 "Resource has been
exhausted" again. Reproduced on the owner's real Antigravity account with
Claude Code 2.1.316's own system blocks (claude -p captured through a
local server): both x-anthropic-billing-header and "built on Anthropic's
Claude Agent SDK" are still turned away, and the first-letter break the
cloak made ("x", U+200B, "-anthropic...", "b", U+200B, "uilt on ...") is
turned away too, so the cloak did nothing. Bisected on the account:
a break after the second character, two breaks, or a break in each word
of the line go through (3 of 3 each); a break after the third character
of "x-a" does not. Codex's and Hermes' lines now go through as written.
antigravityCloak now puts a zero-width space after the first and the
second character of every run of three or more letters or digits in each
matched line. The full captured Claude Code prompt with that transform
was answered 3 of 3 on the real account. The refusal is still told
against the prompt as written (hint, 400, no rest), unchanged.
Run: go test -run Antigravity ./internal/gateway on mote (ok), gofmt,
go vet darwin, linux nogui, windows. New TestAntigravityCloakClaudeCode2316
pins the real prompt's output. antigravity_codex_test.go and the Codex
check in antigravity_cloak_test.go read the sent prompt past the breaks.
The old test expectation (first letter only) was changed, not broken by
hand: the old code can't compile against the new helper.
Not run: the full suite (started after the tag), a sandbox magpie binary
(the transform was sent through the live gateway's real account), Hermes
and Codex lines against the real account beyond "as written goes through".
The community plugins carry the same cloak and are fixed in
magpie-community/plugins (antigravity 0.1.1, antigravity-cloak 0.1.3).
|
||
|
|
59d9f5c7d9 |
gateway, redact: compile their 275 package-level regexps on first use, not at every start
magpie is one binary, so every package's init runs on every launch, including `magpie statusline`, which Claude Code runs on every message. internal/gateway and internal/redact compiled 275 patterns at init: 3.7 MB + 2.3 MB and ~38k allocations per launch, most of them for vendors and rules that launch never reaches. New internal/lazyre: RE holds the source and compiles it through a sync.Once on first use, with the *regexp.Regexp methods magpie calls delegating to it (Of wraps one already compiled, for the user's own privacy rules). A one-off Go AST rewrite turned every regexp.MustCompile in a package-level var (outside func literals) into lazyre.New; the struct fields, map and parameter that hold them took the new type. A bad pattern now panics on first use instead of at start, so TestAllCompile in gateway and redact compiles every registered one. Measured on mote (M5 Pro), sandbox HOME with a copy of real accounts, v0.1.3515 ( |
||
|
|
8c733bb362 |
gateway: a bare JSON error line in an event stream is the vendor's error
zRain (Discord #feedback, Windows, v0.1.3039/v0.1.3041) asked
antigravity/gemini-4-argon high. Code Assist answered 200
text/event-stream, a few thinking events, then ended the body with
{"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT"}}
on a line of its own, no "data:" before it. readSSEAlive and the
passthrough sniffer skip any line that is no SSE field, so the stream
ended with no finishReason and the agent was told "Antigravity: the
reply ended before it was complete" instead of Google's 400.
- sse_bare.go: bareErrors hands such a line (Google's shape, a list
of one, pretty-printed over several lines, OpenAI's {"error":…},
Anthropic's {"type":"error"}) on as the data event it means. Every
other line goes byte for byte, a line under way at once; only a line
starting { or [ waits for its end (held up to 1MB). eventStream wraps
the body with it (passthrough, translated stream and whole reply,
continuation, search), and readSSEAlive wraps every other reader.
- codeassist.go and carriedError take the status the error names
(namedStatus, #4855), so a whole reply's error goes out at 400.
- continuation.go notes that status for routing (namedStatusHeader);
refusal events and Antigravity's own turning away are left as they
were.
- gateway.go: a reply broken off by an error frame that names a 4xx
retryable() calls the request's fault rests nobody, as that 400 does
before the 200.
Plugins: antigravity-cloak only rewrites the request, reads no stream,
so nothing to change there.
Run (mote, at this tree on
|
||
|
|
8daab00a2e |
gateway: a completion call Antigravity's model wrote into its text goes out of the history, the answer it repeated staying (#5091)
What changed
- buildCodeAssistSent (internal/gateway/codeassist.go) hands an Antigravity
request's history through dropPseudoCalls (internal/gateway/textcalls.go).
- dropPseudoCalls rewrites a model turn only when nothing structured is in
it, a whole call written out in its text is there — of a tool the request
offers, its arguments readable by the readers Chat replies already go
through (<tool_call>'s JSON and pairs, an invoke with its parameters),
closed — and the text after it says the call's result again, up to
punctuation, spacing and case. The turn then goes upstream as that text
without the call. msgs is not changed: a fallback builds from the same
request.
Why
- #5091 (Phoenix12580): gemini-4-argon deep in a long session wrote the
completion call it meant into its reply's text — the report's two-sided
SSE capture shows every part Google returned is text, none a
functionCall — so the client ran nothing and read the call's arguments
as the answer's lead. The turn came back in the history as that text,
and every later turn read its own wrapper back and wrote the next one
the same way; clearing such turns from the history restored normal
calls in the report's own controlled try.
Not changed
- A reply that carries its call as text still streams as it came: the
report asks for no call read out of a live reply, and none is made.
- The gemini and vertex requests keep their histories as they came; the
report is the Antigravity route.
- A wrapper the readers can't read — a call:default_api: whose arguments
textArgs refuses, a shape with none of the marks, a call example inside
a code fence — stays in the history; the report's conditions are kept
to what can be checked.
- No receive-side counter is added: the reply's decoder has no logger of
its own, and the shapes it reads are the report's own open question.
Run
- TestAntigravityPseudoCallOutOfHistory
(internal/gateway/textcalls_pseudo_test.go): red before the change, the
wrapper, the split-block and the invoke cases each failing with the call
still in the turn, green after, and red again with the ag wiring taken
back out of buildCodeAssistSent
- go test -tags nogui -count=1 -run 'TestAntigravityPseudoCallOutOfHistory|TestCodeAssist|TestTextCall|TestTextWritten' ./internal/gateway/: ok 5.016s
- go test -race -tags nogui -count=1 -run 'TestAntigravityPseudoCall|TestCodeAssistTextCalls|TestTextWrittenCall|TestTextCalls' ./internal/gateway/: ok 2.952s
- go test -tags nogui -count=1 -timeout 25m ./internal/gateway/: ok 600.353s
- gofmt -l internal/gateway/codeassist.go internal/gateway/textcalls.go
internal/gateway/textcalls_pseudo_test.go: empty
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./...: clean
- go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok
Reviewed and ported (on origin/main
|
||
|
|
2d04fe73dd |
gateway: Antigravity's tool enums go without a blank value (#5235)
Google's Schema proto refuses a blank enum value, so a tool whose enum holds "" turned every tool-bearing Antigravity turn away with 400 "enum[N]: cannot be empty". Portainer's StatusMessage.operationStatus (enum ["processing","warning","error",""] under allOf) did it for ikunbots' dsh session, reported on X. plainSchema now leaves blank (whitespace-only) values out of a string enum, and leaves the enum out when nothing else is in it; a blank const gives no enum. A number in an enum still drops it whole, as before. Run (mote): go test ./internal/gateway -run 'PlainSchema|Antigravity|CodeAssist|GeminiSchema' ok; TestPlainSchemaDropsBlankEnumValues red on origin/main's codeassist.go (the "" went through), green with this. gofmt clean. Not tried: a real Antigravity request with the reporter's Portainer tools. Not changed: Vertex's chat path (geminiSchemaShapes), which relays JSON Schema enums as they come; whether Vertex refuses a blank value too is unknown. |
||
|
|
6e1e3af9e3 |
gateway: an Antigravity schema's array always says its items, tuple or not (#2826)
What changed
- plainSchema (internal/gateway/codeassist.go) now leaves every array
schema with an items object, at any depth:
- a tuple's items (an array, draft 07) collapses to its first member
that says anything;
- an array whose members were said in prefixItems — dropped by the
subset — takes that tuple's first meaningful member as its items;
- an array that still has none gets items {"type":"string"}.
Why
- Google requires items on every schema of type array. Claude Code's
tools (ArtifactData's query.where) say an array of arrays in JSON
Schema 2020-12 tuples, and stripping prefixItems left the inner array
with none, so Antigravity turned the whole request away with 400
"tools[0].function_declarations[3].parameters.properties[query].
properties[where].items.items: missing field". plainSchema is the
Antigravity path only: Gemini CLI and Vertex take the schema as it
came, and no other vendor path strips tuples.
Run
- go test -tags nogui -count=1 -run 'TestPlainSchema|TestCodeAssist|TestAntigravity' ./internal/gateway/: ok (TestPlainSchemaArrayAlwaysHasItems red on
|
||
|
|
2503520f82 |
codexcat: each Codex model takes official Codex's own instructions for it (#3759, #4008, #4783)
Every magpie model in Codex's catalog (model_catalog_json) carried
gpt-5.2-codex_prompt.md ("You are Codex, based on GPT-5"), so a magpie
GPT-6 model, the auto group's included, ran on a GPT-5.2-era prompt while
official Codex sends GPT-6's own template. magpie still writes no words of
its own into the prompt and leaves the identity line alone: each entry now
takes the text official Codex sends that model, word for word.
- A model's slug (the id's last segment) is matched as Codex 0.166
matches one (longest prefix of an official slug): first in the entries
the user's ChatGPT account handed this Codex (models_cache.json), whose
base_instructions and model_messages go over as sent; then in Codex
rust-v0.166.0's bundled models.json (instructions_template only, as an
older Codex may not read 0.166's model_messages), embedded as
codex_instructions.json.
- Any other model, and a routing group, takes Codex's prompt for a model
it doesn't know (models-manager/prompt.md, model_info_from_slug), which
replaces codex_prompt.md: that is what official Codex sends it.
- ownEntry with no base_instructions, and internal/provider's
codexInstructions fallback, take the same official text.
- testdata holds Codex's models.json and prompt.md at rust-v0.166.0;
TestBundledIsCodexOwn fails when the embedded copies drift from them.
- GET /v1/codex/models (a remote Codex's model_catalog_url): entries are
now ~21 KB, so Codex before 0.166's 1 MiB cap holds about 48 of them
(was ~125). Codex 0.166 reads the catalog whole (models_endpoint.rs
passes no body limit), and it sends ?client_version=, so the cap now
applies only to a Codex below 0.166 or one that doesn't say
(codexReadsWholeCatalog). docs/reference.md says so.
- docs/subsystems/agent-wiring.md: a "Codex instructions" row. The
Antigravity cloak's comment no longer calls the GPT-5 prompt magpie's.
Run (mote's disk is full, 100% with other sessions' runs, so on WSL
magpie-desktop through wsl-run):
- go test ./internal/codexcat/: ok. go vet -tags nogui ./... and
GOOS=windows go vet ./...: ok. gofmt -l: clean.
- go test -tags nogui -count=1 -timeout 45m codexcat, provider, agent,
gui, gateway (every package that imports codexcat): codexcat, provider,
gui ok. agent: TestGrokInstalled and TestOmpDetectedWithPiDir red, the
same at origin/main
|
||
|
|
f2ae7bdecc |
gateway: plainSchema judges a self-reference by whole segments (#4561 review)
The previous commit's selfRef took a $ref as a self-reference when the
walk's path began with the ref's pointer as a string. So
"#/properties/a" inside /properties/ab, a sibling, was cut down to
{"type":"object"} instead of being resolved. A self-reference is now
the pointer itself or one of its containers: path == ref, or path
begins with ref + "/".
A "#/…" pointer that names nothing where it points also falls back to
its last segment as a $defs or definitions name again, as every ref did
before pointers were walked ("#/components/schemas/Mode" with Mode in
$defs).
TestPlainSchemaSelfRefBySegment covers both.
Broken by hand: selfRef and localRef back to the previous commit, test
kept. Red: "inner" and "mode" both go out as {"type":"object"}.
Not tried: a real Antigravity request with dsh's tool schema. The
fix is in the flattening, and the gateway tests send the result
through a fake upstream.
Run (on mote, through mote-run):
- Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack
on
|
||
|
|
abaf2c4e8f |
gateway: plainSchema resolves a $ref into properties (#4561)
A $ref that points inside the schema ("#/properties/func/properties/
triggers/items", as dsh's tool parameters carry one) is a local JSON
pointer like a "#/$defs/x" one, but plainSchema read a ref only by its
$defs or definitions name: the pointer's last segment named nothing
there, and the field it stood for went out as a bare {type: object} on
the Antigravity path, the tool losing that field's shape.
Any local pointer is resolved now, where it names; a self-reference —
a ref to the site or one of its containers — stops at the target's
type alone, as the plugin's googleSchema has it.
A test with the error's path fails on the old code.
Reviewed and applied from #4561 (ggbdpq, branch head ab39ddcbc; the
patch's SHA-256 matches the issue). A review fix follows in the next
commit: selfRef matched a pointer as a string prefix.
Broken by hand: plainSchema back at main with the test kept, and
TestPlainSchemaResolvesPointerIntoProperties fails ("again" goes out as a
bare {"type":"object"}).
Run (on mote, through mote-run):
- Full `go test -tags nogui -count=1 -timeout 45m ./...` with this stack
on
|
||
|
|
7e0fe83d4b |
provider: Listed as works for signed-in accounts and plugins (zeewell on X)
zeewell asked to list SuperGrok's grok/grok-4.6@500k as grok-4.6, and Cursor, Devin and WorkBuddy models (all plugins) under ids of their own. v0.1.2345's "Listed as" took ids only for key/relay providers (takesModelIDs was p.Account == nil). Why the restriction was there: the wire rewrite (Settings.Wires) turns the request body's model back into the own id, but some code reads the model by the vendor's id before that and got the listed one: - plugin model lookup (pluginModel: the plugin's APIs, tiers, prices); - the Claude subscription run (--model given to Claude Code); - Code Assist/Antigravity variant choice (codeAssistBody, SentNameOnIn); - account plan lists (fallback's Account.Lists, effort Levels/Tiers, AccountServes); - moveModelRefs refused a provider with no providers.json entry, which is every plugin and account provider until a pick is set. Each now translates with OwnModelID / the provider's ModelIDs, so the upstream request still carries the vendor's or plugin's own id. Only a decide-only provider refuses an id. The GUI box already follows TakesModelIDs, so no GUI file changed. Tests (red on the old code, each fix reverted by hand one at a time): - TestModelIDRefused, TestModelIDAtAnAccount (takesModelIDs, AccountServes, SentNameOnIn); - TestLocalModelIDAtAPlugin (Bun fake plugin: /v1/models, upstream path, X-Plugin-Model, body, usage; red on pluginModel and on moveModelRefs); - TestLocalModelIDAtAnAntigravityAccount (codeAssistBody); - TestLocalModelIDAtAClaudeAccount (claude got --model my-sonnet); - antigravity pool test (fallback Lists, Levels). Run on mote: gofmt clean; go vet darwin/linux/windows ok; go test -tags nogui -count=1 -timeout 45m on internal/provider, gateway, cli, gui, settings, access, usage, plugin: all ok except internal/gui's TestSettingsSaveKeepsWhatItDoesNotSend (SearchAll), red on main since |
||
|
|
b1a1b950fe |
routing: the classifier asks its model not to think (tangtang969 on X)
"classifier的模型调用可以加上不带思考的参数么?提速效果比较好". A routing
group's classifier (and its effort question) asked its model for the
least level on its list, and nothing at all when the list was unknown,
so a relay's reasoning model thought at its vendor's default before
answering a number.
Now classifyEffort asks for none, reasoning off, and each wire fits it
with the code that already fits a client's none:
- Chat/Responses: a model with none gets none; one without gets its
lowest (fitFor: low, minimal), as before; one whose levels aren't
known gets none (as auto mode's classifier does, fitAutoModeClassifier).
- Anthropic: thinking {"type":"disabled"}; Opus 5.5, which refuses it,
still has it left out (thinkingOffAsTaken).
- Gemini API / Code Assist 2.5: thinkingConfig.thinkingBudget is the
off budget (0 for Flash and Flash-Lite, 128 for Pro, as Vertex already
did) where a Chat none went as low's 4096. Gemini 3 is unchanged (low).
- A model the user marked as taking no reasoning ask (Reasonless) is
sent none at all; a routing group as classifier is left as before.
- An upstream that turns the effort away (unknown reasoning_effort
field, or the level) is asked again without it and remembered
(askLeast), so the classifier keeps answering.
The Image recognition model keeps its old least-level rule
(leastEffort); only the classifier changed.
Run (mote-run, this tree on origin/main
|
||
|
|
024393fbb9 |
gateway: a Codex mode switch keeps its developer role on a translated Responses turn (#2532)
Refs yetone/magpie#2532 (the Responses-to-Responses translation case). An offered web_search can select translation even for a Responses upstream. Keep system/developer items in place instead of lifting initial Plan instructions and demoting a later Default update to a user reminder. Other APIs and the Claude bridge retain their existing cache mapping. Update the gateway routing reference and cover search continuation rounds. Verification on macOS arm64 with Go 1.26.10, isolated HOME and pinned caches: - New tests on unmodified |
||
|
|
ed9d849a21 |
gateway: a Gemini client's imageConfig reaches every Gemini upstream (#3820)
GuoJinguang (#3820): a Gemini client's generateContent asking a gemini-*-image-preview model for generationConfig.imageConfig {"imageSize":"4K"} drew 1024x1024 through magpie, where the same request straight to their relay drew 4096x4096. The picture came, at the model's default size, and nothing said the size had been dropped. parseGemini didn't read imageConfig, so wherever magpie builds a Gemini client's request again it was gone: a request asked for one body to a Gemini API that isn't Vertex AI (always translated, since attempt asks a Gemini API streamGenerateContent and reads the stream back into one body), and every request to Code Assist or Antigravity, which go in their envelope. A streamed request to a Gemini API, and a Gemini client's request to Vertex AI, streamed or not, is relayed as it came (passthrough) and kept it. The reporter's request went to the relay's chat completions instead. Their provider has a Chat URL beside its Gemini one, and attempt turns relay off for a Gemini request asked for one body without ownAPI, so it goes to the first API usable gives: Chat, as Speaks puts a custom provider's Gemini last. That default is meant (uaSetup in user_agent_test.go: "Gemini's own wire, which a provider on Chat too isn't asked on"), and Chat has no field for imageConfig. Now parseGemini keeps generationConfig.imageConfig as the client sent it (Request.ImageConfig, raw as Metadata and ClientMetadata are, so Vertex AI's own fields beside imageSize and aspectRatio go on too), and buildCodeAssistSent, which every translation to a Gemini API goes through, writes it into generationConfig: the Gemini API (buildGemini), Vertex AI (buildVertex), and Code Assist and Antigravity in their envelope. A request that asked for none is sent none. Chat, Responses and Messages are left as they were: I found no vendor documenting a field for it there, so none is made up. gateway-routing.md says where imageConfig goes. At a provider with both URLs, a request asked for one body reaches the Gemini URL, and its imageConfig with it, when the user picks Gemini as the API the model is asked on in the provider editor (SetModelAPI, tested below). The next commit sends one that carries imageConfig there by default. Left as on main, each in its own issue: - a Gemini client's image request to a provider with no Gemini URL (the Google Gemini preset's OpenAI-compatible endpoint, OpenRouter, another magpie, a relay saved with a Chat URL alone) carries no imageConfig, asks no modalities, and reads no image back from chat (#3935); - /v1/images/generations and /v1/images/edits send a size to a Gemini image model as an aspect ratio only (drawGemini, drawChat), and to Code Assist only in words (drawCodeAssist), so nothing above 1K can be asked there; a Gemini client's request never takes that path (#3936); - the rest of what a translated Gemini request drops: safetySettings, topK, seed, responseModalities, and the newer responseFormat (Google's next spelling of the same ask), among the fields parseGemini doesn't read (#3937). This commit's tree (2b421ece, on origin/main |
||
|
|
e2b7233499 |
draw: a plugin's Gemini image model draws on generateContent through its fetch
XYenon (magpie-google-ai-studio, Discord) asked how a plugin's image models reach /v1/images/generations and /v1/images/edits. A plugin's model on Gemini's API (@ai-sdk/google) that says it gives images (capabilities.output.image / modalities.output), or is named for them, is now a drawer: Drawers lists it, and draw sends it to drawCodeAssist (pluginDrawsGemini), as a Google sign-in's image models are drawn. That asks generateContent with responseModalities ["TEXT","IMAGE"] through the plugin's fetch, an edit's pictures as inlineData, and reads the pictures from the answer. Request.draws asks for the IMAGE modality of a model not named for images. Imagen (catalog.ImagesAPI, :predict) is left out. The OpenAI-compatible plugin path (SenseNova) is unchanged. Test: TestGeminiPluginDraws (fake plugin $FAKE_GEMINI_DRAWS: a model named for images, one that only says it gives them, an Imagen). Broken by hand: with the old draw.go the drawers are empty (red); with the old codeassist.go the declared-only model is sent no responseModalities (red). Run on mote: gofmt -l clean; go vet ./internal/gateway ./internal/provider ./internal/plugin for darwin, linux (-tags nogui) and windows; go test -count=1 -timeout 45m ./internal/gateway ./internal/plugin ./internal/provider ok at this commit on its first base |
||
|
|
4db65681c1 |
library: a skill named in another script goes by its folder's name, so every one is listed
tnt1223 on Discord: Library › Skills listed 16 skills for https://github.com/asdfgh1445/ctf-super-hub, which has 35 (one folder each at the top, 35 SKILL.md in its recursive tree, not truncated). Cause: the listing found all 35, but nameFor made each SKILL.md's `name` fit for a file name by dropping everything outside ASCII. "CTF•密码学" and ten more became "CTF", "Strix•RCE 测试" and nine more "Strix", "头脑风暴" nothing, and unhiddenFirst lists skills of the same name once, so 35 became 16. Not a depth limit, cap, pagination or truncated tree: the probe downloads the tarball and walks it; a truncated tree and GitHub's rate limit are already said (skilltree.go, fetch). Fix: a declared name that would lose a letter or digit (another script) or comes out empty goes by its folder's name, which a repository keeps apart. An ASCII name goes as before ("My Skill" is still My-Skill), so a skill installed from one is still the library's. A skill at a repository's top now falls back to the repository's name (srcFolder), not the temporary download folder; candidates takes that name from each caller (probe, Group again, CC Switch origin, new-skill check). Tests: TestSkillsNamedInAnotherScriptAllListed probes and installs from a fake of the repository built from its real tree (35 folders, front matter names as written at 7715719); TestSkillNameFallsBackToFolderOnlyWhenLettersAreLost and TestSkillAtTheTopNamedInAnotherScript cover the rule and the top folder. No network. Run: - mote: go vet ./internal/library; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/library; gofmt -l internal docs (empty); go test ./internal/library -run 'TestSkillsNamedInAnotherScript| TestSkillNameFallsBack|TestSkillAtTheTop|TestRepoWithAPlugin|Probe| CCSwitch|Regroup|NewSkill|From' -count=1: ok. - wsl-run (magpie-desktop): go test -tags nogui ./internal/library -timeout 45m -count=1: ok 94.9s. - Live, sandbox HOME (the package's TestMain/testenv), a throwaway test calling ProbeSkills("https://github.com/asdfgh1445/ctf-super-hub") against the real GitHub: 35 candidates, each named by its folder, nothing left out. Not committed. Broken by hand: nameFor using the declared name whenever it isn't empty (the old rule): TestSkillsNamedInAnotherScriptAllListed lists 16 with names CTF/Strix/..., and the rule test fails on "CTF•密码学" and "Café notes". Restored, green. Not tried: the full ./... suite (mote at load ~350 from other runs; only internal/library changed); the GUI suite (no app.js change); Windows test run; installing the real repository's skills into a real agent. Not changed: two different skills declaring the same ASCII name in folders of different names are still listed once, as copies of one skill are (unhiddenFirst). |
||
|
|
efb55b5c92 |
gateway: a schema's own type and properties beside a oneOf reach Antigravity (#4046)
Cause: plainSchema, which cuts a tool's schema down to the subset
Antigravity's function declarations take, read any node with an anyOf or
oneOf as its first branch that isn't null, and threw away everything the
node said itself. Philo's rg tool is an object with pattern and cursor
and a root oneOf of presence rules ({"required":["pattern"],"not":
{"required":["cursor"]}}, …). That first branch has no type, so the tool
went out as {"type":"string"} with no properties, and Claude on
Antigravity answered 400 "tools.4.custom.input_schema.type: Input should
be 'object'". The same held for such a node under a property, and allOf
lost a member's required when it had no properties of its own, or when
the node had a required list already.
Fix: a node that has its own type (other than only null), properties or
items beside an anyOf/oneOf keeps them, and the union is folded in
(foldUnion): a null branch makes it nullable; on an object, a field only
branches declare joins its properties, and a field every non-null branch
requires is required. The rest of a branch (which fields go together, a
"not") is dropped: Antigravity's subset has no union or not, Claude
there refuses a union at the root, and the client still checks a call
against its own schema. So rg goes as an object with pattern and cursor
and no required, which every valid call satisfies. A union with nothing
of its own beside it is still its first non-null branch, as before.
allOf now keeps every member's required (read before the member is
walked) beside the node's own.
Siblings: plainSchema is the only converter that flattens a union to one
branch. buildCodeAssist calls it for Antigravity only; Gemini API and
Code Assist get parametersJsonSchema as it came. provider.ObjectRoot
(objectSchema for Anthropic, the fold for xAI and the upstreams that
refuse a root union) already keeps the root's properties and passes over
constraint-only branches; TestObjectSchemaRootOneOfKeepsObject pins that
for this schema. geminiToolTypes and the Kimi/DeepSeek walkers only add
types or rewrite patterns. The community plugins have no schema
converter.
Tests: TestAntigravityRootOneOfKeepsObject is the issue's own test, and
TestAntigravityChatToolRootOneOfKeepsObject takes the reporter's route
(parseChat -> buildCodeAssist(..., "antigravity")). Both were red on
origin/main
|
||
|
|
d71362afcd |
gateway: a Gemini tool schema with items is an array, not its enum's string, and Antigravity gets items only on arrays (ferock)
ferock on Discord: Claude Code, model group/gemini-3-8-flash on a local magpie whose group is served by a remote magpie's Antigravity, 400 "Remote magpie: Antigravity: GenerateContentRequest.tools[0]. function_declarations[19].parameters.properties[display].items: field predicate failed: $type == Type.ARRAY". It worked in the morning and broke after updating. The tool's literal schema wasn't posted, and no Claude Code 2.1.311 built-in has a display property with items (searched the binary), so it is an MCP tool of theirs. Cause: geminiToolTypes ( |
||
|
|
1885c607e2 |
gateway: Antigravity answers Codex's switched threads and Hermes' old persona with no setup
Antigravity answers some agents' system prompts with a fake 429 "Resource
has been exhausted", whatever quota is left. Jodiezzzzzz on X (10-27): a
Codex thread begun on GPT-5.x and switched to an Antigravity model got 429
again and again. zgoodz on X: "antigravity在Hermes里一样429". v0.1.1625
told the Codex case as a 400 with "start a new chat", which isn't zero
setup.
What Google matches, each tried on a real Antigravity account on 10-27
(in the system instruction, any case):
- "x-anthropic-billing-header:" (Claude Code)
- "built on Anthropic's Claude Agent SDK" ("running within the Claude
Agent SDK" goes through)
- "You are Codex, an agent based on GPT-5" / "..., a coding agent based
on GPT-5"
- new: "Hermes Agent, an intelligent AI assistant created by Nous
Research", Hermes' earlier default SOUL.md, kept by anyone who edited
their SOUL.md. Hermes' current default ("You are Hermes Agent, built by
Nous Research") goes through.
Each goes through with a zero-width space after its first letter.
"You are Hermes Agent, an intelligent..." still fails, so the
break goes inside the matched phrase itself.
Now codeAssistBody puts that zero-width space into each matched line
(antigravityCloak), in the system instruction only, and only for an
Antigravity account. Gemini CLI's account on the same envelope, and
every other provider and protocol, get the prompt as the agent wrote
it. The text added names nothing; it is one U+200B per line.
`magpie provider set antigravity prompt=as-written` (PromptAsWritten,
kept through Save/withPicks and the GUI's save) turns it off. Then the
v0.1.1625/#2156 fallback stands: a 400 with a hint (now one for Hermes
too, in the Routing page's five languages) and Antigravity skipped for
6h in a group.
Default-on, as the community antigravity-cloak middleware's README
says, changes what Google is sent so a request it means to refuse goes
through. That may be against Antigravity's terms. The owner asked for
it ("破解过 antigravity 提示词让其可以在别的 agent 中使用"), and it is
scoped to Antigravity accounts with an off switch.
Run at this tree (rebased on origin/main):
- go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/
./internal/cli/ ./internal/gui/: gateway, cli and gui ok; provider
died in TestUnreadLoginsWriteErrorsKeepCredentials ("close of synctest
channel from outside bubble" in filememo.Forget), #3632, red on main
since 091153bf; with -skip of that test, provider ok.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok. go build: ok.
- GUI (node --test, Playwright 1.62, chromium and webkit):
routing-ag-turned-away, i18n-keys, gui-ja, gui-de, gui-zh-tw,
routing-js, panel-routing: 45 pass, 0 fail.
- Broken by hand: with the cloak skipped, TestAntigravityAnswersHermes
AndCodexByDefault and TestOnlyAntigravityIsSentThePromptBrokenUp go
red; without withPicks' line, "prompt=as-written isn't kept".
- Real account, sandbox HOME with only the Antigravity login copied,
this build on 127.0.0.1:3496:
- real Hermes Agent (AIAgent, sandbox SOUL.md = the old persona plus
one line): "OK", 200. With prompt=as-written: 400 with the Hermes
hint. Back on default: 200.
- real Codex 0.162.1: a thread begun on gpt-5.5 (against a local
fake Responses server), then `codex exec resume <id> -m
antigravity/gemini-3-flash` through this build: "OK". With
prompt=as-written: 400 with the Codex hint.
- a synthetic switched Codex Responses thread, with and without
web_search: 200.
- opencode, droid, kimi, pi, gemini-cli, qwen, crush, goose, amp and
openclaw identity sentences: never refused, as written.
Not tried: Claude models on Antigravity (the sandbox account's Claude
quota is spent, so the Claude Code lines were checked on Gemini 3
Flash only); other agents' whole prompts, only their identity lines;
the Windows box; the whole GUI suite.
The plugins repo's antigravity-cloak 0.1.2 adds the Hermes line for
magpies before this one.
|
||
|
|
b5d17b26e0 |
gateway: Antigravity's 429 to Codex's GPT-5 prompt says why and rests nothing, on the web-search path too (Jodiezzzzzz on X)
From Codex, every call to antigravity/claude-opus-5-5 failed with "exceeded retry limit, last status: 429" while dsh worked on the same account. The call was an agent_created_thread, and the vendor said "Resource has been exhausted (e.g. check quota)". Cause: a Codex thread begun on a GPT-5.x model keeps "You are Codex, an agent based on GPT-5..." as its first developer message after /model, resume -m or a fork, and magpie lifts it into systemInstruction. Antigravity answers that line with a fake 429, whatever quota is left, as it does Claude Code's (#666). Codex also sends a web_search tool every turn, so for an Antigravity model magpie serves search itself (translate -> searchReply -> askTranslated), and that path passed the bare 429 back: no hint, no 400, so Codex retried to its limit. - antigravityTurnsCodexAway: the two Codex GPT-5 opening lines count as a turned-away prompt; antigravityHint picks the Codex hint for them. - antigravityRound wraps the search path's ask, so its 429 and an in-stream refusal get the same 400, hint and no rest as translate's. - antigravityForeseen returns the hint, so a group skips Antigravity for the next 6h saying which prompt. - The Routing page shows the new hint (routing/client.js HINTS) in en, zh, zh-TW, ja and de. - Rest: none. The refusal is about the prompt, not the account (Fail "prompt"); a second account answers the same. Plugins: middleware-antigravity-cloak 0.1.1 (plugins a52d1b3) breaks the two Codex lines with U+200B. Its body says "npm had 0.1.0": wrong, the package is not on npm; dist had 0.1.0 and now has 0.1.1 (6fd1438). No mover applies. Real account (owner's Antigravity, sandbox HOME copy, gateway built from this branch) and real Codex 0.162.1: - codex exec resume <a gpt-5.5 thread> -m antigravity/gemini-3-flash: before, 429 retried to "exceeded retry limit"; after, one request and a 400 with the Codex hint; route try (429, prompt), no rest. - A new Codex chat on the same model: 200. - The two lines with U+200B after the first letter: 200; whole: 400. Broken by hand: - antigravityTurnsCodexAway returning false: the Codex tests go red (Codex got 429; the group's skip doesn't say why). - The antigravityRound wrap removed: the search=true subtests go red ("Codex got 429"). Run: - go test -count=1 -timeout 45m ./internal/gateway/: ok (476s, at 865df2472; main's next three commits touch only GUI files). - go test -count=1 -timeout 45m ./internal/gui/: ok (230s, at the pushed tree on |
||
|
|
b28e5ffd81 |
gateway: an array with no items goes to Antigravity with items {}, and Google's schema 400 falls through (plugins#375)
gcq909893267 (plugins#375): Claude Desktop's own MCP tools __batch and
__guide declare an array property with no items ("batch":{"type":
"array"}). plainSchema passed it through, and Google turned the whole
turn away: 400 "GenerateContentRequest.tools[0].function_declarations
[17].parameters.properties[batch].items: missing field". The group's
next member was never asked.
- plainSchema (codeassist.go): every node it writes that is type array
with no items gets items {}, which Google takes (the reporter's A/B:
{} and {"type":"string"} both 200). Its walk is the one every nested
place goes through (properties, items, anyOf/oneOf members, allOf,
$ref into $defs/definitions, a type list with null), so the check at
the end of a node covers all of them.
- Siblings: plainSchema is the only Gemini-side schema cleaner. Gemini
CLI's Code Assist and Vertex AI / a custom Gemini API go through the
same buildCodeAssistSent but send parametersJsonSchema, full JSON
Schema, where an array with no items is valid; gemini.go's jsonSchema
is the other direction (a Gemini client's schema read in). Left as
they are.
- Fall-through: a 400 that points at a function declaration's
parameters (function_declarations[N].parameters) is now in
shapeWords, so shapeRefused/retryable read it as the request's shape
on that vendor: the next member is asked once, and the member doesn't
rest (Fail "shape", Rest nil), as OpenCode Go's "schema exceeds the
maximum nesting depth" (#1870). Not resting is right: the account is
fine and the same request fails the same on every Antigravity
account; the reporter's same tools answered 200 on a non-antigravity
member. A declaration's name or the contents are not matched. A
shape refusal still tries the same provider's next account first, as
every shape refusal does now; not changed here.
Tests (antigravity_array_items_test.go), fixtures from the reporter's
literal request and error line:
- TestAntigravityArrayGetsItems: the reproduction through
buildCodeAssist(antigravity); both declarations carry items {}.
- TestPlainSchemaArraysAllHaveItems: nested arrays under each keyword
get items {}, an array with items keeps them, a non-array gets none.
- TestGroupFailsOverGoogleSchema400: a group's first member answering
Google's 400 hands it to the second, Fail shape, no rest; plus a
shapeRefused table (Google's both wordings, the agent-facing wrapped
form; a function name and contents error, and a 500, are not).
Run: go test ./internal/gateway/ -run 'CodeAssist|Codeassist|Gemini|
Schema|Antigravity|Shape|FailsOver|Fallback|Region|Retryable|Refus|
Vertex|Plain|Google' ok (307 tests, 31s); gofmt -l clean; go vet,
GOOS=linux go vet -tags nogui, GOOS=windows go vet on internal/gateway
clean.
Broken by hand: codeassist.go reverted, the first two tests FAIL
(declaration 0 parameters.properties.batch: {"type":"array"}); fallback.go
reverted, TestGroupFailsOverGoogleSchema400 FAILs (a 1, b 0).
Not tried: a real Antigravity account (the reporter's own A/B shows
items {} answers 200); the full go test ./... suite; Gemini CLI and
Vertex AI with an items-less array against the real APIs.
|
||
|
|
919c8b934a |
gateway: a second answer to one call is dropped on the way to Gemini and Responses (#2262, ggbdpq)
A client that answers one tool call twice sent Google a call turn with more functionResponses than functionCalls, which Google refuses with 400, along with every later turn of the conversation. The Chat and Messages builds already keep the first answer (pairToolMessages, pairToolBlocks). The Gemini build (buildCodeAssistSent: Google sign-in, Vertex, a custom Gemini provider) and the Responses build (buildResponses) now leave the second one out before they build, with the images it carried (dropSecondAnswers). A call made again under the same id takes an answer of its own, and the request itself is left as it was, since a fallback builds from it again. This differs from the issue's patch. It dedups across the whole history in pairFunctionTurns, keyed by id, or by name when there is no id. Keying by name drops a real answer to a second call of the same function. Keying by id ignores a call made again under that id. The patch also left the duplicate's images in the turn and didn't cover Responses. Also fixed: parseGemini matched a functionResponse with no id to the latest call of that name, so two calls of one function were both answered as the second. Each now goes to the first call of that name still unanswered. pairToolItems (relayed Codex bodies) already keeps one answer per call and is unchanged. Run: - gofmt -l, go vet (darwin -tags nogui, GOOS=linux -tags nogui, GOOS=windows): clean. - go test -tags nogui -p 4 -timeout 40m ./... with the other three commits of this push: see the last one's body. Broken by hand: TestGeminiDropsASecondAnswer, TestSecondAnswerDroppedWithItsImages and TestGeminiClientUnnamedCallsAnsweredInOrder fail on the code before this. Not tried: against Google's or a Responses upstream's real API. Co-authored-by: ggbdpq <ggbdpq@gmail.com> |
||
|
|
eb7199e120 |
gui: Routing is a plugin's page, its script, style and words in plugins/routing (P2)
P2 of docs/subsystems/plugin-runtime.md, the third page after Sessions and Library. - routing.js and routing.css move to assets/plugins/routing/ (client.js, routing.css). Its part's html is the page's head and boxes that were index.html's <main id="view-routing">; the rest is drawn by routingPage, run at mount since it builds on app.js. It keeps itself after that as it did (its own hidden, the language, focus), so its hooks are dirty and discard, a routing group being edited, which show() and the window's close ask through magpie.call: window.routingDirty and discardRouting are gone. - plugins/routing: Essential, Requires window and gateway, in use while the user has a routing group (not Auto, not Hidden), since the page is where it is edited. The gateway routes the same with it off. - With it off, what leads to the page goes too: the nav and panel tabs and the panel's section (data-feature="routing"), the guide's Open Routing, Providers' "Make a routing group of …", the Usage list's View routing and its time as a link, the context card's Latest request. A panel left on its Routing tab shows Agents. - What other pages use of it stays on window: openRoute (context.js), kindName, swapWhy, routedWhy (Usage's Requests), newGroupWith (Providers), panelRoutingShown (the panel). - The 505 strings only Routing says move from i18n.js to plugins/routing/i18n.js (4 languages); i18n.js 17048 → 15032 lines. The plugin's own name and line stay in i18n.js: the Plugins page says them with the plugin off (TestBuiltinsTranslated). - Tests and comments that named routing.js name the new path (gateway's antigravity_rest and loop_guard, codeassist.go, usage.go, web_compress, group_member_info, assets_revalidate, font-cascade, win-fonts, three routing-*.test.cjs). builtins.test.cjs and builtins_test.go count seven built-ins and switch Routing off: its tabs go, the page shown stays. - docs: plugin-runtime.md, gui-shell.md, gateway-routing.md. Run, first on origin/main |
||
|
|
a4d580fa24 |
gateway: a group skips Antigravity for the system prompt it just turned away (#2156)
Antigravity answers Claude Code's and the Agent SDK's system prompt (the x-anthropic-billing-header line, "built on Anthropic's Claude Agent SDK") with 429 "Resource has been exhausted" whatever quota is left (#666). magpie already tells it as prompt_turned_away, rests nobody and hands it on, but each Claude Desktop turn in a group waited on the same refusal first (#2156: 429 in 1073ms, then cursor/composer-2.5 200). Now, once Antigravity has turned such a request away (any of the three paths that set holdWriter.turnedAway), for agForeseeing (6h) after, the candidate loop skips an Antigravity candidate for a request that carries the line, when someone is left after it (antigravityForeseen). The skip goes in Fallback with the hint, sets `other` as the asked path does, and changes no account state. The last one left is still asked and told the 400 with the hint. A request without the line (titles, Codex) still goes. An old refusal foresees nothing, so a block Google lifts is noticed. The lines are still neither rewritten nor hidden (#666). The stamp is per Server, in memory. TestAntigravityTurnedAwayRestsNobody's "asked first again" half now checks it with a turn without the line, since one with it is foreseen. Run: - TestAntigravityTurnedAwayIsForeseen: fails with the skip turned off ("Antigravity was asked again for the prompt it just turned away"), passes with it; TestAntigravity* -count=3 green. - gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok. - go test -tags nogui ./... in a sandbox HOME at load average 140-220: everything green except 10m timeouts in agent, cli, gateway, library, provider and TestSetAnswersWhileDevinAndProvidersHang (#1375, noted there); those six packages rerun with -timeout 45m: all ok. Not tried: the skip against the real Antigravity account (the refusal itself was reproduced with a real account before: 400 with the line, 200 without), nor Windows/Claude Desktop as the reporter uses. No GUI change. |
||
|
|
52be997b39 |
gateway: Gemini 4 and later are told a thinking level, at the level asked (#2083)
Gemini 4 Argon turns every thinkingBudget away with a 400 ("Thinking
budget is not supported for this model. Use thinking level instead."),
and magpie sent it one: thinkingConfig gave a level only to ids starting
gemini-3 (and gemini-pro-agent), so a gemini-4-* id on a provider that
speaks Gemini's own API (the reporter's google-vertex catalog, a custom
gemini= base) got a budget on every request.
geminiGeneration reads the generation from the id (gemini-N, after a
models/ prefix too); 3 and later are told a level. Medium goes as medium
on a later generation as it does on Flash: Argon lists low, medium and
high, and the effort is already fitted to the model's levels (fitFor). An
id naming no generation (gemini-flash-latest, an alias) is 0 and keeps
its budget, as before. The Chat path (aiStudioThinking) already gave a
budget only to gemini-2, and Vertex's vertexThinking is unchanged.
Run:
- TestGeminiLaterGenerationsToldALevel: a fake Gemini upstream that
answers a budget on gemini-4* with the reporter's literal 400; Argon
low/medium/high on /v1/chat/completions and /v1/responses, 3.8 Flash,
3 Pro medium (high, as before), 2.5 Flash (budget 24000). FAILs on the
old code with Argon's 400 on both routes; FAILs with "thinkingLevel
high, want medium" when only the medium case is reverted.
- TestGeminiGeneration (id table).
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/gateway; go test -tags nogui ./internal/gateway/.
Not tried: a real Gemini 4 Argon request (no AI Studio or Vertex key on
this machine). A magpie alias that names no generation but is wired to a
Gemini 4 model still gets a budget.
|
||
|
|
320af98581 |
gateway: an upstream's error in a shape its decoder can't read fails the reply, so Codex tries again (#1933, tensornull)
A translated stream whose upstream said it failed, but not in the shape
its protocol's decoder reads, ended as a completed reply with no output
and zero usage. Codex took that as its turn's end (exit 0, no message)
and never used its stream retry. tensornull's three fixtures, on an
Anthropic provider asked from Codex's Responses:
- {"type":"error","error":"fixture upstream failure"}: decodeAnthropic's
struct wants an object for error, so the event decoded to nothing,
while upstreamEnds counted the type "error" as the reply's end.
- Messages events with their type left out (named only by "event:"):
the decoder read nothing, and upstreamStop's delta.stop_reason still
marked the reply ended.
- A Responses response.failed from the Anthropic endpoint: upstreamEnds
took any protocol's last event, and the Anthropic decoder ignores it.
Now:
- replyEnds (upstream.go) reads a reply's end in the protocol it was
asked in: Anthropic's message_stop, error or a message_delta's
stop_reason; Responses' response.completed/incomplete/failed or error;
Gemini's finishReason; Chat's finish_reason. The other two fixtures no
longer read as whole and end as errEndedShort, a failure the gateway
and the client retry, like the "ping then EOF" control. It replaces
upstreamEnds in both the streaming loop (continuation.go) and the
unstreamed one (gateway.go).
- carriedError: every decoder (Anthropic, Responses, Chat, Code
Assist/Gemini) that can't decode an event still tells an error it
carries ({"error":"…"}, type error, response.failed) as KError with
its words. Siblings found the same way: a Chat upstream's
{"error":"…"} chunk ended a translated reply as completed; a Responses
upstream's string error or a response.failed with no error object
(status failed) did too, read as stop.
- An error event with no message says its type or the event itself,
never "".
One test's fixture changed with it: TestTranslatedEffortLoggedAsSent
served Chat chunks from its Responses upstream, which the Responses
decoder reads as nothing. It "completed" only because a finish_reason
counted as the end, the same empty success this fixes, so it now fails
with errEndedShort. The case gets a Responses reply (responsesHi).
What a whole reply does is unchanged: a valid Messages text reply, and
Claude's empty end_turn (asked of in the report), still complete on the
first ask (TestWellFormedStreamsStillComplete).
Run: the new tests in stream_error_shape_test.go use the report's bytes
(event: lines included). Against origin/main's code (fix reverted, tests
kept) 8 subtests fail: anthropic error string, error object with no
message, events with no type, responses failure on the messages route,
chat error string, both Responses-upstream cases, and the unstreamed
client; the error-object control and the well-formed ones pass on both.
With the fix all pass. go test -tags nogui -timeout 40m ./internal/gateway (sandbox
HOME, caches pinned); gofmt -l; go vet darwin, GOOS=linux -tags nogui,
GOOS=windows. tensornull's reproduce.py against a nogui build of this
tree: error-string now ends response.failed "fixture upstream failure"
after 3 gateway attempts, the same as the error-object control (was
response.completed after 1). Not run: the Codex CLI replay; a Responses
client asking a Responses upstream is passed its bytes as they are, so
that pairing is unchanged.
|
||
|
|
a64b3a8d46 |
plugin: a pi provider's message_start tells the prompt's usage pi's start named, so Claude Code's context meter isn't 0 until the turn ends (#1887)
What: pi.js wrote message_start with usageOf() and no argument, so every
field was 0 until message_delta. Claude Code's context meter reads the
usage the assistant message has so far, and a turn interrupted before
message_delta was stored with 0. message_start now carries the vendor's
prompt (input, cache read, cache write) and the output pi's start named
(startUsage): from pi's start event's partial.usage, as the issue
describes, or, as pi-ai's anthropic-messages pushes start before it reads
the vendor's message_start (start's usage is still 0 then), from the
partial message the events after it share. That message is pi's own,
still being written (by the time magpie reads it pi may have pushed the
whole turn), so only its prompt is taken from it, never its output.
message_delta is unchanged: the whole turn's cumulative usage from done.
Siblings, the gateway's translators to Anthropic's stream:
- Gemini / Code Assist (codeassist.go): usageMetadata rides on the first
chunk, but KStart was emitted before reading it. KStart now carries the
prompt (input, cached); output stays 0 there.
- Chat Completions (chat.go): most streams count only at their end, so
nothing to tell; a stream that counts on its first chunk now has its
prompt on KStart.
- Responses: response.created has no usage. Anthropic-to-Anthropic and the
Claude subscription already carry it. Cursor, Kiro, Devin, Qoder,
Command Code send KStart before any usage is known.
Ledger: no double count. The usage sniffer and the collector both take
each field's latest non-zero value (Usage.add replaces, it doesn't sum),
and continuation/search take a try's KStart usage as its own (this =
ev.Usage) and KUsage replaces it. message_delta's input equals
message_start's, which Anthropic's clients also take as the same count.
Run (Go 1.26.8, darwin):
- TestPiPackage with a fake pi stream as the issue's (start with
partial.usage input 11, cache 3/2, output 0, text, done with output 7):
message_start 11/3/2/0, message_delta 11/3/2/7; and pi-ai's order
("late": start with zero usage, then the shared message counted):
message_start 11/3/2/0. Red with message_start back on usageOf(), and
the late case red when only start's usage is read.
- TestPromptUsageOnMessageStart (Gemini, chat counting per chunk, chat
counting at the end): red with codeassist.go and chat.go stashed.
- go test ./internal/plugin and ./internal/gateway in full (-timeout 28m;
the default 10m timed out under load average ~20). The disk filled
during the run (3.7G free, not this change's): every failure was
ENOSPC, and each of them (37 gateway, TestFakePlugin) passed on rerun.
- gofmt -l; go vet for darwin, linux and windows on both packages.
Not tried against a real pi vendor or Claude Code's meter.
Reported-by: guoqchen1001
|
||
|
|
440fded2dc |
gateway: a turn stopped with its tool call out is answered on Google's APIs, not refused by them (#1560, ggbdpq)
What changed: a client replaying a conversation whose turn was interrupted with the tool call still out — the call in the history, no result for it — had every later turn refused by Google's APIs with 400 "Please ensure that the number of function response parts is equal to the number of function call parts of the function call turn", the conversation with it, however it was routed: a Google sign-in (Code Assist), Vertex AI, a custom provider's Gemini URL (#1346) and a model pinned to Gemini ( |
||
|
|
ce11b18015 |
gateway: Codex compacts on Gemini after a tool's output, no "Requests ending with a model turn" (#1533, yycsyu)
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
|
||
|
|
5a27b924e2 |
providers, gateway: Google Vertex AI is a preset, Gemini in the user's own Google Cloud project, signed with their Google credentials rather than a key
Gemini on Vertex AI was reachable only through a proxy of the user's own
in front of Vertex AI's OpenAI-compatible endpoint, added as a custom
provider. The Google Vertex AI preset (google-vertex) asks Vertex AI
itself.
* The provider holds a project, a location (global when none is given;
us, eu or a region), an optional credentials file and an optional
service account to go as (provider.Vertex). It has no key and no
URL: Save refuses a key, normalize clears a key and the four URLs
kept by hand, and its one address is
https://<host>/v1/projects/<project>/locations/<location>, the host
following the location (vertexHost). It is ready when it has a
project, never for a key or an account, and an import link can't add
it.
* Each request is signed with a Google token (Sign), and the token goes
to no other address. The credentials are found as Google's libraries
find Application Default Credentials: the provider's file, else
GOOGLE_APPLICATION_CREDENTIALS's, else gcloud's
application_default_credentials.json. A GOOGLE_APPLICATION_CREDENTIALS
that isn't a full path is an error, not unset, since gcloud's file
read in its place may be another account's. authorized_user,
service_account and gcloud's impersonated_service_account are read;
external_account and another universe are refused by name. With a
service account set, the token is traded at IAM Credentials'
generateAccessToken for one of that account's, as gcloud's
--impersonate-service-account does. Tokens are kept in memory per
file and account, minted once for requests made together, again 5
minutes before they expire or when the file changes (gcloud signed
in again). A mint is given 30 seconds; one that fails fails the
requests that waited through it too, and a request given up on
stops waiting. A sign-in Google refuses says the command that makes
that file again: gcloud's for its own files, impersonating as it
did.
* The gateway speaks Gemini to it alone. A Gemini client's request is
relayed as it came, its thinkingConfig, safetySettings and schema
with it: streamed to
publishers/google/models/<model>:streamGenerateContent?alt=sse, or
asked whole to :generateContent. Every other API's is translated
(buildVertex), streamed, and read back with thoughts as reasoning,
never as the answer. The path names a model by its upstream name
when one is set, as the usage log's endpoint does. Gemini 3 is sent a thinkingLevel fitted to the
model's levels, 2.5 a thinkingBudget in the model's range, off
included (Pro's least, as Pro can't stop). A call's thought
signature goes to the client in its id and comes back on the call;
a 400 "Invalid thought signature." is asked again with every call
waved through, for that request, and a 400 refusing minimal is asked
again at the model's lowest level, kept until restart. Neither is
tried for another provider.
* Vertex AI has no list of the models a location serves, so each
location has the ones it answered with on 2026-10-06: 12 at global,
6 Flash at us and eu, the 2.5 trio at a region.
* The preset offers Priority PayGo's and Flex PayGo's request headers
(HeaderHints). GOOGLE_APPLICATION_CREDENTIALS and CLOUDSDK_CONFIG are
in agentenv.Vars, so the desktop app takes them from the login shell
and the tests clear them.
Not read: the metadata server of Compute Engine, Cloud Run and GKE;
workload identity federation; Vertex AI's express-mode API keys. No
quota project is sent.
Reference: docs/subsystems/providers-accounts.md (Google Vertex AI,
Vertex AI tokens, four constraints) and gateway-routing.md (Vertex AI).
Verified: go test ./... (nogui), -race -count=5 on the Vertex tests,
gofmt and vet. A fake Google (token endpoint, IAM Credentials, Vertex
AI) checks each credentials type, the mint shared, bounded and
re-minted, every refusal's advice and that no token reaches another
host. Each of 24 mutations made after review, of the mint, the key
rules, the advice, the upstream path and the retries, fails a test.
Live, against a real project through an impersonated service account,
with magpie in a sandboxed HOME: Chat, Anthropic Messages, Responses and
Gemini clients, streamed and whole, with thinking and with tool calls, a
whole Gemini call and its signature sent back streamed, at global, us
and us-central1, and with Flex PayGo's header. No token was found in its
files or logs afterwards.
|
||
|
|
c45ece36a0 |
gateway: Code Assist sends the auto mode classifier's reasoning off at low, not high, on a Gemini 3 Flash that lists minimal
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. |
||
|
|
d7186e51b9 |
gateway: Gemini's thoughtSignature stays on the call and text it signed through translation, and goes back instead of the skip value (#1445, XYenon)
What changed: parseGemini keeps a functionCall's and a text part's thoughtSignature. geminiParts and buildCodeAssistSent write them back; a later call of a signed step goes without one, and only an unsigned step or Claude on Antigravity gets skip_thought_signature_validator. The Code Assist decoder puts a call's signature in its id (signedID, as chat does since #687) and a text's in KTextSig; the Gemini encoder and renderer give them to a Gemini client where Gemini put them, with a clean id. Chat, Messages and Responses renderers leave a signature-only text part out. Why: a Gemini client on a Code Assist or translated path had every call's signature replaced by the skip value and text signatures dropped. Run: the new tests in reasoning_state_gemini_test.go (Gemini's documented thought-signature shapes) fail on the old code and pass now; a Chat client's call id carries the signature back to Google, and no other API's client gets the text's. gofmt -l; go vet -tags nogui on darwin, linux and windows; the full internal/gateway tests in a scratch HOME: ok. Not tried with a real account. |
||
|
|
ea1c5d0457 |
gateway: Antigravity's 429 to a Claude Code / Agent SDK system prompt is the prompt turned away, not a quota, everywhere, and the agent gets 400 (#1425)
Antigravity answers the system prompt of Claude Code and the Claude Agent SDK (Claude Desktop's chats) with 429 "Resource has been exhausted" at whatever quota is left (#666). The detail text already said it was not a quota, but when Antigravity was the last one left (a direct model, the reporter's case) the route still fell through to failureOf: the try was counted 额度用尽 on the Routing page and in the account's tally, and the 429 went to the client, so Claude Desktop asked ten times over. What changed: - codeassist.go: antigravityTurnedAway(p, system, said) needs the Antigravity account, a Claude Code / SDK system prompt and the "resource has been exhausted" words. A real quota 429 ("You have exhausted your capacity ... reset after ...", QUOTA_EXHAUSTED) stays a quota and rests the account as before. turnedAwayStatus = 400 (the Anthropic and OpenAI SDKs retry 408, 409, 429 and 5xx, not 400); ledger ErrType "prompt_turned_away". - gateway.go: such a try is failPrompt (was failRefused in a group, and failQuota as the last), no rest, no usage re-asked, no passing retry, no auto reset. The last one left answers the agent 400 with the vendor's words and the hint; in a group the next member is asked, and if it fails only on a quota the agent is told the turned-away 400. The in-reply (stream error event) form is told the same way. - continuation.go / translate: the hint is appended to the in-reply form too, and the ledger row carries the ErrType. - routing.js: the hint joins HINTS, so the Routing page shows Antigravity's words as "It said: ..." and the explanation on its own line, translated in zh, zh-TW, ja and de (i18n.js). Tests (each fails on the old gateway.go/continuation.go/routing.js): - TestAntigravityTurnedAwayLastIsNoQuota (stream and not): 400, asked once, failPrompt, no rest, ledger 400 prompt_turned_away. - TestAntigravityTurnedAwayInsideTheReplyLast, TestAntigravityTurnedAwayThenAQuota, TestAntigravityQuotaOnAClaudeCodeTurnStaysQuota (scope: a real quota 429 still rests and reaches the agent as 429), TestAntigravityTurnedAwayHintIsTheRoutingPages. - gui/tests/routing-ag-turned-away.test.cjs: row status word, account tally, "It said" line and the hint line, in en/zh/zh-TW/ja/de. The real-quota fixture's words are from public reports, not captured from a real account. Run: gofmt -l internal/ (clean); go vet ./internal/gateway/ and GOOS=linux / GOOS=windows go vet -tags nogui ./internal/gateway/; go build ./..., GOOS=linux and GOOS=windows go build -tags nogui ./...; go test -tags nogui ./internal/gateway/ ./internal/gui/... under a scratch HOME with pinned caches (ok); GUI node tests (new test, routing-*, gui-de, gui-ja, gui-zh-tw, i18n-keys) in Chromium and WebKit. |
||
|
|
1bc18b2f4d |
gateway: a history that opens with the model's turn reaches Gemini and Code Assist after a user turn, so Gemini no longer answers 400 (magpie-community/plugins#45)
An agent's compaction or a cut-down context can leave a history whose first turn is the assistant's (text, or a tool call). Gemini turns that away: "Please ensure that function call turn comes immediately after a user turn or after a function response turn." buildCodeAssistSent, which Gemini CLI and Antigravity accounts, Factory's generateContent route (buildGemini) and Zed's Google models all build their contents with, now puts the user turn "[Continuing from previous AI thoughts...]" before such a history, as Gemini CLI's own hardenHistory (packages/core/src/utils/ historyHardening.ts, enforceRoleConstraints) does. Histories that open with the user, and parallel calls split over two assistant messages, go as before. Chat, Responses and Anthropic upstreams are unchanged. Verified: TestGeminiHistoryOpeningWithModel fails without the change (roles model,user, want user,model,user, for codeassist/gemini, codeassist/antigravity and gemini, with model text and with a model functionCall first). TestGeminiHistoryOpeningWithUserUnchanged and TestNonGeminiHistoryOpeningWithModelUntouched pass before and after. go test -tags nogui ./internal/gateway/... ./internal/zed/... under a temp HOME with pinned caches; go vet -tags nogui for darwin, linux, windows. Not tried against a real Gemini or Antigravity account. |
||
|
|
40c5b92a93 |
gateway: structured output crosses every translation: a Responses text.format or a Chat response_format reaches a Chat, Responses, Messages or Gemini upstream in its own words (frostming on Discord: responses.parse through magpie to OpenRouter came back as plain text)
The IR held a schema only from Anthropic's output_config.format, and only Messages (and Claude Code's --json-schema) were asked for one. A Responses request to a provider magpie speaks Chat or Messages to (OpenRouter has no Responses URL) lost text.format; a Chat request translated to Responses or Messages lost response_format; an Anthropic schema translated to Chat or Responses was lost too. Format (format.go) now carries json_schema (name, description, schema, strict) or json_object from Responses, Chat, Anthropic and Gemini, and each builder asks for it in its upstream's field. Where a target can't say it (json_object on Messages or Claude Code; the vendor bridges Cursor, Devin, Kiro, Qoder, Command Code, Zed) it is told in the system prompt. An upstream answering 400/422 naming the field (DeepSeek's "This response_format type is unavailable now") is asked again with it told in words, and so from then on. Relayed requests are unchanged. |
||
|
|
71f0541342 |
gateway: Antigravity's Claude gets a tool turn's images after every tool result, each labelled with the call it came from (@sinswing on X: an image between two functionResponses came back from Google as "tool_use ids were found without tool_result blocks immediately after")
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. |
||
|
|
f1f516cd73 |
fix(gateway): an account Antigravity turned away doesn't rest (#873)
* fix(gateway): an account Antigravity turned away doesn't rest
A 429 that is Antigravity refusing Claude Code's or its Agent SDK's
system instruction — "Resource has been exhausted (e.g. check quota)"
whatever quota the account has left (#666) — carries the word "quota",
so it was classified failQuota: the account rested 15 minutes and had
its usage asked of Google again, while it answers titles, background
requests and Codex normally.
Carry the fact the error path already works out from —
antigravityTurnsAway(request.System) and the CodeAssist agent, what the
|
||
|
|
4e0bf88370 |
gateway: Gemini on a Google sign-in searches with Google Search and draws with its image models (#757, on Antigravity: gemini-3.8-flash's searches went to the Codex account and spent its allowance, and neither the searcher picker nor the image model picker offered Antigravity's models) — a Google sign-in (Gemini CLI's or Antigravity's, not a plugin's) was never said to search by itself, and buildCodeAssistSent sent no googleSearch, so a Claude Code WebSearch on an Antigravity model was handed to magpie's search, which the searcher magpie picked (Codex first) answered.
Search: Code Assist runs googleSearch for Gemini, but Antigravity turns it down beside function tools (400 "Please enable tool_config.include_server_side_tool_invocations to use Built-in tools with Function calling", tried with that flag in toolConfig too), so searchesFor (searchesItself for one request) says a Google sign-in's Gemini searches by itself for a request without tools; buildCodeAssistSent then sends tools [{"googleSearch":{}}], and codeAssistDecoder reads the candidate's groundingMetadata (webSearchQueries, groundingChunks[].web) as a search the client is told of (Anthropic's server_tool_use + web_search_tool_result), once. A request with tools — every agent's — is given magpie's search tool as before, and its searches go to the conversation's own account first (ownSearcher, as a Kimi Code plan's do): searchWith on its Gemini without tools, so googleSearch runs there and no other subscription is spent. A Google sign-in is also a searcher for other models, last of those magpie picks by itself (rank 5; relays named by hand move to 6), and is offered in Settings → 代搜供应商, with its Gemini models only; the row says such sign-ins search for their own models first. smallModel took every Gemini for a small model ("gemini" has "mini" in it), so the first listed, gemini-pro-agent, searched; it now picks a Flash.
Images: Drawers lists the image models a Google sign-in has (gemini-3.1-flash-image), and draw asks them on Code Assist through the account (drawCodeAssist, askTranslated with the conversation's envelope); buildCodeAssistSent asks an image model for responseModalities ["TEXT","IMAGE"], which a chat with one now gets too. AutoDrawer doesn't pick them by itself (no known price), so nobody's automatic drawer changes.
With the owner's real Antigravity account (a copy of the config, a sandbox gateway): a web_search with no other tool on gemini-3.8-flash-low came back with Google's grounding as web_search_tool_result; with a bash tool beside it the model called magpie's search, which went to antigravity/gemini-3-flash (not Codex) and gave pages; /v1/images/generations with antigravity/gemini-3.1-flash-image drew a 1024x1024 JPEG. TestCodeAssistSearchesWithoutTools, TestCodeAssistDecodesGrounding, TestCodeAssistImageModelAsksForImages and TestSmallModelOfGemini are new; searcher-pick.test.cjs checks the note. go vet, builds (darwin, GOOS=linux, GOOS=windows), go test -tags nogui -count=1 ./... under a temp HOME and the searcher GUI tests (webkit) pass. Not tried with a Gemini CLI sign-in, which takes the same path.
|
||
|
|
8c652a83f7 | antigravity: its 429 to Claude Code's system prompt says it isn't a quota (#666: Claude Desktop 调用 antigravity 恒定报 429) — Antigravity answers "Resource has been exhausted (e.g. check quota)" to any request whose systemInstruction holds Claude Code's billing line (x-anthropic-billing-header: …) or the Agent SDK's identity line (You are a Claude agent, built on Anthropic's Claude Agent SDK.), on every model (gemini-3.8/3.7 flash, 3.5 flash lite, 2.5 flash, claude-sonnet-4-6, gpt-oss), whatever the quota left, while the same words in a message go through. Claude Desktop's chats run the Agent SDK and carry both, so they always failed, while its title requests (no system prompt) and Codex on the same account answered. Not the session id (magpie already sends request.sessionId as -<uint63>), thinking signatures (never sent back) or the User-Agent. magpie doesn't hide the lines from Google; the gateway now adds to such a 429 that it is no quota and that Antigravity turns away Claude Code's and the Agent SDK's system prompt, so no one chases a quota. Reproduced on the owner's real Antigravity account with Claude Code 2.1.288 through a sandbox gateway (11/11 429; system field removed 200; either line alone 429). TestAntigravityTurnsAwayClaudeCodesSystemPrompt. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. |