#5901 [Engine] finish tool arguments that quote an unclosed call
open · @ddm187 · 0 commentaires · Sur GitHub
Description
## Problem and result A streaming client can receive the start of a tool call and its argument deltas, then never receive the completed call. This happens when a string argument quotes an incomplete example such as `see <function=write><parameter=path>x`. The example leaves an unmatched opener inside the string, so the parser skips the real closing tags of the outer call. With this fix, the client receives the final call with the quoted text intact. Streaming and whole-response parsing return the same arguments. ## Related discussion Follow-up to #4078 and #4132, which covered complete quoted calls. This change handles an unfinished example inside an otherwise complete outer call. ## Approach and limits The parser retains a possible argument boundary while the quote is open. A later balanced boundary takes precedence. At the end of the turn, the parser can use the retained boundary if the remaining text forms the rest of the call. It leaves genuinely truncated calls unfinished. Missing outer parameter closers (#5756) and closing-tag pairs followed by additional file text (#5883) are separate cases. ## Validation **Passed** on Linux x86-64, Python 3.14.8, PR head `d304b720d` merged with main `3142b66b9`. From `terminal/`: ```sh python3 -m unittest serve.test_quoted_call_values serve.test_frontend serve.test_anthropic_tool_results serve.test_tool_routes serve.test_tool_name_space serve.test_tool_name_mcp_member serve.test_tool_opener_misspelt serve.test_tool_call_unclosed serve.test_reasoning_tools serve.test_native_tool_parser serve.test_tool_format serve.test_parser_call_scan serve.test_tool_call_cutoff serve.test_tool_call_envelope serve.test_tool_call_invoke -q ``` 148 tests passed, including streamed and whole calls, one-character chunks, bare calls, calls in reasoning, and long streamed arguments. The additional command `python3 -m unittest serve.test_parser_bare_reasoning_call serve.test_parser_skipped_closer serve.test_value_closer_pair -q` passed all 18 tests. Compilation of both changed Python files and `git diff --check` also passed. **Failed during development:** the seven quoted-value tests from this PR produced 16 assertion failures against the earlier main revision `58ee32277`. The first merge candidate also lost a 5,000-character streamed argument during finalization. Restoring the compacted body after the final scan fixed that failure in the existing native-tool-parser regression test. **Not run locally:** live-model generation, Windows, or macOS. The reproduction feeds model output directly to the Python parser. No native backend files changed.
Sur le site
Liens install, modèles, releases.