feat: forward thinking.display to --thinking-display CLI flag#830
Open
maxim092001 wants to merge 1 commit intoanthropics:mainfrom
Open
feat: forward thinking.display to --thinking-display CLI flag#830maxim092001 wants to merge 1 commit intoanthropics:mainfrom
maxim092001 wants to merge 1 commit intoanthropics:mainfrom
Conversation
Opus 4.7+ defaults thinking.display to "omitted", which returns empty
thinking text and signature-only deltas. The bundled CLI accepts
--thinking-display <summarized|omitted> to override, but the Python SDK
neither exposed display on ThinkingConfig nor forwarded it in
_build_command, so {"type":"adaptive","display":"summarized"} was
silently dropped.
- Add optional display: ThinkingDisplay to ThinkingConfigAdaptive and
ThinkingConfigEnabled
- Forward display to the CLI via --thinking-display in _build_command
- Tests for adaptive+display, enabled+budget+display, and
omission of --thinking-display when display is unset
Author
|
Opened #831 with a standalone writeup of the problem and repro. |
Author
|
@qing-ant could you please take a look on this one? Thanks! |
qing-ant
approved these changes
Apr 16, 2026
Contributor
qing-ant
left a comment
There was a problem hiding this comment.
approved, and seems like parity with existing TS as of last week
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #830 +/- ##
=======================================
Coverage ? 84.31%
=======================================
Files ? 14
Lines ? 2633
Branches ? 0
=======================================
Hits ? 2220
Misses ? 413
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expose
thinking.displaythroughClaudeAgentOptions.thinkingso callers can override Opus 4.7's default\"omitted\"behavior and receive summarized thinking text.Motivation
Opus 4.7 silently changed the default of
thinking.displayfrom\"summarized\"(Opus 4.6) to\"omitted\". The bundled Claude Code CLI (2.1.111) accepts--thinking-display <summarized|omitted>to override this, but the Python SDK had no way to pass it:ThinkingConfigAdaptive/ThinkingConfigEnabledTypedDicts omitdisplaySubprocessCLITransport._build_commandonly readst[\"type\"], so any extra keys in the thinking dict are silently droppedAs a result, any Opus 4.7 chat through
claude-agent-sdkreturnsThinkingBlock(thinking=\"\", signature=\"...\")with zerothinking_deltastream events.{\"type\": \"adaptive\", \"display\": \"summarized\"}looks like it should work but doesn't.Reproduction (Opus 4.7, before this change):
After this change, passing
thinking={\"type\": \"adaptive\", \"display\": \"summarized\"}yieldsthinking_deltaevents and non-emptyThinkingBlock.thinking.Changes
ThinkingDisplay = Literal[\"summarized\", \"omitted\"]and optionaldisplay: NotRequired[ThinkingDisplay]onThinkingConfigAdaptiveandThinkingConfigEnabled(src/claude_agent_sdk/types.py)displayto the CLI via--thinking-displayin_build_command(src/claude_agent_sdk/_internal/transport/subprocess_cli.py)tests/test_transport.py)Notes for reviewers
--thinking-displayis a real flag on the bundled CLI 2.1.111 (claude --thinking-display bogusreturnsAllowed choices are summarized, omitted) but it's not listed inclaude --help. If the flag is intended to stay internal, happy to gate this behind a doc note or withdraw. If it's intended to be public, an accompanying mention in the docs / CHANGELOG would be worth adding when this lands.@anthropic-ai/claude-agent-sdk) appears to have the same gap; happy to file a sibling PR if useful.CHANGELOG.mduntouched sincetest_changelog.pyenforces## X.Y.Zversion headings; suggest folding an entry into the next release section.Test plan
pytest tests/test_transport.py tests/test_types.py tests/test_changelog.py— 121 passed--thinking-displayis absent whendisplayis unset (preserves server default)thinking={\"type\": \"adaptive\", \"display\": \"summarized\"}producesthinking_deltaevents and non-emptyThinkingBlock.thinking(reviewer to confirm against their environment)