Repository navigation
Description
Bug Description
Provider plugins have only one hook for turning a credential pool row into a request credential: ProviderProfile.prepare_pool_entry(entry, api_key) -> str in providers/base.py. It returns a single string and its docstring allows it to update entry. A provider whose request credential is derived from a durable grant (for example a short-lived bearer obtained by exchanging a long-lived token, often paired with an account-specific endpoint) has no way to hand core a temporary bearer and endpoint without writing them into the pool row.
When a plugin does write the derived bearer or endpoint into the row, that row is what core persists. The derived value can then replace the durable grant that later renewal depends on. Core also has no hook to re-mint the derived credential for the specific row that failed, so recovery cannot be scoped to the dispatched row and its failed bearer.
The GitHub Copilot provider plugin (NousResearch/hermes-labs-plugins, github-copilot) is the concrete consumer affected today, but the gap is in the generic provider-plugin SDK, not in vendor code.
Steps to Reproduce
Verified by offline regression tests in #154360 (synthetic credentials, isolated HERMES_HOME); no live provider requests. The contract tests are tests/providers/test_pool_runtime_contract.py and tests/agent/test_pool_runtime_credential_lifecycle.py.
- Register a provider plugin whose
prepare_pool_entryexchanges the row's durable grant for a short-lived bearer and account endpoint. - Add a pool row for that provider and dispatch a request through the pool (primary, auxiliary or delegated client).
- Inspect what is dispatched and what is persisted to the auth store after save and reload.
Expected Behavior
- The durable grant stays in the persisted pool row unchanged.
- The derived bearer and endpoint are used for the request as runtime-only state and are never written to
auth.json. - On an auth failure, renewal re-mints only the row that was dispatched, matched by row ID and the bearer that failed, without benching the account or falling back to ambient credentials.
- This works the same for primary, auxiliary and delegated clients and across the subprocess plugin host.
Actual Behavior
- With only the string-returning hook, the derived pair must either be written into the row (and is then persisted, potentially replacing the durable grant) or is unavailable to core.
- The fix: keep derived pool credentials runtime-only #154360 base-red regression shows pristine upstream dispatching the durable source token rather than the derived bearer.
- There is no selected-row renewal hook, so recovery cannot be limited to the failed row and bearer.
Affected Component
Other (provider plugin SDK: providers/base.py, agent/credential_pool*.py, hermes_cli/plugin_host_*)
Messaging Platform (if gateway-related)
N/A (not platform specific)
Debug Report
n/a: hermes debug share is not applicable. This is an SDK contract gap found by code reading and reproduced only by the offline regression tests in #154360 (synthetic credentials, isolated HERMES_HOME). No user session, config or logs are involved.
Operating System
macOS (local test runs only)
Python Version
n/a: repository-managed test environment; not tied to a Python version.
Hermes Version
Source checkout, upstream main at 4b40ffb0ad6d7da5d3260f5e499e1691508dd4d5 (not a released build). Still present on current main: providers/base.py declares prepare_pool_entry(self, entry, api_key) -> str.
Root Cause Analysis
providers/base.py:prepare_pool_entryreturnsstronly, and the docstring permits mutatingentry. There is no typed way to return a key plus endpoint that core treats as transient.hermes_cli/runtime_provider.py: the result ofprepare_pool_entryreplaces the pool API key directly; there is no notion of a runtime-only override bound to its source grant.agent/credential_pool.py/agent/credential_pool_plugin.py: persisted row data and request credentials are the same fields, so anything a plugin writes to the row is saved.- Hosted plugins receive a data copy of
entryacross the subprocess plugin host, so row mutation is not a reliable channel there either.
Proposed Fix
#154360 adds an opt-in generic SDK in core:
PoolRuntimeCredential(api_key, base_url)inproviders/base.py;prepare_pool_entrymay return it instead of a string. Legacy string returns keep their current behavior.refresh_pool_runtime_credentials(entry, *, reason)for renewal of the selected row only, andcredential_pool_base_urlsfor explicit endpoint equivalence.agent/credential_pool_plugin.pybinds overrides to their source grant and keeps them out of persisted account data; runtime, rotation, cooldown reclaim, auxiliary (agent/auxiliary_pool_recovery.py) and delegation (tools/delegate_tool_child_run.py) paths prepare the selected row the same way; the plugin host restores the declared return types.
The Copilot consumer change is NousResearch/hermes-labs-plugins#77 and should ship after core.
Related
- fix: keep derived pool credentials runtime-only #154360 (fix)
- fix: retain Copilot pool grants during runtime renewal hermes-labs-plugins#77 (Copilot consumer)
- fix(copilot): keep rotated credentials on account endpoint #61757 (historical core Copilot bearer and endpoint pairing)
- [Bug]: Copilot credential rotation reuses stale public endpoint for Enterprise accounts #61746 (Copilot rotation paired with a stale endpoint; adjacent symptom, different root cause)
- fix(auxiliary): retry with the selected pool credential #133565, fix: a signed-out plugin OAuth provider fails loudly, refreshes on aux 401s, and keeps its sign-in (salvage #145617) #149396, Fix auxiliary fallback credential identity #151175 (adjacent auxiliary recovery and attribution work)
Are you willing to submit a PR for this?
- I'd like to fix this myself and submit a PR (fix: keep derived pool credentials runtime-only #154360)
Activity
alt-glitch commentedon Nov 14, 2026
#154360 aims to fix this: it adds an opt-in hook that returns a short-lived bearer and endpoint as runtime-only values, so the durable grant stays in the saved pool row, plus a renewal hook that re-mints only the failed row.
paulorha commentedon Nov 15, 2026
Status update: I checked upstream main at
fd8a6c41. The pool preparation contract still lets a provider plugin mutate the persisted entry, and main does not yet have the runtime-only credential or selected-row renewal hooks. This is from code inspection, not a fresh reproduction.#154360 is now rebased onto
fd8a6c41(headc0bbbe86) and no longer conflicts with main. Its pool/auth contract tests pass locally (153 tests across 9 files) andscripts/checkpasses. The dependent hermes-labs-plugins#77 passes the full github-copilot suite (180 tests) against that core commit and stays in draft until the core contract lands.