fix(auth): resolve bare "openai" slug to "openai-api" provider - #37714
fix(auth): resolve bare "openai" slug to "openai-api" provider#37714rodboev wants to merge 1 commit into
Conversation
7e229df to
880490e
Compare
c486a0b to
c4f702f
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused regression coverage. Current main has an intentional distinction that this change would collapse.
Problems
hermes_cli/providers.py:247maps bareopenaitoopenrouter;hermes_cli/model_switch.py:862resolves explicit provider switches through that layer. Adding aliases only inauth.pyandmodels.pycreates conflicting results for the same input rather than making--provider openaiconsistently direct.- Current regression coverage documents the reason:
tests/hermes_cli/test_user_providers_model_switch.py:308-334requires bareopenainot to appear as a direct picker row and identifiesopenai-apias the direct provider. This was established by21f55af76902b95d9f5db89f1ef6ba0b2712649b(fix(model-picker): stop routing OpenAI selection to OpenRouter).
Suggested changes
- Please re-scope after deciding whether bare
openaishould remain the OpenRouter alias or become the direct endpoint everywhere. If changing that contract, update all resolver layers and add an end-to-end runtime/credential-routing test, not only table assertions.
Automated hermes-sweeper review.
| """The bare slug "openai" must resolve to the "openai-api" registry entry.""" | ||
|
|
||
| def test_openai_resolves_to_openai_api(self): | ||
| assert resolve_provider("openai") == "openai-api" |
There was a problem hiding this comment.
This expected contract conflicts with current main: hermes_cli/providers.py:247 intentionally maps bare openai to openrouter, and tests/hermes_cli/test_user_providers_model_switch.py:308-334 reserves openai-api for direct OpenAI routing. Please resolve that cross-layer contract before asserting this alias.
|
Thanks. I rechecked this against current main. Bare The original picker symptom this branch cites was already fixed in #37175, and that fix intentionally left the broader Closing this so it does not keep consuming review cycles. If we want to revisit bare |
Summary
resolve_provider("openai")raisesAuthError: Unknown provider 'openai'even thoughopenai-apiis a registered provider andmodels.pyalready groups both slugs under the"openai"display key (line 993). Consumers that send the bare slug — WebUI model picker, config.yamlmodel.provider, CLI--providerflag — get a confusing error instead of routing toopenai-api.The alias tables in
auth.pyandmodels.pyhad entries for every other provider group ("claude": "anthropic","google": "gemini","grok": "xai") but not"openai". This surfaced during nesquena/hermes-webui#3444 where the WebUI picker collapsedopenai-apitoopenaifor display and the send path broke because the agent registry has noopenaikey.Changes
hermes_cli/auth.py: add"openai": "openai-api"to_PROVIDER_ALIASESinresolve_provider()(+1)hermes_cli/models.py: same entry in the models-layer_PROVIDER_ALIASES(+1)tests/hermes_cli/test_openai_provider_alias.py: new file, 7 tests covering resolve, case insensitivity, canonical passthrough, codex independence, registry presence, and themodels.pyalias (+39)Validation
resolve_provider("openai")AuthError: Unknown provider 'openai'"openai-api"resolve_provider("OpenAI")"openai-api"(case-insensitive)resolve_provider("openai-api")"openai-api""openai-api"(unchanged)resolve_provider("openai-codex")"openai-codex""openai-codex"(unchanged)Test plan
pytest tests/hermes_cli/test_openai_provider_alias.py -v— 7 passedpytest tests/hermes_cli/test_api_key_providers.py -v— 165 passed (regression check)