Commit Graph
1 Commits
Author SHA1 Message Date
yetone 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.
2026-10-25 15:56:16 +08:00