Skip to content

fix(auth): read the login cache through the credential hook - #19

Merged
TheStreamCode merged 1 commit into
mainfrom
fix/credential-seam
Nov 12, 2026
Merged

TheStreamCode merged 1 commit into
mainfrom
fix/credential-seam

Conversation

@TheStreamCode

Copy link
Copy Markdown
Owner

Fixes #18.

Problem

The provider only made the minted key available by writing MUSE_CODE_SUB_TOKEN into os.environ at import. That export is per-process, so any resolver that runs somewhere else sees nothing and Hermes fails with "No usable credentials found for provider 'muse-code'" while $HERMES_HOME/muse-code-sub.json holds a valid key.

Two cases reproduce it on v0.23.1:

  • plugins.isolation: host: the profile is a host proxy, the module is imported in the plugin host, and the caller's environment is never seeded.
  • A long-running process (gateway, Desktop) whose discovery ran before hermes auth add: the import does not happen again.
  • A fresh in-process hermes chat works, which is why the plugin looked fine for some users.

Change

MuseCodeSubscriptionProfile.resolve_api_key_secret() returns the cached key. Hermes consults that hook before the generic env/credential-pool ladder and it is the one credential seam that crosses the plugin-host boundary.

Precedence is unchanged: an explicit MUSE_CODE_SUB_TOKEN that differs from the cache returns None, leaving that value to core's ladder, which reads .env before the environment (agent.credential_pool.get_env_prefer_dotenv). The helper is imported lazily so the plugin stays stdlib-only.

Verification

  • Reproduced the empty key before the fix in both failing setups (isolation host, cache created after discovery); both return the cached key after it.
  • In-process resolution and the explicit .env override behave as before.
  • pytest 53 passed (3 new tests, each failing without the fix), ruff check clean, validate-plugin.py PASS, markdownlint clean.

The provider exported MUSE_CODE_SUB_TOKEN at import, so a resolver running in
another process never saw the key: under plugins.isolation: host the profile is
a host proxy, and a gateway that started before the login never re-imports the
module. Both report "No usable credentials found for provider 'muse-code'"
while ~/.hermes/muse-code-sub.json holds a valid key.

Resolve through ProviderProfile.resolve_api_key_secret(), which Hermes consults
before the env ladder and which crosses the plugin-host boundary. An explicit
MUSE_CODE_SUB_TOKEN that differs from the cache still wins.

Fixes #18
@TheStreamCode
TheStreamCode merged commit 46d7385 into main Nov 12, 2026
6 checks passed
@TheStreamCode
TheStreamCode deleted the fix/credential-seam branch November 12, 2026 21:23
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.

hermes chat: 'No usable credentials' after successful login (0.6.3); only works with MUSE_CODE_SUB_TOKEN in .env

1 participant