7eleven, in ZCode on devin/gemini-4-argon, got every turn refused:
"Devin: There is an issue with this request, please try a different
model." (invalid_argument). It is the request content, on Gemini models
only. On a real account, gemini-4-argon, gemini-3-1-pro and
gemini-3-8-flash refuse a request offering a tool whose schema has, at
any depth:
- a list type: ["string","null"], ["string"], ["string","number"];
- type "array" with no items, items true, or items that are a list;
- properties with no type;
- an enum with no type.
claude-sonnet-4-6 and swe-2 take all of them. Nullable written as anyOf,
items {}, nullable:true, const, $ref/$defs, additionalProperties and
format all go through on Gemini.
geminiSchema rewrites them, for a Gemini uid only:
- a list type becomes its one type, nullable when it had "null", or
anyOf of each type;
- such an array's items become {} (a one-schema list becomes that
schema);
- a schema with properties gets type object;
- an enum gets its values' type, and an enum of mixed values is dropped.
The caller's schema is not changed. Claude and swe-2 requests are byte
for byte what they were.
What was run:
- HOME=$(mktemp -d) bun test packages/devin: 80 pass.
- gemini-schema.test.mjs, with the gemini line in build() turned off by
hand: 10 red, one per refused shape.
- bun scripts/check.mjs: ok.
- Real account: each refused schema, sent as built here, went through on
gemini-4-argon-medium and gemini-3-1-pro-high.
- build() end to end with a search tool holding a list type, an array
with no items and an untyped enum: gemini-4-argon called the tool, where
0.1.16 got invalid_argument. claude-sonnet-4-6 called it on both.
Not tried: ZCode itself against the plugin. The reporter's exact tool is
not known; ZCode's own zod 4 tools write anyOf, so it is likely one of
their MCP or plugin tools.
98 lines
4.6 KiB
JavaScript
98 lines
4.6 KiB
JavaScript
// Devin's Gemini models answer "There is an issue with this request, please
|
|
// try a different model" (invalid_argument, 400 in magpie) to a request
|
|
// offering a tool whose schema has a list type, an array with no items or
|
|
// with a list or true as items, or properties or an enum with no type, at
|
|
// any depth (7eleven on Discord: ZCode on gemini-4-argon). Each schema
|
|
// below was sent to gemini-4-argon on a real account and refused, and went
|
|
// through as built here; Claude models and swe-2 took every one, so their
|
|
// schemas go as they came.
|
|
import { expect, test } from "bun:test"
|
|
import { _internal } from "./index.mjs"
|
|
|
|
const dec = new TextDecoder()
|
|
|
|
const sent = (b) =>
|
|
Object.fromEntries(
|
|
_internal
|
|
.fields(b)
|
|
.filter((f) => f.num === 10 && f.wire === 2)
|
|
.map((f) => {
|
|
const g = _internal.fields(f.data)
|
|
return [dec.decode(g.find((h) => h.num === 1).data), JSON.parse(dec.decode(g.find((h) => h.num === 3).data))]
|
|
}),
|
|
)
|
|
|
|
const P = (props) => ({ type: "object", properties: props })
|
|
// refused by gemini-4-argon, each on its own
|
|
const REFUSED = {
|
|
typeList: P({ a: { type: ["string", "null"] } }),
|
|
typeListOne: P({ a: { type: ["string"] } }),
|
|
typeListTwo: P({ a: { type: ["string", "number"] } }),
|
|
noItems: P({ a: { type: "array" } }),
|
|
itemsTrue: P({ a: { type: "array", items: true } }),
|
|
itemsList: P({ a: { type: "array", items: [{ type: "string" }] } }),
|
|
deepNoItems: P({ a: { type: "object", properties: { b: { type: "array" } } } }),
|
|
unionNoItems: P({ a: { anyOf: [{ type: "array" }, { type: "null" }] } }),
|
|
propsNoType: P({ a: { properties: { b: { type: "string" } } } }),
|
|
enumNoType: P({ a: { enum: ["x", "y"] } }),
|
|
}
|
|
|
|
const chatWith = (parameters) => ({
|
|
messages: [{ role: "user", content: "ok" }],
|
|
tools: [{ type: "function", function: { name: "t", description: "t", parameters } }],
|
|
})
|
|
|
|
// what Devin's Gemini models refuse, anywhere in the schema
|
|
function refused(s, at = "$") {
|
|
if (!s || typeof s !== "object" || Array.isArray(s)) return []
|
|
const out = []
|
|
if (Array.isArray(s.type)) out.push(at + " list type")
|
|
if (s.type === "array" && (!s.items || typeof s.items !== "object" || Array.isArray(s.items))) out.push(at + " items")
|
|
if (s.type === undefined && (s.properties || s.enum)) out.push(at + " no type")
|
|
for (const [k, v] of Object.entries(s.properties ?? {})) out.push(...refused(v, at + "." + k))
|
|
for (const k of ["anyOf", "oneOf", "allOf"]) for (const [i, v] of (s[k] ?? []).entries()) out.push(...refused(v, `${at}.${k}[${i}]`))
|
|
if (s.items) out.push(...refused(s.items, at + "[]"))
|
|
return out
|
|
}
|
|
|
|
for (const [name, parameters] of Object.entries(REFUSED)) {
|
|
test(`${name}: goes to a Gemini model in a shape it takes`, () => {
|
|
const before = JSON.stringify(parameters)
|
|
const got = sent(_internal.build(chatWith(parameters), "gemini-4-argon-medium", "k")).t
|
|
expect(refused(got)).toEqual([])
|
|
expect(JSON.stringify(parameters)).toBe(before)
|
|
})
|
|
test(`${name}: goes to a Claude model as it came`, () => {
|
|
expect(sent(_internal.build(chatWith(parameters), "claude-opus-5-5-high", "k")).t).toEqual(parameters)
|
|
expect(sent(_internal.build(chatWith(parameters), "swe-2-high", "k")).t).toEqual(parameters)
|
|
})
|
|
}
|
|
|
|
test("a list type keeps what it allowed", () => {
|
|
const g = (s) => _internal.geminiSchema(s)
|
|
expect(g({ type: ["string", "null"], description: "d" })).toEqual({ type: "string", nullable: true, description: "d" })
|
|
expect(g({ type: ["string"] })).toEqual({ type: "string" })
|
|
expect(g({ type: ["string", "number", "null"] })).toEqual({ nullable: true, anyOf: [{ type: "string" }, { type: "number" }] })
|
|
expect(g({ type: ["array", "null"] })).toEqual({ type: "array", nullable: true, items: {} })
|
|
expect(g({ type: "array", items: [{ type: "string" }] })).toEqual({ type: "array", items: { type: "string" } })
|
|
expect(g({ type: "array", items: [{ type: "string" }, { type: "number" }] })).toEqual({ type: "array", items: {} })
|
|
expect(g({ enum: [1, 2] })).toEqual({ type: "integer", enum: [1, 2] })
|
|
expect(g({ enum: ["x", null] })).toEqual({ type: "string", enum: ["x"], nullable: true })
|
|
expect(g({ enum: ["x", 1] })).toEqual({})
|
|
})
|
|
|
|
test("a schema Gemini takes goes as it came", () => {
|
|
const parameters = {
|
|
type: "object",
|
|
properties: {
|
|
a: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
b: { type: "array", items: { type: "string", enum: ["x"] } },
|
|
c: { $ref: "#/$defs/x" },
|
|
d: { const: "k" },
|
|
},
|
|
$defs: { x: { type: "object", properties: { y: { type: "integer" } } } },
|
|
required: ["a"],
|
|
}
|
|
expect(sent(_internal.build(chatWith(parameters), "gemini-4-argon-medium", "k")).t).toEqual(parameters)
|
|
})
|