Skip to content

fix(auxiliary): resolve api_key_env alias in named custom provider path of resolve_provider_client#25294

Closed
zccyman wants to merge 1 commit into
NousResearch:mainfrom
atyou2happy:fix/auxiliary-api-key-env-fallback
Closed

fix(auxiliary): resolve api_key_env alias in named custom provider path of resolve_provider_client#25294
zccyman wants to merge 1 commit into
NousResearch:mainfrom
atyou2happy:fix/auxiliary-api-key-env-fallback

Conversation

@zccyman

@zccyman zccyman commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

In resolve_provider_client(), the named custom provider code path only checked the key_env field when looking for an environment-variable-based API key. The documented api_key_env snake_case alias was silently ignored, causing custom providers configured with api_key_env to fall through to the no-key-required placeholder.

Bugs Fixed

Testing

Test results (1277 passed, 6 known flaky failures, 3 skipped):

  • tests/agent/test_auxiliary_client.py: 155 passed
  • tests/agent/test_auxiliary_named_custom_providers.py: 29 passed
  • tests/agent/test_auxiliary_main_first.py: 21 passed
  • tests/agent/test_auxiliary_config_bridge.py: 2 passed
  • tests/agent/test_auxiliary_transport_autodetect.py: 32 passed
  • tests/run_agent/test_fallback_model.py: 31 passed
  • 6 failures all in tests/hermes_cli/test_api_key_providers.py (pre-existing flaky, unrelated)

Files Changed

File Change
agent/auxiliary_client.py Add api_key_env alias check at line 2913; add logger.warning() when key falls back to no-key-required

Closes #25091

…th of resolve_provider_client

In resolve_provider_client(), the named custom provider code path at
~line 2914 only checked the ``key_env`` field when looking for an
environment-variable-based API key. The documented ``api_key_env``
snake_case alias was silently ignored, causing custom providers
configured with ``api_key_env`` to fall through to the
``no-key-required`` placeholder — which produces a confusing 401
(``****ired`` mask) on auth-required remote endpoints.

This mirrors the same fix already applied to run_agent.py in commit
6ddc48b (fix(fallback): resolve api_key_env in fallback chain entries).

Also adds a logger.warning() when the placeholder is reached, so
future alias gaps are easier to debug.

Closes NousResearch#25091
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent loop, run_agent.py, prompt builder area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists labels May 14, 2026
teknium1 added a commit that referenced this pull request May 17, 2026
…tors

Adds release-note attribution mappings for 9 contributors from group 4:
- @EloquentBrush0x (PR #26657)
- @subtract0 (PR #25658)
- @zwolniony (PR #26961)
- @that-ambuj (PR #26582)
- @zccyman (PR #25294)
- @lidge-jun (PR #26814)
- @phoenixshen (PR #26768)
- @AhmetArif0 (PR #26635)
- (francip already mapped from prior PR #26134 attribution)

#27147 dropped from this batch — already landed on main as 4b17c24.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #27308 — your commit was cherry-picked onto current main as part of a batch salvage of low-risk new-contributor PRs. Authorship preserved (fix(auxiliary): resolve api_key_env alias in named custom provider path). Thanks for the contribution.

@teknium1 teknium1 closed this May 17, 2026
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…tors

Adds release-note attribution mappings for 9 contributors from group 4:
- @EloquentBrush0x (PR NousResearch#26657)
- @subtract0 (PR NousResearch#25658)
- @zwolniony (PR NousResearch#26961)
- @that-ambuj (PR NousResearch#26582)
- @zccyman (PR NousResearch#25294)
- @lidge-jun (PR NousResearch#26814)
- @phoenixshen (PR NousResearch#26768)
- @AhmetArif0 (PR NousResearch#26635)
- (francip already mapped from prior PR NousResearch#26134 attribution)

NousResearch#27147 dropped from this batch — already landed on main as 4b17c24.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: api_key_env alias silently ignored in fallback_providers entries — falls through to "no-key-required" placeholder

3 participants