Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek/deepseek-v4-pro· deepseekHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Streaming drops XML tool-call output that non-streaming parses…

  1. 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 using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to 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-$

  2. DeepSeek Assistant

    Let me start by understanding the repository structure and the issue. The issue is about "Streaming drops XML tool-call output that non-streaming parses correctly". This seems to be related to a language model framework (MLX). Let me explore the repository first.

    Let me understand the structure and find relevant files related to XML tool calls, streaming, and parsing.

  3. DeepSeek Assistant

    Let me explore more to find the relevant files related to XML tool calls and streaming.

  4. DeepSeek Assistant

    Let me explore the streaming-related files more closely, and look at the tests for streaming tool calls

  5. DeepSeek Assistant

    Let me look at the key files - the postprocessor (which seems to handle XML tool call parsing) and the streaming tool filter test.

  6. DeepSeek Assistant

    Let me look at the tool parsers and the streaming-related tests.

  7. DeepSeek Assistant

    I need to make just one command at a time. Let me do them sequentially.

  8. DeepSeek Assistant

    Let me look at the streaming pipeline integration test and the tool parsers that deal with XML:

  9. DeepSeek Assistant

    Let me look at the StreamingToolCallFilter and StreamingThinkRouter in the API utils

  10. DeepSeek Assistant

    Let me see the rest of the api/utils.py file, and also look at test files related to XML tool calls

  11. DeepSeek Assistant

    Let me look at the StreamingToolCallFilter and StreamingThinkRouter classes:

  12. DeepSeek Assistant

    Let me read those classes.

  13. DeepSeek Assistant

    Let me find where _TOOL_CALL_TAGS is defined:

  14. DeepSeek Assistant

    Let me look at the _TOOL_CALL_TAGS list

  15. DeepSeek Assistant

    Let me look at the test files related to this

  16. DeepSeek Assistant

    Let me look at the minimax tool parser and the test for it

  17. DeepSeek Assistant

    Let me look at the test for tool calling to find XML-related tests

  18. DeepSeek Assistant

    Let me look at the tool_parsers init.py and the tool_calling.py file:

  19. DeepSeek Assistant

    Let me search for existing failing tests or the specific issue about XML tool calls being dropped:

  20. DeepSeek Assistant

    Let me look at recent changes and search for where the issue might be:

  21. DeepSeek Assistant

    Let me run the existing tests related to streaming and tool calling to see if any fail:

  22. DeepSeek Assistant

    Let me run the postprocessor tests and the streaming pipeline integration tests

  23. DeepSeek Assistant

    Let me run the minimax tool parser test

  24. DeepSeek Assistant

    Let me look at the minimax tool parser test file to understand the streaming patterns better

  25. DeepSeek Assistant

    Let me look at the Mistral tool parser to see its format:

  26. DeepSeek Assistant

    Let me look at several tool parsers to see all the formats:

  27. DeepSeek Assistant

    Let me look at the server.py and chat routes to understand the streaming

  28. DeepSeek Assistant

    Let me look at the anthropic route to understand how _emit_content_pieces and StreamingToolCallFilter are used

  29. DeepSeek Assistant

    Let me look at the chat route to understand the streaming flow

  30. DeepSeek Assistant

    Let me look at the chat route streaming code around line 822-1000

  31. DeepSeek Assistant

    Let me look at the git diff for the changes related to streaming tool calls

  32. DeepSeek Assistant

    Let me look at commit #424 which seems related to the streaming tool fallback

  33. DeepSeek Assistant

    Let me look at the test_chat_streaming_spec.py file

  34. DeepSeek Assistant

    Let me look at the seed_oss_tool_parser to see its XML format:

  35. DeepSeek Assistant

    Let me see where StreamingToolCallFilter is used:

  36. DeepSeek Assistant

    Let me look at the anthropic route more carefully around line 425:

  37. DeepSeek Assistant

    Let me see the rest of the anthropic route to understand how tool calls are recovered after

  38. DeepSeek Assistant

    Let me look at _parse_tool_calls_with_parser:

  39. DeepSeek Assistant

    Let me look at where _parse_tool_calls_with_parser is defined:

  40. DeepSeek Assistant

    Let me look at _parse_tool_calls_with_parser in helpers.py

  41. DeepSeek Assistant

    Let me run all tests to see if there are any failures:

  42. DeepSeek Assistant

    Let me check what libraries are available and try to install mlx

  43. DeepSeek Assistant

    Let me check the mlx installation more carefully

  44. DeepSeek Assistant

    Let me look at the Llama tool parser to see its format:

  45. DeepSeek Assistant

    Let me search for [/TOOL_CALLS] in the code

  46. DeepSeek Assistant

    Let me search for any test that might be failing related to this

  47. DeepSeek Assistant

    Let me try running just the tool filter tests (which don't depend on mlx)

  48. DeepSeek Assistant

    Let me look at the agents testing module and adapter to understand the full picture:

  49. DeepSeek Assistant

    Let me look at how the agent adapter registers tags

  50. DeepSeek Assistant

    Let me look at the agent adapter tag registration

  51. DeepSeek Assistant

    Let me search for TODO or FIXME comments related to tool calls or XML

  52. DeepSeek Assistant

    Let me create a reproduction script to test the StreamingToolCallFilter behavior:

  53. DeepSeek Assistant

    Wait, the output shows [TOOL_CALL] not [TOOL_CALLS]. Let me re-check the actual code

  54. DeepSeek Assistant

    Let me look at the actual code around line 308:

  55. DeepSeek Assistant

    Let me look at the Qwen tool parser's streaming method

  56. DeepSeek Assistant

    Let me check what format uses [TOOL_CALL] (

  57. DeepSeek Assistant

    I think I found a bug! Let me verify it:

  58. DeepSeek Assistant

    Let me check the Nemotron and other parsers for [TOOL_CALL] format:

  59. DeepSeek Assistant

    I found at least one clear bug. Let me fix the _scan_for_open method in StreamingToolCallFilter which finds the first tag in list order rather than the earliest in the text. Let me also check if [TOOL_CALL] should be [TOOL_CALLS]

  60. DeepSeek Assistant

    Let me open the file for

  61. DeepSeek Assistant

    Let me navigate to the _scan_for_open method:

  62. DeepSeek Assistant

    Let me look at the _scan_for_open method:

  63. DeepSeek Assistant

    Now I can see the bug clearly. Let me fix the _scan_for_open method to find the earliest match across all tags, not the first tag in list

  64. DeepSeek Assistant

    Let me use the heredoc syntax for the edit:

  65. DeepSeek Assistant

    Let me use a Python script to make the edit:

  66. DeepSeek Assistant

    Now let me replace the method with the fix:

  67. DeepSeek Assistant

    Let me verify the fix works:

  68. DeepSeek Assistant

    Let me check the xLAM parser to see if it uses [TOOL_CALL]:

  69. DeepSeek Assistant

    Now let me also fix the [TOOL_CALL] tag - it should be [TOOL_CALLS] to match the Mistral/xLAM format. The close tag [/TOOL_CALLS] doesn't actually exist in those formats, but that's OK because flush() will discard the unterminated block:

  70. DeepSeek Assistant

    Let me verify the changes with comprehensive tests:

  71. DeepSeek Assistant

    Now let me run the existing tests for StreamingToolCallFilter:

  72. DeepSeek Assistant

    Let me also run the streaming pipeline integration test and other related tests that don't require mlx

  73. DeepSeek Assistant

    Let me also add the Seed-OSS format to the tool call tags, as it uses <seed:tool_call> which wasn't covered

  74. DeepSeek Assistant

    Let me add Seed-OSS to the default _TOOL_CALL_TAGS list permanently

  75. DeepSeek Assistant

    Let me verify the final state of the _TOOL_CALL_TAGS and run all tests:

  76. DeepSeek Assistant

    Let me run the full test suite for all unaffected tests:

  77. DeepSeek Assistant

    Let me also check if the _has_plausible_markup check in finalize misses the [TOOL_CALLS] format (without braces):

  78. DeepSeek Assistant

    Let me add [TOOL_CALLS to the _has_plausible_markup check in the postprocessor to cover the Mistral format edge case

  79. DeepSeek Assistant

    Let me look at the postprocessor file for the _has_plausible_markup check

  80. DeepSeek Assistant

    Let me update the _has_plausible_markup check to also include [TOOL_CALLS

  81. DeepSeek Assistant

    Let me run the postprocessor tests:

  82. DeepSeek Assistant

    Let me also check if _consume_block has any similar issues (looking for correct close tag handling

  83. DeepSeek Assistant

    Let me verify all the changes I made

  84. DeepSeek Assistant

    Let me run all the relevant tests one final time to confirm everything passes

  85. DeepSeek Assistant

    All 470 tests pass. Let me now do a final review of the diff:

  86. DeepSeek Assistant

    The changes look good. Let me verify one more edge case and then submit.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.