fix(delegation): honor api_key_env for direct endpoints#48605
Closed
Veritas-7 wants to merge 1 commit into
Closed
Conversation
Collaborator
|
Duplicate of #48579 — same-author re-file of an identical fix to |
93b816e to
a14a382
Compare
Contributor
Author
|
Closing this as a duplicate/superseded branch for the same delegation api_key_env fix. Keeping #48579 as the canonical PR because it carries the same functional fix plus the attribution follow-up needed for CI. Local patch should remain retained until the canonical PR merges. |
Contributor
Author
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
delegation.api_key_envfor direct delegation endpoints when no literaldelegation.api_keyis configured.Problem
Direct delegation endpoints can point at provider-specific APIs whose credentials live in provider-specific environment variables. Before this change, a direct endpoint config with
api_key_envcould still fall back to the parent agent key when the env value was unavailable, producing a confusing downstream 401 from the custom endpoint.Tests
python -m py_compile tools/delegate_tool.py tests/tools/test_delegate.pypython -m pytest tests/tools/test_delegate.py -q -o 'addopts=' -k 'direct_endpoint_uses_configured_api_key_env or direct_endpoint_api_key_env_missing_or_empty_raises or DelegationCredentialResolution'git diff --check origin/main..HEADgitleaks git --log-opts='origin/main..HEAD' --no-banner --redact