Repository navigation
Python: Skip Claude client settings when a client is injected - #9984
Open
ZedingZhang (ZedingZhang) wants to merge 1 commit into
Open
ZedingZhang (ZedingZhang) wants to merge 1 commit into
ZedingZhang (ZedingZhang) wants to merge 1 commit into
Conversation
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 2, 2026 17:51 — with
GitHub Actions
Inactive
ZedingZhang (ZedingZhang)
marked this pull request as ready for review
November 2, 2026 17:51
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 2, 2026 17:52 — with
GitHub Actions
Inactive
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 2, 2026 17:53 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change to bypass client-construction settings when a preconfigured Claude client is injected.
No open issues 🎉
What changed in this PR
This PR fixes #9960 by skipping client-construction settings when a preconfigured Claude SDK client is injected, while preserving settings resolution for framework-created clients.
Changes:
- Load
ClaudeAgentSettingsonly when the framework owns client creation. - Add eight parameterized regression and control cases covering settings bypass, caller ownership, and settings precedence.
- Clarify that injected clients remain caller-owned and bypass client settings and
.envloading.
| File | Description |
|---|---|
python/packages/claude/tests/test_claude_agent.py |
Adds injected-client regression tests and framework-created client controls for both agent classes. |
python/packages/claude/agent_framework_claude/_agent.py |
Guards settings loading by client ownership and documents the injected-client contract. |
Review effort: Balanced
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
RawClaudeAgent(client=...)still loads client-construction settings, so an unrelated value such asCLAUDE_AGENT_MAX_TURNS=not-an-intprevents use of a preconfigured SDK client. The injected-client path never uses those settings.Description & Review Guide
ClaudeAgentSettingsonly when the framework owns client creation. Add eight parameterized regression/control cases covering bothRawClaudeAgentandClaudeAgent, and clarify the constructor's injected-client contract..envloading. Framework instructions and tool normalization still run, and the injected client remains caller-owned..envfiles, ignored construction options, client reuse and cleanup, and explicit argument > selected file > environment precedence for framework-created clients. Six cases fail on the original implementation and all eight pass with the fix.Related Issue
Fixes #9960. The issue has the
ready-for-implementationlabel; no competing open PR was found before submission.AI Assistance
AI assistance details: Codex assisted with investigation, implementation, tests, the constructor docstring, and this PR description. Codex executed the reported checks; I reviewed all submitted content and take responsibility for it.
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.