fix: remove allOf/anyOf/const/if/then from tool schemas for provider compat#248
fix: remove allOf/anyOf/const/if/then from tool schemas for provider compat#248sergio-agosti wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d376e06bc
ℹ️ 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".
| type: ["string", "boolean", "object"], | ||
| additionalProperties: true, |
There was a problem hiding this comment.
Restore validation for acceptance object fields
For direct tool calls, this relaxed schema is the only validation gate; validateAcceptanceInput() is only used when loading saved JSON chains, not before SubagentParams are executed. With acceptance now accepting any object, inputs such as acceptance: { level: "verified", verify: "npm test" } pass the tool schema and later reach formatAcceptancePrompt()/evaluateAcceptance(), which assume verify is an array and eventually call spawn(command.command) on characters from the string, causing the run to fail/crash instead of returning a validation error. The previous schema rejected these malformed objects, so either keep object field constraints without unsupported keywords or invoke the runtime validator on all tool params before execution.
Useful? React with 👍 / 👎.
… provider compat kimi/Moonshot and other providers (e.g. Antigravity proxy) do not support allOf, anyOf, const, if/then/not keywords in JSON Schema for tool function.parameters. This caused 400 errors when the subagent tool was registered with providers that only implement a minimal JSON Schema subset. Changes: - AcceptanceOverride: replace top-level anyOf (string/false/object) with type: [string, boolean, object]. Replace criteria.items.anyOf with type: [string, object]. Replace review.anyOf (const: false / object) with type: [boolean, object]. Inline sub-schemas so no anyOf/allOf/const keywords remain anywhere in the schema. All field-level type constraints (verify must be array, criteria items must be string|object, stopRules must be array) are preserved. - ChainItem: remove allOf with if/then/not conditional constraints, use additionalProperties: true. All removed constraints that lacked a runtime equivalent are now enforced by the JSON Schema itself using only basic keywords (type, properties, required, items, enum, additionalProperties).
6d376e0 to
7b65bab
Compare
Problem
Providers with limited JSON Schema support (kimi/Moonshot, Antigravity proxy, and potentially others) reject the
subagenttool registration because the parameter schema contains keywords not supported by their minimal JSON Schema parsers:AcceptanceOverride: UsesanyOfwith 3 alternatives (string enum,const: false, nested object with nestedanyOfin criteria.items and review)ChainItem: UsesallOfwithif/then/notconditional constraintskimi returns:
then:
Antigravity proxy (Google Cloud Code Assist): same class of error with
anyOf/const(previously noted in CHANGELOG).Fix
Two changes in
src/extension/schemas.ts:1.
AcceptanceOverride— noanyOf/allOf/constkeywordsanyOfwith 3 alternatives (string,const: false, object)type: ["string", "boolean", "object"]— same expressiveness, basic JSON Schemacriteria.items.anyOfwith string/AcceptanceGateSchematype: ["string", "object"]with inline properties (id,must,evidence,severity) andrequired: ["id", "must"]review.anyOfwithconst: false/ AcceptaceReviewGateSchematype: ["boolean", "object"]with inline properties (agent,focus,required)All field-level type constraints are preserved —
verifymust be array,stopRulesmust be array,criteriaitems must be string or object withid+must, etc. A malformed input like{ verify: "npm test" }still fails schema validation becauseverify.typeis"array".2.
ChainItem— removeallOfwithif/then/notReplace the conditional schema (expand requires parallel+collect, collect requires expand+parallel, expand without parallel type=array) with
additionalProperties: true. The expand/collect/parallel conditional logic is enforced by runtime execution code.Verification
subagent()calls with acceptance blocks work without 400 errorsvalidateAcceptanceInput(),normalizeAcceptanceInput()) unchangedallOf/anyOf/const/if/then/notin AcceptanceOverride or ChainItem schemasRelated
anyOf/constissues with Antigravity proxyallOf/if/then/notkeywords and applies to the acceptance schema