fix: pass --thinking flag for adaptive/disabled instead of budget tokens#796
fix: pass --thinking flag for adaptive/disabled instead of budget tokens#796hackyon-anthropic merged 1 commit intomainfrom
Conversation
Previously thinking={"type":"adaptive"} was lowered to --max-thinking-tokens 32000, which puts the CLI in budget mode rather than adaptive mode. The CLI exposes an explicit --thinking <adaptive|enabled|disabled> flag; use it for adaptive and disabled, and only emit --max-thinking-tokens for the enabled/budget case or the deprecated max_thinking_tokens option.
There was a problem hiding this comment.
LGTM — clean fix that correctly maps thinking types to the right CLI flags, with good test coverage.
Extended reasoning...
Overview
The PR modifies in to fix how thinking configuration is translated to CLI flags. It also adds tests in . Two files changed, both in the transport layer.
Security Risks
None. This is purely a CLI argument construction fix with no auth, crypto, or permission-sensitive code involved.
Level of Scrutiny
Low. The change is small, mechanical, and clearly correct. The old code incorrectly mapped adaptive to --max-thinking-tokens 32000 (fixed budget) and disabled to --max-thinking-tokens 0, when both should use the dedicated --thinking flag. The fix mirrors the TypeScript SDK behavior as stated in the description.
Other Factors
The new tests cover all three thinking types parametrically and verify the precedence of thinking over the deprecated max_thinking_tokens. The logic restructure from if/elif/elif + if to if/elif is clean and correct. No outstanding reviewer comments.
Summary
thinking={"type":"adaptive"}was being lowered to--max-thinking-tokens 32000, which puts the CLI into fixed-budget mode rather than adaptive mode.disabledsimilarly mapped to--max-thinking-tokens 0.The CLI exposes an explicit
--thinking <adaptive|enabled|disabled>flag that takes precedence over--max-thinking-tokens. The TypeScript SDK already uses it. This change mirrors that behavior:adaptive→--thinking adaptivedisabled→--thinking disabledenabled→--max-thinking-tokens <budget_tokens>max_thinking_tokensis only emitted whenthinkingis unsetTest plan
pytest tests/test_transport.py(59 passed)thinkingtypesthinkingoverridesmax_thinking_tokens