Repository navigation
[Bug][Safety] dsh-llm-pi-ai: malformed tool-call arguments become {} and the Tool runs with empty input
#9066
xiangxiaoyong
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Version: 0.2.0-rc.2 (
@deepseek-ai/dsh-llm-pi-ai, which resolves@earendil-works/pi-ai0.87.x)Problem — a safety issue. When a provider returns malformed or truncated function-call arguments, for example a stream cut mid-JSON or invalid JSON text, pi-ai parses them into
{}and DSH logs and executes the Tool with empty input. The model's actual text is lost, so the Session log cannot show what was sent, and a Tool with all-optional input runs with defaults the model never chose.Repro. Use any route through
dsh-llm-pi-ai, with a provider response whose tool-callargumentsis invalid JSON, e.g.{"a": [1, 2. The resultingtool/callhasarguments: "{}", and the Tool executes.What we do today. Two small patches:
ToolCall.rawArguments, the provider's exact argument text (Responsesoutput_item.done, Chat Completions finalize), and replays it verbatim.dsh-llm-pi-aiemitsrawArgumentsas the DSHtool-call.argumentsstring and hands it back on replay.The 0.2 agent loop then parses the arguments itself, and a malformed call fails Tool validation instead of executing.
Ask. Carry the provider's raw argument text through the adapter, and never substitute
{}for unparseable arguments.All reactions