Skip to content

anthropic: adaptive-thinking turn silently ends with max_tokens and zero output tokens when reasoning exhausts the 32k budget #51517

Closed as not planned

Description

@peterkendlbacher

Summary

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)
  • Shell: Git Bash (C:\Program Files\Git\usr\bin\bash.exe)
  • Install/channel: release (latest)
  • Active plugins: none configured

Reproduction

  1. Configure an agent for an Anthropic model with adaptive thinking (e.g. anthropic/claude-opus-5-5, variant #max).
  2. Ask a question that triggers a long reasoning phase (open-ended design/naming decisions, large context).
  3. 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.
  4. The session marks idle with outcome: "succeeded" and the user receives no answer and no error.
  5. 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.

Additional Context

Affected turns observed (date UTC, agent, reasoning tokens, output tokens, cost):

when agent reasoning output cost
2026-09-26 14:57 business-analyst (claude-opus-5-5#max) 32000 0 $1.15
2026-09-26 03:27 architect 32000 0 $2.69
2026-09-25 15:20 architect 32000 0 $0.70
2026-09-25 15:35 architect 32000 0 $0.72
2026-09-25 16:05 svg-designer (claude-sonnet-5) 32000 0 $0.33
2026-09-25 16:10 svg-designer 32000 0 $0.45
2026-09-25 16:18 svg-designer 32000 0 $0.33

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.

Activity

  1. github-actions commented on Sep 26, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • 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:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Sep 26, 2026

    @github-actions
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions