mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #510] [CLOSED] fix(serve): safely handle malformed or partial tool call arguments in history #2671
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2671
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/510
Author: @praveshkhatana
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:fix/tool-call-argument-fallback📝 Commits (1)
6338666fix(serve): safely handle malformed or partial tool call arguments in history📊 Changes
3 files changed (+19 additions, -1 deletions)
View changed files
📝
serve/frontend.py(+7 -1)📝
serve/server.py(+1 -0)📝
serve/test_server.py(+11 -0)📄 Description
Summary
When an agent client (e.g. coding agents, multi-turn assistant tools) sends conversation history containing an interrupted, partial, or malformed JSON argument in
tool_calls,serve/frontend.pyline 181 was callingjson.loads(args)without exception handling.Unlike lines 154, 360, and 469 (which gracefully catch JSON errors), an unhandled
json.JSONDecodeError(ValueError) in line 181 immediately rejected the turn withHTTP 400 invalid_request_error. Because agent clients preserve turn history, subsequent requests repeatedly failed with a non-retryable 400 error, permanently breaking the session.Changes
json.loads(args)inopenai_to_messageswith atry ... except (ValueError, json.JSONDecodeError)fallback ({"raw": args}), preventing historical tool calls from crashing the session.ValueErrorreasons inserver.pyfor visibility into 400 client rejections.test_tool_call_malformed_arguments_fallbackinserve/test_server.py.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.