test(agent): fold the aux create_client() seam tests to two contracts

Two parametrized invariant tests (native client sync/async; None or raising
profile falls back to the standard client) replace four near-duplicates, and
the hook's kwargs are pinned exactly to the mapping openai.OpenAI would have
received. The fixture isolates both provider registries through monkeypatch
instead of a hand-rolled snapshot/restore, drops the HERMES_HOME override that
tests/conftest.py already provides, and replaces the tuple-truthiness lambda
with a plain function. Call-site comment trimmed to the ordering WHY.
This commit is contained in:
kshitijk4poor
2026-09-16 11:51:08 +05:30
committed by kshitij
parent 4cd2eb013c
commit 5d07f7fe66
2 changed files with 26 additions and 68 deletions
+1 -5
View File
@@ -4919,11 +4919,7 @@ def _resolve_api_key_branch(req: _ResolveRequest, pconfig: Any, resolve_creds: C
if req.explicit_base_url and provider != "actual":
base_url = _to_openai_base_url(req.explicit_base_url.strip().rstrip("/"))
final_model = _normalize_resolved_model(req.model or _get_aux_model_for_provider(provider), provider)
# Provider-supplied client, consulted before the built-in gemini/OpenAI ladder so an
# out-of-tree provider registered with auth_type="api_key" keeps its native transport for
# auxiliary tasks — the same hook the main-agent path honors (#112384). ``None`` (the
# profile default) falls through to the standard construction, so built-in providers
# without a registered profile are untouched.
# Consulted before the built-in gemini/OpenAI ladder so a registered native transport wins (#112384).
profile_client = _api_key_profile_supplied_client(provider, api_key=api_key, base_url=base_url)
if profile_client is not None:
logger.debug("resolve_provider_client: %s native client from provider profile (%s)", provider, final_model)