ISSUE DESCRIPTION Streaming drops XML tool-call output that non-streaming parses…
- User
ISSUE DESCRIPTION
Streaming drops XML tool-call output that non-streaming parses correctly
Streaming must emit the same recovered XML tool calls as non-streaming, including calls split across chunks and multiple calls, and finish with
tool_calls. Reasoning mode and request tool selection must not alter recovery. Plain text or malformed markup must not create calls or abort the stream.Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /Rapid-MLX, current file: none) bash-$
Assistant
Now let's look at the "both merged" test around line 709 for MiniMax reasoning + content.
Assistant
All 74 tests still pass. Now let's re-run our reproduction script to confirm the fix.
Assistant
Now let's fix the same pattern in
_process_standard:Assistant
Now let's add the pending-finish state and update reset/init:
Assistant
Now update
_process_channel_routedand_process_standardto defer instead of emit directly:Assistant
That worked for the first occurrence already (since count check failed before replace, so file unchanged). Let me redo both separately.
Assistant
Now let's update
finalize()to emit the pending finish event if no tool call was recovered:Assistant
Now let's run the tests again to verify nothing broke:
Assistant
All existing tests pass. Now let's rerun our repro scripts to confirm behavior.
Assistant
Consistent recovery regardless of request/tools_requested. Now let's run the full test suite for tool parsers and other related tests to check for regressions.
Assistant
All pass. Let's run the broader full test suite to check for any unintended regressions elsewhere.
Assistant
Confirmed — this is a pre-existing environment limitation unrelated to my changes (missing MLX runtime causes
sys.exit(0)in several test modules during collection, which crashes pytest's internals). Let's find and exclude all such modules, then run the rest.Assistant
Exact same numbers (150 failed, 2900 passed, 176 skipped, 47 errors) before and after my change — confirming these are pre-existing environment issues, not regressions from my fix.
Assistant
Let's view the final full diff to review correctness end-to-end.
Assistant
Good —
from __future__ import annotationsis present, so the string-quoted annotation is safe. Let's run the tests once more and also verify our earlier repros still behave correctly, plus a quick syntax sanity check.Assistant
Let's also re-verify the full set of reproduction scripts one more time to confirm consistent, correct behavior, then clean up temp files.
Assistant
This confirms the fix works correctly for the channel-routed path too — the finish event is properly deferred and emitted via
finalize(). Let's clean up the temporary repro scripts.Assistant
Let's do a final full run of the postprocessor-related test suites one more time before submitting.
Assistant
All relevant tests pass. Let me go through the checklist explicitly before submitting.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.