Repository navigation
Python: fix(claude): preserve explicit zero limit options - #9159
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoOct 12, 2026
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
Conversation
Suhas Aggarwal (suhasagg)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 7, 2026 14:46
Suhas Aggarwal (suhasagg)
temporarily deployed
to
github-app-auth
October 7, 2026 14:46 — with
GitHub Actions
Inactive
Suhas Aggarwal (suhasagg)
temporarily deployed
to
github-app-auth
October 7, 2026 14:46 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The narrow fix correctly distinguishes zero from unset values, with regression coverage for both affected options.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes #9157 by preserving explicit zero-valued limits when configuring the Python Claude SDK.
Changes:
- Uses explicit
Nonechecks formax_turnsandmax_budget_usd. - Adds regression coverage for both zero-valued options.
| File | Description |
|---|---|
python/packages/claude/tests/test_claude_agent.py |
Tests forwarding of explicit zero limits. |
python/packages/claude/agent_framework_claude/_agent.py |
Preserves zero values while continuing to omit unset options. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 12, 2026
This branch was previously deployed
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.
Motivation & Context
ClaudeAgent._prepare_client_options()currently uses truthiness checks when forwardingmax_turnsandmax_budget_usdtoSDKOptions.Because
0and0.0are falsy in Python, explicitly configured zero values are silently omitted. This conflates an explicitly supplied numeric value with an unset (None) option.This change ensures that explicitly supplied zero values are preserved while maintaining the existing behavior for unset options.
The issue has been independently reproduced by the repository's automated triage workflow.
Description & Review Guide
What are the major changes?
max_turnsandmax_budget_usdwith explicitNonechecks.max_turns=0andmax_budget_usd=0.0are forwarded toSDKOptions.What is the impact of these changes?
None) values continue to be omitted as before.What do you want reviewers to focus on?
Nonechecks are the appropriate way to distinguish unset configuration from explicitly supplied numeric values.Related Issue
Fixes #9157
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.