Repository navigation
Finish reason: tool_calls only when a call parsed (count rule); drop made_call - #27
Merged
Merged
Conversation
…count); drop made_call
eejd
marked this pull request as ready for review
November 15, 2026 13:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switch the finish reason for tool calls to upstream's rule (the same as vLLM's
resolve_finish_reason): astopbecomestool_callsonly when at least one call parsed (ToolCallFormatter.count). The fork'smade_callrule also counted a call dropped as unparseable, so a client could getfinish_reason: tool_callsnext to an emptytool_callslist.made_callis removed; a response cut bymax_tokenskeepslength(both rules rewrite onlystop).Follows the discussion after #26 (kept
made_callas an open owner decision). mlx-lm's server has notool_choicehandling, so the forced-named-tool case (OpenAI:stop) does not arise.Tests
test_a_call_cut_short_is_droppednow assertscount == 0(a dropped call is not a call); the other formatter tests assertcountinstead ofmade_call.test_a_call_that_fails_to_parse_does_not_make_a_tool_call_finish(stop, no calls; fails on the old rule) andtest_a_call_cut_by_max_tokens_stays_length(complete call:tool_calls; cut before the end marker:length, no calls; it passes on the old rule too, becausemade_callonly ever changed astop, so it guards against a regression rather than proving this fix). Disabled in the draft-model subclass like the other scripted-sequence tests.Not verified
Independent review: approve. Probes through the real handler: a dropped wrapped call gives
stop(wastool_callswith an empty list); a recovered bare call and a llama3<|python_tag|>call ending at EOS still givetool_calls; no consumer (dflash, rec, optiq) readsmade_call.