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
Provider: tool_call with missing 'arguments' silently runs the tool with empty input (loop) #83
Found while using tole run (built from develop @ 0c424bf, provider: bifrost gateway, model glm/glm-5.3) to author a vetio scene config. Multiple sessions aborted with:
tole: loop detected — tool `write_file` called with identical input 3 times in a row (guard trips at 3)
Root cause
In crates/tole-core/src/openai.rs (parse_completion, ~L274-279):
let args = first
.get("function").and_then(|f| f.get("arguments")).and_then(Value::as_str).map(str::to_string).unwrap_or_else(|| "{}".into());
When the model emits a tool_call whose function.arguments field is missing or null, this silently substitutes {} and the tool runs with empty input. Observed in two independent glm-5.3 sessions: write_file intents recorded 'input': {}, the tool failed (write_file: missing 'path'), and the model retried the identical empty call until the loop guard tripped. run_command calls with the same model always carried valid arguments, so the failure is specific to how some tool_calls arrive without arguments.
A missing-arguments call is a malformed tool call, not an empty one.
Suggested fix
Treat missing/null/empty-JSON arguments as ProviderOutput::InvalidToolArgs { tool, raw, reason: "missing arguments" } instead of unwrap_or_else(|| "{}"), so the model receives an error result and can retry with well-formed arguments (the same path already used for unparseable JSON).
Evidence
Session transcripts: /tmp/vetio-tole-test/tole-sessions/s-1a0b1fa8782-381c.jsonl, s-1a0b200fc4d-3c20.jsonl (entries show intent with payload.input = {} followed by error: "write_file: missing 'path'").
Gateway-side control test (direct curl, same model, same tool schema): a 3.3KB arguments string arrives intact — the truncation is not at the gateway; the omitted-arguments emission comes from the model, and tole should surface it instead of normalizing it.
Activity
fix: reject tool calls with missing arguments instead of running empty (