Skip to content

fix(auth): resolve bare "openai" slug to "openai-api" provider - #37714

Closed
rodboev wants to merge 1 commit into
NousResearch:mainfrom
rodboev:pr/openai-provider-alias
Closed

fix(auth): resolve bare "openai" slug to "openai-api" provider#37714
rodboev wants to merge 1 commit into
NousResearch:mainfrom
rodboev:pr/openai-provider-alias

Conversation

@rodboev

@rodboev rodboev commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

resolve_provider("openai") raises AuthError: Unknown provider 'openai' even though openai-api is a registered provider and models.py already groups both slugs under the "openai" display key (line 993). Consumers that send the bare slug — WebUI model picker, config.yaml model.provider, CLI --provider flag — get a confusing error instead of routing to openai-api.

The alias tables in auth.py and models.py had 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 collapsed openai-api to openai for display and the send path broke because the agent registry has no openai key.

Changes

  • hermes_cli/auth.py: add "openai": "openai-api" to _PROVIDER_ALIASES in resolve_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 the models.py alias (+39)

Validation

Scenario Before After
resolve_provider("openai") AuthError: Unknown provider 'openai' "openai-api"
resolve_provider("OpenAI") same error "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 passed
  • pytest tests/hermes_cli/test_api_key_providers.py -v — 165 passed (regression check)
  • Tested on Windows 11, Python 3.11. No platform-specific code.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools provider/openai OpenAI / Codex Responses API P2 Medium — degraded but workaround exists labels Jun 2, 2026
@rodboev
rodboev force-pushed the pr/openai-provider-alias branch 2 times, most recently from 7e229df to 880490e Compare June 28, 2026 20:00
@rodboev
rodboev force-pushed the pr/openai-provider-alias branch from c486a0b to c4f702f Compare July 7, 2026 04:30

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused regression coverage. Current main has an intentional distinction that this change would collapse.

Problems

  • hermes_cli/providers.py:247 maps bare openai to openrouter; hermes_cli/model_switch.py:862 resolves explicit provider switches through that layer. Adding aliases only in auth.py and models.py creates conflicting results for the same input rather than making --provider openai consistently direct.
  • Current regression coverage documents the reason: tests/hermes_cli/test_user_providers_model_switch.py:308-334 requires bare openai not to appear as a direct picker row and identifies openai-api as the direct provider. This was established by 21f55af76902b95d9f5db89f1ef6ba0b2712649b (fix(model-picker): stop routing OpenAI selection to OpenRouter).

Suggested changes

  • Please re-scope after deciding whether bare openai should 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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rodboev

rodboev commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I rechecked this against current main.

Bare openai is still the intentional OpenRouter alias in hermes_cli/providers.py, and tests/hermes_cli/test_user_providers_model_switch.py still locks that behavior in so the picker does not emit a phantom openai row. Direct OpenAI routing is openai-api, which is already registered in hermes_cli/auth.py.

The original picker symptom this branch cites was already fixed in #37175, and that fix intentionally left the broader openai and OPENAI_API_KEY resolution contract unchanged. Reworking this branch now would take a repo-wide provider-resolution change across aliases, model switching, and credential routing, which is a different scope than the PR under review here.

Closing this so it does not keep consuming review cycles. If we want to revisit bare openai semantics, it should come back as a fresh issue or PR scoped to the whole provider-resolution contract.

@rodboev rodboev closed this Jul 13, 2026
@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants