Repository navigation
fix(auth): read the login cache through the credential hook - #19
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18.
Problem
The provider only made the minted key available by writing
MUSE_CODE_SUB_TOKENintoos.environat 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.jsonholds 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.hermes auth add: the import does not happen again.hermes chatworks, 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_TOKENthat differs from the cache returnsNone, leaving that value to core's ladder, which reads.envbefore the environment (agent.credential_pool.get_env_prefer_dotenv). The helper is imported lazily so the plugin stays stdlib-only.Verification
.envoverride behave as before.pytest53 passed (3 new tests, each failing without the fix),ruff checkclean,validate-plugin.pyPASS, markdownlint clean.