Files
leleka/docs
Pavlo RatushnyiandClaude Sonnet 5.5 f528844ff9 fix: read the recoverable tool-call cases instead of failing the response
Four shapes that ended in response.failed (or 502 tool_call_parse_failed) are now calls, each logged on stderr as
"tool call accepted beyond the template form (closers supplied: N, arguments repaired: M, ...)":

* </function> left out: a </parameter> followed by </tool_call> ends the value and the call, but only when no </parameter>
  followed by <parameter= or </function> ends the value (upstream d7113273, #4427/#4077). A streamed response delivers such
  a call when the generation ends, not at its </tool_call>: only the end can tell it from </parameter></tool_call> quoted
  inside a value.
* </tool_call> left out: the call is whole when the next <tool_call><function=NAME> follows its </function>, or when its
  </function> ends a generation that stopped by itself (finish stop). A generation cut by the token limit never gets this.
* A call inside the reasoning (no </think>): a normal stop whose text ends on whole calls of declared tools, the first at
  the start of a line outside a code fence and inline code, is reasoning (completed) followed by those calls (upstream
  805ebe17/d7113273, #804). The calls' markup was already streamed as reasoning deltas; the final reasoning item ends before it.
* Damaged array/object arguments of a parameter declared array or object (not a union with string): a trailing or doubled
  comma, single quotes, Python True/False/None, extra closing brackets, and an array written as a JSON string of itself are read
  as written (upstream _Lenient, A4). Nothing is invented or dropped; open brackets and bare strings are not repaired here.

Undeclared tool names: upstream returns the call as text and counts it. That is NOT adopted. Text without a call ends an
agent's turn as if it were the answer, while a failed response is retried by the client (docs/e2e-run.md records a session that
survived one such failure), and native_tools_sdet / backend_worker_http pin the refusal. An undeclared tool is still an error;
it is never run and never published.

API: tool_output::{Options, Notes, Parsed, parse_with, calls_at_end}, Incremental::{with_options, finish_after, notes};
parse_complete and Incremental::new keep their strict default reading. Documented in docs/api-contract.md ("Tool-call
parsing") and docs/tool-call-corpus.md.

Corpus: 24 of 41 specimens read as upstream expects (13 before this commit). New unit tests cover each shape whole and
streamed; strata-control lib 334 passed, native_tools_sdet 14 passed, existing tests unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 03:48:29 +01:00
..
2026-10-25 14:14:47 +01:00
2026-10-24 02:03:29 +02:00