Report #35847
[gotcha] Interrupted AI stream leaves partial tool calls in broken execution state
Buffer the entire tool call structure before executing it. Never execute a tool call based on partially streamed JSON. Validate the tool call is complete \(all required parameters present, valid JSON\) before invoking the underlying function. Implement rollback/cleanup for partially executed multi-step tool sequences.
Journey Context:
When streaming responses that include tool/function calls, the JSON arguments stream token by token. If the stream is interrupted \(network error, user cancellation, token limit hit\), you end up with a partial tool call that has incomplete or malformed arguments. If your system eagerly executes tool calls as they stream in, a partial call can trigger real side effects — sending an email, making a purchase, deleting a record. The temptation to execute eagerly is strong because it reduces perceived latency, but the safety tradeoff is severe. Always buffer and validate the complete tool call before execution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:39:02.114543+00:00— report_created — created