Skip to content

fix(opencode): bound Meta/Muse tool schema nesting depth - #50320

Open
argszero wants to merge 1 commit into
anomalyco:devfrom
argszero:console-go-schema-depth
Open

argszero wants to merge 1 commit into
anomalyco:devfrom
argszero:console-go-schema-depth

Conversation

@argszero

Copy link
Copy Markdown

Issue for this PR

Closes #50297

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Meta's Model API rejects tool schemas nested deeper than 10 levels and fails the whole request instead of the offending tool, so a single deep MCP tool (the Vercel MCP server publishes twelve) breaks every request for Muse Spark, both on the meta provider and through the opencode gateways.

ProviderTransform.schema already lowers schemas per provider for OpenAI, Moonshot and Gemini; this adds the missing Meta/Muse pass. It keeps the schema within the nesting limit by dropping the members (properties, items, additionalProperties, anyOf/oneOf/allOf, $defs/definitions) that would nest past it, so every other keyword stays on the node and a lowered tool keeps its shape instead of failing the request.

Depth is counted the way the issue measures it: the tool parameter root is level 0 and every member step below it adds one level. The deepest schema that survives is 9 steps below the root, i.e. 10 levels counting the root — the tools the issue reports as failing at depth 10.

How did you verify your code works?

bun test test/provider/transform.test.ts — 569 pass, including the new cases: a depth-14 property chain, combiner/array/additionalProperties branches, a deep $defs subtree, a schema already within the limit (unchanged) and a non-Meta provider (unchanged). bun run typecheck is clean.

Only meta/muse models are affected, so no other provider's tool schemas change.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Meta's Model API rejects tool schemas nested deeper than 10 levels and fails
the whole request instead of the offending tool, so one deep MCP tool (the
Vercel MCP server publishes twelve) breaks every request for Muse Spark, both
on the `meta` provider and through the opencode gateways.

Drop the members that would nest past the limit for Meta/Muse models. Every
other keyword stays on the node, so a lowered tool keeps its shape and stays
callable instead of failing the request.
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console Go (Meta Muse Spark): MCP tool schemas deeper than 10 levels are rejected, no Meta/Muse sanitizer

1 participant