Skip to content

fix: openai-codex and anthropic not appearing in /model picker for external credentials#8224

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-2b7d4fc2
Apr 12, 2026
Merged

fix: openai-codex and anthropic not appearing in /model picker for external credentials#8224
teknium1 merged 1 commit into
mainfrom
hermes/hermes-2b7d4fc2

Conversation

@teknium1

@teknium1 teknium1 commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Summary

The /model picker wasn't detecting providers whose credentials live in external files rather than env vars or the Hermes auth store:

  • openai-codex — OAuth tokens in ~/.codex/auth.json (Codex CLI shared file)
  • anthropic — Claude Code credentials in ~/.claude/.credentials.json

Users saw these providers in hermes auth and hermes model (which use different detection paths) but not in the /model picker.

Root Cause

list_authenticated_providers() had two gaps:

  1. Only checked the raw Hermes auth store — didn't know about the Codex CLI fallback import (~/.codex/auth.json → Hermes auth store migration)
  2. Auth store/pool checks were gated behind auth_type == oauth* — anthropic has auth_type=api_key in its overlay (it supports both), so the auth store and credential pool checks were never reached

Fix (3 parts)

agent/credential_pool.py_seed_from_singletons() for openai-codex now falls back to importing from ~/.codex/auth.json when the Hermes auth store has no tokens. Mirrors the existing logic in resolve_codex_runtime_credentials().

hermes_cli/model_switch.py — Two changes:

  1. Auth store + credential pool checks now run for all providers, not just those with OAuth auth_type. This catches anthropic (api_key auth_type but also has OAuth credential files).
  2. Direct check for anthropic external credential files (Claude Code, Hermes PKCE) bypassing the is_provider_explicitly_configured() gate. That gate is correct for runtime (don't burn tokens on auxiliary tasks without consent) but wrong for discovery (/model is explicitly about "what can I switch to?").

Coverage Audit

Verified all provider types are now detected:

Credential source Providers Detection path
Env vars (API keys) openrouter, anthropic, zai, deepseek, etc. Section 1 (models.dev) + Section 2 (HERMES_OVERLAYS)
Hermes auth store (OAuth) nous, openai-codex, qwen-oauth, copilot-acp Section 2 auth store check
Codex CLI file (~/.codex/) openai-codex NEW — pool auto-import fallback
Claude Code file (~/.claude/) anthropic NEW — direct file check
User-defined endpoints custom Section 3 (config.yaml providers:)
Saved custom providers custom Section 4 (config.yaml custom_providers:)

Tests

  • 5 new regression tests (Codex CLI detection, migration, normal path, Claude Code detection, no-credentials negative)
  • 38 existing related tests pass (overlay slug resolution, credential pool, model picker)

…ternal credentials

Users whose credentials exist only in external files — OpenAI Codex
OAuth tokens in ~/.codex/auth.json or Anthropic Claude Code credentials
in ~/.claude/.credentials.json — would not see those providers in the
/model picker, even though hermes auth and hermes model detected them.

Root cause: list_authenticated_providers() only checked the raw Hermes
auth store and env vars. External credential file fallbacks (Codex CLI
import, Claude Code file discovery) were never triggered.

Fix (three parts):
1. _seed_from_singletons() in credential_pool.py: openai-codex now
   imports from ~/.codex/auth.json when the Hermes auth store is empty,
   mirroring resolve_codex_runtime_credentials().
2. list_authenticated_providers() in model_switch.py: auth store + pool
   checks now run for ALL providers (not just OAuth auth_type), catching
   providers like anthropic that support both API key and OAuth.
3. list_authenticated_providers(): direct check for anthropic external
   credential files (Claude Code, Hermes PKCE). The credential pool
   intentionally gates anthropic behind is_provider_explicitly_configured()
   to prevent auxiliary tasks from silently consuming tokens. The /model
   picker bypasses this gate since it is discovery-oriented.
@teknium1 teknium1 force-pushed the hermes/hermes-2b7d4fc2 branch from 92ed65a to 93f1111 Compare April 12, 2026 07:28
@teknium1 teknium1 changed the title fix: openai-codex not appearing in /model picker when tokens are in Codex CLI fix: openai-codex and anthropic not appearing in /model picker for external credentials Apr 12, 2026
@teknium1 teknium1 merged commit eb2a49f into main Apr 12, 2026
4 of 6 checks passed
@teknium1 teknium1 deleted the hermes/hermes-2b7d4fc2 branch April 12, 2026 07:33
Tommyeds pushed a commit to Tommyeds/hermes-agent that referenced this pull request Apr 12, 2026
…ternal credentials (NousResearch#8224)

Users whose credentials exist only in external files — OpenAI Codex
OAuth tokens in ~/.codex/auth.json or Anthropic Claude Code credentials
in ~/.claude/.credentials.json — would not see those providers in the
/model picker, even though hermes auth and hermes model detected them.

Root cause: list_authenticated_providers() only checked the raw Hermes
auth store and env vars. External credential file fallbacks (Codex CLI
import, Claude Code file discovery) were never triggered.

Fix (three parts):
1. _seed_from_singletons() in credential_pool.py: openai-codex now
   imports from ~/.codex/auth.json when the Hermes auth store is empty,
   mirroring resolve_codex_runtime_credentials().
2. list_authenticated_providers() in model_switch.py: auth store + pool
   checks now run for ALL providers (not just OAuth auth_type), catching
   providers like anthropic that support both API key and OAuth.
3. list_authenticated_providers(): direct check for anthropic external
   credential files (Claude Code, Hermes PKCE). The credential pool
   intentionally gates anthropic behind is_provider_explicitly_configured()
   to prevent auxiliary tasks from silently consuming tokens. The /model
   picker bypasses this gate since it is discovery-oriented.
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…ternal credentials (NousResearch#8224)

Users whose credentials exist only in external files — OpenAI Codex
OAuth tokens in ~/.codex/auth.json or Anthropic Claude Code credentials
in ~/.claude/.credentials.json — would not see those providers in the
/model picker, even though hermes auth and hermes model detected them.

Root cause: list_authenticated_providers() only checked the raw Hermes
auth store and env vars. External credential file fallbacks (Codex CLI
import, Claude Code file discovery) were never triggered.

Fix (three parts):
1. _seed_from_singletons() in credential_pool.py: openai-codex now
   imports from ~/.codex/auth.json when the Hermes auth store is empty,
   mirroring resolve_codex_runtime_credentials().
2. list_authenticated_providers() in model_switch.py: auth store + pool
   checks now run for ALL providers (not just OAuth auth_type), catching
   providers like anthropic that support both API key and OAuth.
3. list_authenticated_providers(): direct check for anthropic external
   credential files (Claude Code, Hermes PKCE). The credential pool
   intentionally gates anthropic behind is_provider_explicitly_configured()
   to prevent auxiliary tasks from silently consuming tokens. The /model
   picker bypasses this gate since it is discovery-oriented.
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
…ternal credentials (NousResearch#8224)

Users whose credentials exist only in external files — OpenAI Codex
OAuth tokens in ~/.codex/auth.json or Anthropic Claude Code credentials
in ~/.claude/.credentials.json — would not see those providers in the
/model picker, even though hermes auth and hermes model detected them.

Root cause: list_authenticated_providers() only checked the raw Hermes
auth store and env vars. External credential file fallbacks (Codex CLI
import, Claude Code file discovery) were never triggered.

Fix (three parts):
1. _seed_from_singletons() in credential_pool.py: openai-codex now
   imports from ~/.codex/auth.json when the Hermes auth store is empty,
   mirroring resolve_codex_runtime_credentials().
2. list_authenticated_providers() in model_switch.py: auth store + pool
   checks now run for ALL providers (not just OAuth auth_type), catching
   providers like anthropic that support both API key and OAuth.
3. list_authenticated_providers(): direct check for anthropic external
   credential files (Claude Code, Hermes PKCE). The credential pool
   intentionally gates anthropic behind is_provider_explicitly_configured()
   to prevent auxiliary tasks from silently consuming tokens. The /model
   picker bypasses this gate since it is discovery-oriented.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ternal credentials (NousResearch#8224)

Users whose credentials exist only in external files — OpenAI Codex
OAuth tokens in ~/.codex/auth.json or Anthropic Claude Code credentials
in ~/.claude/.credentials.json — would not see those providers in the
/model picker, even though hermes auth and hermes model detected them.

Root cause: list_authenticated_providers() only checked the raw Hermes
auth store and env vars. External credential file fallbacks (Codex CLI
import, Claude Code file discovery) were never triggered.

Fix (three parts):
1. _seed_from_singletons() in credential_pool.py: openai-codex now
   imports from ~/.codex/auth.json when the Hermes auth store is empty,
   mirroring resolve_codex_runtime_credentials().
2. list_authenticated_providers() in model_switch.py: auth store + pool
   checks now run for ALL providers (not just OAuth auth_type), catching
   providers like anthropic that support both API key and OAuth.
3. list_authenticated_providers(): direct check for anthropic external
   credential files (Claude Code, Hermes PKCE). The credential pool
   intentionally gates anthropic behind is_provider_explicitly_configured()
   to prevent auxiliary tasks from silently consuming tokens. The /model
   picker bypasses this gate since it is discovery-oriented.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…ternal credentials (NousResearch#8224)

Users whose credentials exist only in external files — OpenAI Codex
OAuth tokens in ~/.codex/auth.json or Anthropic Claude Code credentials
in ~/.claude/.credentials.json — would not see those providers in the
/model picker, even though hermes auth and hermes model detected them.

Root cause: list_authenticated_providers() only checked the raw Hermes
auth store and env vars. External credential file fallbacks (Codex CLI
import, Claude Code file discovery) were never triggered.

Fix (three parts):
1. _seed_from_singletons() in credential_pool.py: openai-codex now
   imports from ~/.codex/auth.json when the Hermes auth store is empty,
   mirroring resolve_codex_runtime_credentials().
2. list_authenticated_providers() in model_switch.py: auth store + pool
   checks now run for ALL providers (not just OAuth auth_type), catching
   providers like anthropic that support both API key and OAuth.
3. list_authenticated_providers(): direct check for anthropic external
   credential files (Claude Code, Hermes PKCE). The credential pool
   intentionally gates anthropic behind is_provider_explicitly_configured()
   to prevent auxiliary tasks from silently consuming tokens. The /model
   picker bypasses this gate since it is discovery-oriented.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…ternal credentials (NousResearch#8224)

Users whose credentials exist only in external files — OpenAI Codex
OAuth tokens in ~/.codex/auth.json or Anthropic Claude Code credentials
in ~/.claude/.credentials.json — would not see those providers in the
/model picker, even though hermes auth and hermes model detected them.

Root cause: list_authenticated_providers() only checked the raw Hermes
auth store and env vars. External credential file fallbacks (Codex CLI
import, Claude Code file discovery) were never triggered.

Fix (three parts):
1. _seed_from_singletons() in credential_pool.py: openai-codex now
   imports from ~/.codex/auth.json when the Hermes auth store is empty,
   mirroring resolve_codex_runtime_credentials().
2. list_authenticated_providers() in model_switch.py: auth store + pool
   checks now run for ALL providers (not just OAuth auth_type), catching
   providers like anthropic that support both API key and OAuth.
3. list_authenticated_providers(): direct check for anthropic external
   credential files (Claude Code, Hermes PKCE). The credential pool
   intentionally gates anthropic behind is_provider_explicitly_configured()
   to prevent auxiliary tasks from silently consuming tokens. The /model
   picker bypasses this gate since it is discovery-oriented.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant