Skip to content

fix(cli): OAuth providers missing from /model picker — wrong import and key lookup#5945

Closed
iacker wants to merge 1 commit into
NousResearch:mainfrom
iacker:fix/oauth-model-picker
Closed

fix(cli): OAuth providers missing from /model picker — wrong import and key lookup#5945
iacker wants to merge 1 commit into
NousResearch:mainfrom
iacker:fix/oauth-model-picker

Conversation

@iacker

@iacker iacker commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #5910 — OAuth-authenticated providers (Nous Portal, OpenAI Codex, Copilot) never appear in the /model gateway picker because list_authenticated_providers() uses a non-existent function and checks the wrong dict keys.

Root Cause

Two bugs in hermes_cli/model_switch.py, section 2 ("Hermes-only providers"):

  1. Wrong function name: _read_auth_store does not exist — the correct function is _load_auth_store. The ImportError was silently caught by except Exception: pass, so the entire OAuth credential check was skipped.

  2. Wrong key lookup: _load_auth_store() returns a dict with top-level keys (version, providers, credential_pool, active_provider, updated_at), not provider IDs. So pid in store was always False.

Fix

-                from hermes_cli.auth import _read_auth_store
-                store = _read_auth_store()
-                if store and pid in store:
+                from hermes_cli.auth import _load_auth_store
+                store = _load_auth_store()
+                if store and (pid in store.get("providers", {}) or pid in store.get("credential_pool", {})):

Impact

  • /model in gateway now correctly shows OAuth providers (nous, openai-codex, copilot) alongside env-var-based providers
  • Users who authenticated via hermes auth add nous can switch to Nous models via /model

Verification

  • Searched codebase for _read_auth_store — this function does not exist; only _load_auth_store is defined in auth.py (line 551)
  • Verified _load_auth_store() return structure matches the fix (providers under store["providers"])
  • Single file change, 3 lines modified

…nd key lookup

Two issues in list_authenticated_providers() caused OAuth-authenticated
providers (Nous Portal, OpenAI Codex, Copilot) to never appear in the
/model gateway picker:

1. Wrong function name: _read_auth_store does not exist, should be
   _load_auth_store. The ImportError was silently caught.
2. Wrong key lookup: _load_auth_store() returns a dict with top-level
   keys ('version', 'providers', 'credential_pool', ...), not provider
   IDs at the top level. Fixed to check store['providers'] and
   store['credential_pool'].

Fixes NousResearch#5910
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the detailed root-cause analysis in #5945 — this was a real bug and the diagnosis was correct.

This is an automated hermes-sweeper review. The two bugs described (wrong function name _read_auth_store and wrong dict key lookup) are already fixed on main:

  • _read_auth_store does not exist anywhere in the codebase — confirmed by full-repo grep returning zero results.
  • hermes_cli/model_switch.py lines 1128–1139 already use _load_auth_store() with both store.get("providers", {}) and store.get("credential_pool", {}), checking pid and hermes_slug in each — a superset of the fix proposed here.
  • Commit 1af44a13c (fix(model_picker): detect mapped-provider auth-store credentials, merged 2026-04-12) introduced the _load_auth_store + credential_pool fix to the Section 1 loop, and subsequent commits extended it to the HERMES_OVERLAYS section.

Closing as implemented on main. The investigation that went into this PR was valuable and likely informed those later fixes.

@teknium1 teknium1 closed this Apr 27, 2026
@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 P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Apr 30, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #8224 (merged) — same root cause: OAuth providers not appearing in /model picker. Also related to #16901 which fixed the copilot credential_pool variant.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #8224 (merged) — same root cause: OAuth providers not appearing in /model picker.

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 duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth providers (Nous, Codex) missing from /model picker — ImportError silently caught

3 participants