[PR #787] [CLOSED] fix: parse tool calls inside reasoning #2827

Closed
opened 2026-11-04 02:03:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/787
Author: @kossum
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: fix/reasoning-tool-calls


📝 Commits (1)

  • ff25a48 fix: parse tool calls inside reasoning

📊 Changes

2 files changed (+47 additions, -3 deletions)

View changed files

📝 serve/frontend.py (+13 -3)
➕ serve/test_reasoning_tools.py (+34 -0)

📄 Description

I have been running into agent turns that stop after thinking, with no answer or tool call. One case is when the model writes a complete before closing . The parser treats it as reasoning text, so the client never gets the call.

This patch lets the reasoning state use the existing tool-call parser too. After the call, it goes back to reasoning until arrives. It also keeps partial <tool_call> tags buffered when they're split across chunks.

This only handles the tool fragment being swallowed. It doesn't change stop tokens or try to continue a reply that contains nothing but reasoning.

Tests

python -m unittest serve.test_reasoning_tools passes. Covers tool calls in reasoning and normal content, tags split across chunks, and unfinished calls.

These checks ran in a Linux Docker container with Python 3.12. They don't include a GPU inference test.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/787 **Author:** [@kossum](https://github.com/kossum) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/reasoning-tool-calls` --- ### 📝 Commits (1) - [`ff25a48`](https://github.com/Niko1221/Strata/commit/ff25a4869dbc242fbde5d787ab8d740110b2633f) fix: parse tool calls inside reasoning ### 📊 Changes **2 files changed** (+47 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `serve/frontend.py` (+13 -3) ➕ `serve/test_reasoning_tools.py` (+34 -0) </details> ### 📄 Description I have been running into agent turns that stop after thinking, with no answer or tool call. One case is when the model writes a complete before closing . The parser treats it as reasoning text, so the client never gets the call. This patch lets the reasoning state use the existing tool-call parser too. After the call, it goes back to reasoning until arrives. It also keeps partial `<tool_call>` tags buffered when they're split across chunks. This only handles the tool fragment being swallowed. It doesn't change stop tokens or try to continue a reply that contains nothing but reasoning. ## Tests `python -m unittest serve.test_reasoning_tools` passes. Covers tool calls in reasoning and normal content, tags split across chunks, and unfinished calls. These checks ran in a Linux Docker container with Python 3.12. They don't include a GPU inference test. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2827
No description provided.