Skip to content

fix(auth): recognize the "openai" provider alias in resolve_provider - #29570

Open
pmos69 wants to merge 1 commit into
NousResearch:mainfrom
pmos69:fix/openai-provider-alias
Open

fix(auth): recognize the "openai" provider alias in resolve_provider#29570
pmos69 wants to merge 1 commit into
NousResearch:mainfrom
pmos69:fix/openai-provider-alias

Conversation

@pmos69

@pmos69 pmos69 commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

resolve_provider() in hermes_cli/auth.py builds a _PROVIDER_ALIASES table to normalize provider names, but it does not include "openai". A config or request with provider: openai therefore falls through to the "Unknown provider 'openai'" error path — even though hermes_cli/providers.py's module-level ALIASES table already maps "openai" → "openrouter".

The two alias tables disagree, and resolve_provider is the one that gates the error.

Fix

Add "openai": "openrouter" to _PROVIDER_ALIASES, so resolve_provider agrees with providers.py's ALIASES and a bare openai provider resolves to the generic OpenAI-compatible runtime instead of being rejected.

One line (plus a comment). Fully backwards compatible — it only adds a previously-unhandled alias.

Context

Surfaced by an API client that wrote model.provider: openai after the user configured an OpenAI key; the gateway then refused to start with Unknown provider 'openai'.

resolve_provider()'s _PROVIDER_ALIASES table did not include "openai",
so a config or request with provider "openai" was rejected as
"Unknown provider 'openai'" — even though providers.py's ALIASES table
already maps "openai" to "openrouter".

Add the alias here so both tables agree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard provider/openai OpenAI / Codex Responses API labels May 21, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for identifying the resolver/catalog mismatch. The premise is confirmed on current main: hermes_cli/auth.py:1669-1730 does not normalize bare openai, so it raises an unknown-provider error, while hermes_cli/providers.py:245-247 defines openai → openrouter.

Problems

  • The change has no regression coverage. Existing resolver tests cover explicit openrouter, custom, and LM Studio aliases in tests/hermes_cli/test_runtime_provider_resolution.py:1806-1830, but there is no test for resolve_provider("openai").

Suggested changes

  • Add a focused assertion that resolve_provider("openai") == "openrouter" next to the explicit-provider alias tests. This preserves the established behavior documented by tests/hermes_cli/test_user_providers_model_switch.py:308-314: bare openai is the OpenRouter alias; direct OpenAI remains openai-api or a configured providers.openai endpoint.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit labels Jul 13, 2026

@GottZ GottZ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This was generated by AI during triage.

Summary

Three PRs address the provider-alias resolution area: #29570 maps bare openai to the established openrouter target, #37714 instead maps it to openai-api across two resolver layers and adds focused tests, and #50129 synchronizes eleven unrelated aliases into resolve_provider() with regression coverage. Only #29570 matches the documented bare-openai contract and the reported resolver/catalog mismatch.

Related pull requests

  • #29570 related — (+4/-0) — keep open, add regression coverage: the diff fixes the reported mismatch by mapping bare openai to openrouter, consistent with providers.py and the existing model-switch contract; as its contributor review notes, it still needs a focused resolve_provider("openai") == "openrouter" test.
  • #37714 [closed] related — (+45/-0) — keep closed, conflicting semantics: the diff maps bare openai to openai-api in both auth.py and models.py and adds tests/hermes_cli/test_openai_provider_alias.py with focused resolution, case, registry, and normalization tests, but this contradicts the established openai → openrouter contract. Despite the keep_open review on #37714, its own blocking analysis requires a repo-wide provider-contract decision and end-to-end routing coverage; the later contributor closure also records that the cited picker symptom was already fixed by #37175, so this branch should not be reopened for the narrower issue.
  • #50129 [closed] related — (+40/-0) — keep closed as a superseded related fix: the diff adds eleven non-OpenAI aliases to auth.py plus resolver tests, addressing the same alias-table drift class but not the bare-openai cause. It remains relevant as evidence of systemic alias duplication, while the discussion records that main independently gained these aliases and dynamic provider extension.

Suggested consolidation

Merge #29570 after adding the focused regression assertion requested by its contributor review; it is the only candidate whose target preserves the documented bare-openai semantics. Keep #37714 closed because its tested openai-api mapping conflicts with that contract, and keep #50129 closed because its broader non-OpenAI alias synchronization is already present on main; neither should be closed as a literal duplicate of #29570.

Cross-PR triage: Reviewed 3 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 6 kB of PR diffs, 5 kB of issue/PR text, 4 kB of discussion (5 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

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-broad Sweeper blast radius: broad — a core path most sessions hit 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.

4 participants