mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[GH-ISSUE #613] Thinking budget closes an agent turn's reasoning mid-sentence; the malformed tool call that followed failed the whole request #254
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#254
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @NenadSteric on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/613
Version: observed on v1.1.34 (
249f9a8),maya-mm3, MiniMax-M3.1-Flash Maya-S, 6x RTX 3090, the setup's config(
thinking_budgetnot set). v1.1.35 changes none of the code involved: the default (serve/server.py:5013), theclamp (
:2995),parse_tool_call(serve/frontend.py:678) and the error path (serve/server.py:3088-3102).What happened
A coding agent (pi, OpenAI API,
max_tokens32768, tools on) in a long session:thinking_budget(32768,docs/SETTINGS.md) is clamped to 24,575 by the request's 32Kmax_tokens. In turn 3 the reasoning reached that clamp and was closed in the middle of a sentence:0I have enough context to work. Let me check the plan.md and plan.md files in thepagi — actually let me start writing the plan and implementation.), and ~100 tokens later came a tool callthe parser rejects.
only the error, and the agent stopped:
With
"thinking_budget": 0and everything else the same, the session ran 65 turns with no malformed call, and twoother sessions on the same server (~325 turns) never reached the budget and had none either. This is one
occurrence. The forced close is the likely trigger, but that is not proven.
The same budget also closed a GLM-5.3-Flash EXL3 turn (v1.1.25, 32K
max_tokens) at 24,576 tokens. That answer thenran to the 32K limit (
stop=length); the session recovered.Three points (your call which are worth changing)
ValueErrorfrom the tool-call parser takes the same pathas an engine
ERRline, so the client gets an error instead of what was generated. If the text and the call bodywere returned as the answer's content (
finish_reason"stop"), an agent would see the broken call and could retryinstead of stopping.
keeps only the call's first 80 characters, so the part that failed is lost. Logging the whole body, or at least
its tail, would show what broke.
max_tokens. Agent clients send a large cap and expectthe reasoning to run inside it. The clamp keeps a reply from ending with no answer, but it closes the reasoning
wherever it is, mid-sentence included. One option: leave the reasoning unbudgeted when the request carries tools,
or close it only at a line or sentence boundary. The documented setting already turns it off, so this may simply
be a docs note for agent use.
🤖 Generated with Claude Code
@mw00 commented on GitHub (Oct 28, 2026):
Thank you @NenadSteric. v1.1.36 now logs the whole body of a malformed tool call (it was cut at 80 characters), which is what we needed to see what the model wrote at the cut. The part where the thinking budget closes the reasoning mid-sentence is still open; with the full body in the log it can be tackled next. If you can send one of those logged bodies, it would help.
Released in v1.1.36: https://github.com/mw00/project-maya/releases/tag/v1.1.36