fix(aux): resolve key_env/api_key_env in auxiliary task config - #36080
fix(aux): resolve key_env/api_key_env in auxiliary task config#36080DatTheMaster wants to merge 1 commit into
Conversation
mxnstrexgl
left a comment
There was a problem hiding this comment.
LGTM — automated review passed. No security, quality, or test coverage issues detected.
fff2a9e to
c47d812
Compare
c47d812 to
0b36551
Compare
|
Thanks for the focused credential-resolution fix. Current Automated hermes-sweeper review. |
_reads the key_env or api_key_env field (the documented way to reference an env var by name) when no explicit api_key is set, mirroring the same pattern used by resolve_provider_client() for provider-level config. When auxiliary.<task>.key_env: MY_API_KEY_VAR is set, the env var is resolved at task config level inside _resolve_task_provider_model() — without this, such references were silently ignored and the API key resolved to None, causing auth errors downstream. Fixes NousResearch#20139
|
Conflict resolved.. happy to help |
0b36551 to
3a8109f
Compare
Summary
_resolve_task_provider_model()reads per-task config fromauxiliary.<task>.api_keybut ignores thekey_envandapi_key_envfields — the documented way to reference an environment variable by name instead of hardcoding the key value.Every other code path that resolves provider credentials already handles these fields:
resolve_provider_client()—providers.<name>.key_env/api_key_envagent_init.py— fallback entrieskey_env/api_key_envchat_completion_helpers.py— fallbackkey_env/api_key_envhermes_cli/providers.py— provider registrykey_envThis PR adds the same resolution to
_resolve_task_provider_model(), so that:actually resolves the key from the environment, instead of silently ignoring it and sending requests with no auth (HTTP 401).
What changed
agent/auxiliary_client.py— After readingcfg_api_keyfrom task config, resolvekey_env/api_key_envwhen no explicitapi_keyis set. 10 lines added.tests/agent/test_auxiliary_client.py— 4 new tests inTestResolveTaskProviderModelKeyEnv.Testing
Four test cases:
key_envresolves to the env var value ✓api_key_envalias resolves identically ✓api_keytakes precedence overkey_env✓api_keyisNone(graceful, not the literal var name) ✓Notes
Previous iterations of this fix were in #28766 (closed as duplicate of #24088) and #24088 (stale branch, never merged). This PR is a clean rebase onto current
main— just the 10-line fix + tests, no unrelated changes.Closes #20139