Skip to content

fix(models): replay malformed tool-call arguments as valid JSON - #1327

Merged
bearsyankees merged 6 commits into
mainfrom
fix/malformed-tool-call-arguments
Oct 14, 2026
Merged

bearsyankees merged 6 commits into
mainfrom
fix/malformed-tool-call-arguments

Conversation

@bearsyankees

Copy link
Copy Markdown
Collaborator

A model that emits a tool call with truncated or otherwise invalid JSON arguments fails that one call, but the raw string is recorded in the session. Strict OpenAI-compatible servers (vLLM, SGLang) validate every assistant tool call in the request, so each later turn is rejected with "Assistant tool call function.arguments must be valid JSON" and the agent never recovers. The turn guard now rewrites such arguments on the way out to a JSON object carrying the original text, alongside the existing duplicate call-id repair.

A model that emits a tool call with truncated or otherwise invalid JSON
arguments fails that one call, but the raw string is recorded in the
session. Strict OpenAI-compatible servers (vLLM, SGLang) validate every
assistant tool call in the request, so each later turn is rejected with
"Assistant tool call function.arguments must be valid JSON" and the agent
never recovers. The turn guard now rewrites such arguments on the way out
to a JSON object carrying the original text, alongside the existing
duplicate call-id repair.
@greptile-apps

greptile-apps Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues remain.

Summary

Repairs malformed tool-call arguments before replaying conversation history and asks the model to retry calls that could not run.

  • Malformed tool calls ask the model to try again.
  • Replayed tool calls keep valid JSON arguments.
  • The cost-tracking test uses a local model-name lookup.

Reviews (3) · Last reviewed commit: "fix(models): treat over-nested tool-call..." · Reviewed by Greptile

Comment thread strix/config/tool_call_arguments.py Outdated
…e not valid JSON

A streamed turn that ends mid-tool-call leaves the client with a JSON prefix
as the arguments. Instead of the SDK's generic parse-error result, the tool
wrapper now short-circuits with a clear 'not executed, re-issue with complete
arguments' message so the model recovers in one turn.
…ll-arguments

# Conflicts:
#	strix/config/models.py
@bearsyankees

Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread strix/config/tool_call_arguments.py
@bearsyankees

Copy link
Copy Markdown
Collaborator Author

@greptile

@bearsyankees
bearsyankees merged commit ca20626 into main Oct 14, 2026
16 checks passed
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.

1 participant