fix(tools): strip default from $ref nodes in tool schemas - #44676
Merged
Conversation
Fireworks-hosted Kimi rejects tool requests when nullable MCP/Pydantic
schemas collapse to {"$ref": "...", "default": null}. Strip that sibling
during global schema sanitization so gateway and CLI calls succeed again.
Contributor
🔎 Lint report:
|
AIalliAI
added a commit
to AIalliAI/Hermes
that referenced
this pull request
Jun 14, 2026
Applied from upstream merge d810f2b (PR NousResearch#44676, bb/fix-schema-ref-default). Fixes HTTP 400 on strict draft-07 backends (Fireworks Kimi) when MCP tool schemas leave default alongside $ref after nullable-union collapse. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AIalliAI
pushed a commit
to AIalliAI/Hermes
that referenced
this pull request
Jun 14, 2026
…-ref-default fix(tools): strip default from $ref nodes in tool schemas
T02200059
pushed a commit
to T02200059/hermes-agent
that referenced
this pull request
Jun 18, 2026
…-ref-default fix(tools): strip default from $ref nodes in tool schemas
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…-ref-default fix(tools): strip default from $ref nodes in tool schemas
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…-ref-default fix(tools): strip default from $ref nodes in tool schemas
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…-ref-default fix(tools): strip default from $ref nodes in tool schemas
5 tasks
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…-ref-default fix(tools): strip default from $ref nodes in tool schemas
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…-ref-default fix(tools): strip default from $ref nodes in tool schemas
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
…-ref-default fix(tools): strip default from $ref nodes in tool schemas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
JSON Schema not supported: keyword(s) ['default'] not allowed at the same level as $refon every agent turn when using strict backends (reported on Fireworks-hosted Kimi K2 with MCP tools enabled).defaultfrom any node that carries$ref, and nullableanyOfcollapse no longer copiesdefaultonto$refbranches.Root cause
MCP/Pydantic tool schemas commonly express optional fields as
anyOf: [{$ref: ...}, {type: null}]withdefault: null. Hermes already collapses those unions for backend compatibility, but the collapse was leaving{"$ref": "#/$defs/Foo", "default": null}— which Fireworks (and other draft-07-strict validators) reject outright.Test plan
scripts/run_tests.sh tests/tools/test_schema_sanitizer.py(43 passed)$ref-based schemas; confirm gateway/CLI messages succeed after upgrade