Repository navigation
fix(server): report undecodable tool calls across APIs - #3690
Conversation
…rse-error # Conflicts: # src/server/routes/tool_call_stream_route_tests.rs
The parse-error dispatch returned the first parser that recorded any rejection. The undelimited Pythonic scan claims `[name(...)]` anywhere in prose, so an answer such as "Count them with [len(items)] in Python." on a request with tools now failed with `tool_call_parse_error` (HTTP 500 on chat) because `len` is not a declared tool. On main it was returned as content. The dispatcher now falls through to the plain-content path when an undelimited Pythonic match has only undeclared names, and when a parser rejected regions on a request without tools, matching the previous behavior there. Delimited regions with undeclared names still fail as the issue specifies. Adds a parser test and a chat route test for the prose case (both fail without this change), and a route test that the chat, Responses and Anthropic streams carry the parse error without leaking `<tool_call>` markup or emitting a call. Refs lablup#3626, lablup#3690
|
Maintainer hardening pass against #3626. Merge with main. Merged origin/main (including #3696, Anthropic stop semantics). The only conflict was Finding (fixed in f85bd62). The dispatcher returned the first parser that recorded any rejection. The undelimited Pythonic scan claims Added tests. A parser test and a chat route test for the prose case (both fail on the previous head), and a route test that the chat, Responses and Anthropic streams end with the parse error without leaking Reviewed, no change. Error shapes match each API (chat 500 / Validation (DGX Spark, default features). |
A parser-level test for the slash-keeping tag names: an invoke to an undeclared tool whose body uses a slashed key is still dropped with an `unknown tool` error (the lablup#3690 reporting path), and a `<x/>` tag or an unclosed slashed key absorbs only the rest of its own invoke body, so the enclosing `</invoke>` is still found and the following invokes parse intact. Refs lablup#3738
* fix(server): keep '/' in MiniMax M3 tool-call tag names * test(server): pin MiniMax M3 slashed keys on bad and undeclared calls A parser-level test for the slash-keeping tag names: an invoke to an undeclared tool whose body uses a slashed key is still dropped with an `unknown tool` error (the #3690 reporting path), and a `<x/>` tag or an unclosed slashed key absorbs only the rest of its own invoke body, so the enclosing `</invoke>` is still found and the following invokes parse intact. Refs #3738 --------- Co-authored-by: Jeongkyu Shin <[email protected]>
Report undecodable tool calls across server APIs
Fixes #3626. Chat, Responses and Anthropic now distinguish an ordinary text answer from a generation that attempted a tool call but produced no usable call. This applies to both buffered and streamed requests: a failed stream ends with its API’s error event rather than reporting success. A valid sibling is still returned, and reaching the output-token limit is not a parser failure.
The parser records rejected calls after recognizing a tool-call region. Python REPL prompts, Markdown quotes and prose action notes are not Functionary or Command R invocations; regression tests cover these alongside malformed calls.
Verification on DGX Spark: formatting and workspace all-target Clippy passed with default features and with CUDA. The CPU route filter passed 673 tests (one ignored), and the tool_calls filter passed 586. With CUDA enabled, all 16 scripted route tests and all 568 parser-module tests passed. These are scripted-provider tests, not live model inference. The unfiltered workspace test suite was not run.