Skip to content

fix(agent): accept union types in Moonshot schema sanitizer#28772

Open
Torch4084 wants to merge 1 commit into
NousResearch:mainfrom
Torch4084:fix/moonshot-union-type-list
Open

fix(agent): accept union types in Moonshot schema sanitizer#28772
Torch4084 wants to merge 1 commit into
NousResearch:mainfrom
Torch4084:fix/moonshot-union-type-list

Conversation

@Torch4084

Copy link
Copy Markdown

Summary

sanitize_moonshot_tools() crashes on valid JSON Schema union types like "type": ["number", "string"] because the sanitizer assumes every type value is hashable.

Closes #28291.

Changes

  • treat list-valued type declarations as already-valid in _fill_missing_type()
  • guard enum cleanup so it only runs for scalar string type values
  • add a regression test covering a property that uses a JSON Schema union type list

Testing

  • uv run --extra dev pytest tests/agent/test_moonshot_schema.py -q

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent loop, run_agent.py, prompt builder provider/kimi Kimi / Moonshot P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels May 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #28422 (covers both crash sites) / #28322 (covers one). All fix #28291moonshot_schema crashes on JSON Schema union type lists. This PR covers both L144 enum cleanup and L166 _fill_missing_type, same scope as #28422.

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

Labels

comp/agent Core agent loop, run_agent.py, prompt builder duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists provider/kimi Kimi / Moonshot type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: moonshot_schema._fill_missing_type crashes on JSON Schema union types (list type)

2 participants