You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
anthropic: adaptive-thinking turn silently ends with max_tokens and zero output tokens when reasoning exhausts the 32k budget #51517
An assistant turn using adaptive thinking can exhaust its entire response budget on reasoning and then end with max_tokens, delivering zero visible output tokens. The session goes idle with outcome: "succeeded", no error is shown, and the user only sees the agent "stop" — while reasoning tokens are still billed. Recurs across models, agents, and sessions (11 affected turns in the 12 most recent sessions).
Environment
opencode version: 2.0.18 (channel: latest)
OS: Windows 10.0.26200 (win32 x64)
Terminal: VS Code integrated terminal (TERM_PROGRAM=vscode, xterm-256color)
Configure an agent for an Anthropic model with adaptive thinking (e.g. anthropic/claude-opus-5-5, variant #max).
Ask a question that triggers a long reasoning phase (open-ended design/naming decisions, large context).
The turn streams for several minutes, then ends with finish: "length", rawFinish: "max_tokens", tokens.reasoning: 32000, tokens.output: 0, no text part in the message content.
The session marks idle with outcome: "succeeded" and the user receives no answer and no error.
Re-sending "continue" often succeeds, because the retry's reasoning phase happens to fit the budget — masking the failure.
Expected Behavior
The thinking/reasoning allocation should be capped so that part of the max_tokens budget is always left for the answer, or
a budget-exhausted, zero-output turn should produce a visible, retryable error/state instead of a silent success.
Actual Behavior
Silent empty response. No entry in the server log (checked the incident window — only normal INFO events).
Cost is incurred for the pure reasoning (observed $0.34–$2.69 per wasted turn).
The observed per-request output ceiling is exactly 32,000 tokens (reasoning + output combined) — every failure shows reasoning: 31997–32000 and output: 0–3.
Notably, the model catalog lists limit.output: 128000 for claude-opus-5-5, and no limit, outputTokens or related setting exists in the user's global or project config — the 32k cap therefore comes from request handling, not user configuration.
Plus further near-misses with 2–3 output tokens (e.g. 2026-09-25 16:03, reasoning 31998, output 2).
Healthy control turns in the same sessions fit under the budget (e.g. reasoning 24089 + output 2999 → end_turn), confirming the cap is the differentiator.
Workaround: lower the reasoning level for thinking-heavy agents (#max → #high); "continue" retries when a turn comes back empty.
This report does not use the Bug Report template's required Description field (it has Summary instead). Please edit it to follow the bug report template while keeping the reproduction and system details.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
Activity
github-actions commentedon Sep 26, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
max_tokens/reasoning-only turns are recorded as successful with empty output.limit.outputin config is silently capped at 32k;OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAXis a poor workaround #29363: The configured output limit is capped at 32k, causing reasoning-heavy turns to produce no visible output.If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Sep 26, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.