Skip to content

fix(anthropic): raise adaptive-thinking max_tokens default - #237

Closed
jonathanli12 wants to merge 1 commit into
lidge-jun:devfrom
jonathanli12:fix/anthropic-adaptive-max-tokens
Closed

jonathanli12 wants to merge 1 commit into
lidge-jun:devfrom
jonathanli12:fix/anthropic-adaptive-max-tokens

Conversation

@jonathanli12

Copy link
Copy Markdown
Contributor

Summary

  • Adaptive Claude models (claude-fable-5, claude-sonnet-5, claude-opus-4-7, claude-opus-4-8) previously kept the generic max_tokens = 8192 default when Codex omitted max_output_tokens.
  • The adaptive path only set thinking.type = "adaptive" and output_config.effort, and never resized max_tokens.
  • Long Codex parent turns hit that ceiling mid-work and finished with no final message, even though those models support a 128k output ceiling.
  • Default adaptive max_tokens to 128000 when Codex omits a budget, and preserve explicit maxOutputTokens.

Verification

  • bun test tests/anthropic-reasoning.test.ts
  • Added regression coverage that adaptive models default to 128000 and preserve explicit budgets.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Target branch corrected

This pull request now targets dev.

The [WRONG BRANCH] title prefix has been removed. The pull request has been marked ready for review again.

@github-actions github-actions Bot changed the title fix(anthropic): raise adaptive-thinking max_tokens default [WRONG BRANCH] fix(anthropic): raise adaptive-thinking max_tokens default Jul 22, 2026
@github-actions
github-actions Bot marked this pull request as draft July 22, 2026 01:42
@jonathanli12 jonathanli12 changed the title [WRONG BRANCH] fix(anthropic): raise adaptive-thinking max_tokens default fix(anthropic): raise adaptive-thinking max_tokens default Jul 22, 2026
@jonathanli12
jonathanli12 changed the base branch from main to dev July 22, 2026 01:45
Adaptive Claude models (Fable 5, Sonnet 5, Opus 4.7+) previously kept the
generic 8192 max_tokens default because the adaptive path only set
thinking/effort and never resized max_tokens. Long Codex turns hit the cap
mid-work and finished with no final message even though those models support
128k output.

Default adaptive max_tokens to 128000 when Codex omits max_output_tokens, and
preserve explicit budgets. Add regression coverage.
@github-actions
github-actions Bot marked this pull request as ready for review July 22, 2026 01:45
@lidge-jun

Copy link
Copy Markdown
Owner

Thanks for identifying the adaptive-thinking token ceiling — the diagnosis is right. We're going with #256 as the base fix because it addresses both sides of the incident: adaptive token sizing and end-to-end stop_reason: max_tokens propagation, so any remaining truncation is surfaced correctly instead of appearing as a successful empty response. Its effort-aware sizing is also preferable to raising every adaptive-thinking request to 128k unconditionally.

Closing in favor of #256 (which still has review changes requested — feel free to weigh in there).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants