Repository navigation
fix(antigravity-direct): fold anyOf to oneOf for Claude targets (opencode#1550) - #5110
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9da9f16b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // anyOf folds into oneOf for Anthropic targets (see the header | ||
| // probe note); a node carrying both keywords merges both branch | ||
| // sets into the single oneOf the Anthropic side accepts. | ||
| else if (k === 'oneOf' || anthropic) out.oneOf = out.oneOf ? [...out.oneOf, ...branches] : branches; |
There was a problem hiding this comment.
Preserve conjunction when folding sibling union keywords
For a Claude tool property containing both anyOf and oneOf, concatenating their branches changes the original conjunction into a single exclusive union. For example, if both keywords contain [{type: "string"}, {type: "number"}], the original schema permits strings and numbers, but the emitted four-branch oneOf rejects every value because each valid value matches twice. Preserve the two converted groups separately under allOf, which the upstream accepts, rather than merging their alternatives.
Useful? React with 👍 / 👎.
What broke
workhorseattempts onantigravity-direct/claude-sonnet-5-5400'd on a ~30-minute cadence all day 2026-11-03 (route ledger 17:34 / 18:04 / 18:34 / 19:34Z). Upstream error, Anthropic-shaped:Tracked as developing-today-forks/opencode#1550. This is the door half of the fix; the fork twin lands in developing-today/opencode (same title).
Root cause (probed live against the door, 2026-11-03)
For Claude models the upstream re-serializes the v1internal proto Schema into an Anthropic
input_schema— and Anthropic's validator rejectsanyOfoutright: any branch count (even one), any position (root, property, nested initems). Every other probed shape passes on the Claude leaf: no tools, minimal tools, bare array properties, type-array null unions (the converter collapses those tonullable),additionalProperties, inlined$refs,oneOf(2- and 3-branch, object branches),allOf. Gemini models acceptanyOfverbatim. Any real tool whose zod schema carries a union (.nullable(), type unions) therefore 400s every Claude attempt while Gemini sails through.Fix
At the translation boundary only:
convertSchema/convertSchemaNodetake ananthropicflag (frombuildV1Request: the resolved base model starts withclaude), and for Anthropic targetsanyOfis emitted asoneOf, recursively (properties, items, prefixItems, composition branches,not). A node carrying both keywords merges both branch sets into the singleoneOf. Tool unions are disjoint alternatives in practice (type unions, nullable encodings), where exactly-one is the faithful reading, andoneOfis the only union keyword the Anthropic side takes. Gemini conversion is byte-identical to before.Tests
node --test bin/antigravity-direct.test.mjs— 19/19 (17 pre-existing + 2 new, following the #1548 pattern of asserting on the payload recorded by a stub upstream):oneOfeverywhere and noanyOfkey anywhere in the parameters.anyOfverbatim.No restructuring, no config changes, no Gemini-path changes.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.