Malformed text-dialect tool call escalates to a repeat loop and fails the turn (resolve_time, breaker_halt)
Description
A malformed text-dialect tool call sends the agent loop into a retry-then-repeat cycle that ends with the turn failing outright. The model emits a <tool_call> block the parser cannot decode, the loop retries and then nudges, the model responds by repeating the same tool, and the successful-repeat tracker halts the run. The user gets a failed turn.
Observed end to end on one run (openhuman-session-f19c3d11-4d95-47c3-bc5a-16091653c29d) over 79 seconds.
Build: v0.64.6 (main @ f8e9d7860)
Reproducible: Seen once in normal use; the ingredients (text dialect + deepseek) are the default configuration
Steps to Reproduce
- Run with the default managed route —
openrouter/deepseek/deepseek-v4-flash,dispatcher: "xml" - Ask something that needs a time lookup, so the agent reaches for
resolve_time - Observe the agent loop log for
did not become a call
Expected Behaviour
- A malformed tool-call block is recovered from, or the turn ends with a readable explanation
- A nudge that fails to produce a decodable call does not lead to the model repeating the same tool until a breaker fires
- The circuit breaker producing
breaker_haltsurfaces as a grounded close the user can act on, notagent run failed resolve_timein particular should be deterministic and never worth repeating
Actual Behaviour
02:28:21 WRN [agent_loop] tool-call block(s) did not become a call
call_id=…-model-5 malformed=1 unterminated=0
02:28:21 INF [agent_loop] retrying completion without visible answer attempt=1 finish_reason=Some("stop")
02:28:21 INF [models] SDK scheduled a model-call retry after a retryable provider error attempt=1
02:28:23 WRN [agent_loop] tool-call block(s) did not become a call
call_id=…-model-6 malformed=1 unterminated=0
02:28:24 INF [agent_loop] nudging after undecodable text-dialect tool call
malformed_blocks=1 unterminated_blocks=0
02:29:40 WRN [tinyagents::mw] crate successful-repeat tracker halted the run tool="resolve_time"
02:29:40 WRN [host] agent run failed
02:29:40 WRN [tinyagents][progress] turn failed run=…f19c3d11 err=agent run failed
02:29:40 INF [turn_run_finalize] run halted by circuit breaker; surfacing as breaker_halt (#4466)
model="openrouter/deepseek/deepseek-v4-flash" subagent=falseTwo successive model calls produced undecodable tool-call blocks. The loop retried, then nudged. The model then repeated resolve_time enough times for the repeat tracker to halt the run, and the turn ended as agent run failed rather than a grounded close.
Impact
- The turn fails and the user gets nothing back for it
- Roughly 80 seconds and several model calls are spent reaching a failure
resolve_timeis a trivial deterministic tool; burning a turn on it is the worst possible case to fail on- The recovery path makes things worse: retry → nudge → repeat → halt is an escalation, not a recovery
- The user-facing outcome is a generic failure with no explanation of what went wrong
Related
Same text-dialect seam as #6655 (tool calls stripped from replayed history) and #6646 (</tool_call> leaking into chat bubbles). All three are the XML dialect's encode/decode boundary failing in different directions — worth looking at together rather than patching individually.
Acceptance Criteria
- A malformed text-dialect tool-call block is either recovered or ends the turn with a specific, user-readable message — never
agent run failed - The nudge path is bounded: after N undecodable blocks the loop stops nudging rather than letting the model repeat a tool into a breaker halt
- A
breaker_haltsurfaces as a grounded close carrying what was attempted, per the existingStopping:convention - Repeated identical
resolve_timecalls are short-circuited or deduplicated rather than counted toward a failure budget - The malformed block is logged with its raw content at debug level so the encode failure can be diagnosed
- Verified by forcing an undecodable tool-call block and confirming the turn ends cleanly with an explanation
Source: tinyhumansai/openhuman