You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 79f8670
Browse filesBrowse the repository at this point in the historyBrowse files
pavelhov
committed
fix(openai-chat): strip $ref siblings from tool schemas for Moonshot
Moonshot's strict validator 400s any schema node carrying a $ref next to
sibling keys ("At path '$defs.__schema20': when using $ref, type should be
defined in the referenced schema instead of the parent schema"). Codex emits
exactly that shape for deferred/dynamic tools with recursive parameter
schemas, which bricked every Kimi-routed session the moment such a tool was
loaded via tool_search (e.g. the thread-management tools).
Walk tool parameter schemas recursively for Moonshot targets and inline local
$ref targets when siblings are present. Bare $refs are left untouched so
recursive schemas keep working; unresolvable or cyclic refs collapse to the
bare ref (dropping the siblings) instead of producing a 400.
Gated to api.moonshot.ai/.cn and api.kimi.com: pre-2019-09 JSON Schema
ignores $ref siblings, so rewriting them globally would silently change
meaning for other providers. Shares the local JSON Pointer resolver with the
xAI root expansion (renamed resolveLocalSchemaRef); the two normalizers stay
separate because the providers reject different shapes with different failure
policies (xAI drops non-object roots; Moonshot must never drop tools).
0 commit comments