fix: copilot model not show in /model when copilot provider fallback to gh auth token - #9767
Closed
Marvae wants to merge 1 commit into
Closed
fix: copilot model not show in /model when copilot provider fallback to gh auth token#9767Marvae wants to merge 1 commit into
Marvae wants to merge 1 commit into
Conversation
Marvae
force-pushed
the
fix/copilot-gh-auth-model-discovery
branch
3 times, most recently
from
April 14, 2026 17:03
4e9fb42 to
1bd5e75
Compare
list_authenticated_providers() checks env vars (COPILOT_GITHUB_TOKEN, GH_TOKEN, GITHUB_TOKEN), the Hermes auth store, and the OAuth credential pool to decide which providers have valid credentials. However, copilot tokens obtained via `gh auth token` (GitHub CLI) don't live in any of those places — they are resolved dynamically by resolve_copilot_token(). This affects all /model entry points — CLI (cli.py) and Gateway messaging platforms (gateway/run.py) — since they all call the same list_authenticated_providers() function. Seed copilot credentials from resolve_copilot_token() in the credential pool's _seed_from_singletons(), alongside the existing anthropic and openai-codex seeding logic. This is the correct architectural layer — the credential pool already handles dynamic credential discovery for other providers — rather than adding a one-off fallback in list_authenticated_providers(). Add regression tests in tests/agent/test_credential_pool.py: - copilot seeded when resolve_copilot_token() returns a gh CLI token - copilot pool empty when resolve_copilot_token() returns nothing
Marvae
force-pushed
the
fix/copilot-gh-auth-model-discovery
branch
from
April 14, 2026 17:08
1bd5e75 to
5c2c7ba
Compare
teknium1
pushed a commit
that referenced
this pull request
Apr 14, 2026
Seed copilot credentials from resolve_copilot_token() in the credential pool's _seed_from_singletons(), alongside the existing anthropic and openai-codex seeding logic. This makes copilot appear in the /model provider picker when the user authenticates solely through gh auth token. Cherry-picked from PR #9767 by Marvae.
teknium1
pushed a commit
that referenced
this pull request
Apr 14, 2026
Seed copilot credentials from resolve_copilot_token() in the credential pool's _seed_from_singletons(), alongside the existing anthropic and openai-codex seeding logic. This makes copilot appear in the /model provider picker when the user authenticates solely through gh auth token. Cherry-picked from PR #9767 by Marvae.
Contributor
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
Seed copilot credentials from resolve_copilot_token() in the credential pool's _seed_from_singletons(), alongside the existing anthropic and openai-codex seeding logic. This makes copilot appear in the /model provider picker when the user authenticates solely through gh auth token. Cherry-picked from PR NousResearch#9767 by Marvae.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Seed copilot credentials from resolve_copilot_token() in the credential pool's _seed_from_singletons(), alongside the existing anthropic and openai-codex seeding logic. This makes copilot appear in the /model provider picker when the user authenticates solely through gh auth token. Cherry-picked from PR NousResearch#9767 by Marvae.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
Seed copilot credentials from resolve_copilot_token() in the credential pool's _seed_from_singletons(), alongside the existing anthropic and openai-codex seeding logic. This makes copilot appear in the /model provider picker when the user authenticates solely through gh auth token. Cherry-picked from PR NousResearch#9767 by Marvae.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Seed copilot credentials from resolve_copilot_token() in the credential pool's _seed_from_singletons(), alongside the existing anthropic and openai-codex seeding logic. This makes copilot appear in the /model provider picker when the user authenticates solely through gh auth token. Cherry-picked from PR NousResearch#9767 by Marvae.
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.
What changed and why
Fixes #9768
/model(the model picker) callslist_authenticated_providers()to discover which providers have valid credentials. It checks:COPILOT_GITHUB_TOKEN,GH_TOKEN,GITHUB_TOKEN)~/.hermes/auth.json)However, many copilot users authenticate solely through the GitHub CLI (
gh auth token). These tokens are resolved dynamically byresolve_copilot_token()incopilot_auth.pyand don't exist in any of the three stores above. As a result, copilot does not appear in the/modelprovider list even when the user is actively using it as their provider.This affects all
/modelentry points — CLI (cli.py) and Gateway messaging platforms (gateway/run.py) — since they all call the samelist_authenticated_providers()function.Fix
Seed copilot credentials from
resolve_copilot_token()in the credential pool's_seed_from_singletons()(agent/credential_pool.py), alongside the existing anthropic and openai-codex seeding logic. This is the correct architectural layer — the credential pool already handles dynamic credential discovery for other providers — rather than adding a one-off fallback inlist_authenticated_providers().How to test
unset COPILOT_GITHUB_TOKEN GH_TOKEN GITHUB_TOKENgh auth tokenreturns a valid tokenprovider: copilotin~/.hermes/config.yamlhermesand type/modelScreenshots
Before

After


Automated tests
Two new tests in
tests/agent/test_credential_pool.py:test_load_pool_seeds_copilot_via_gh_auth_token— copilot credentials seeded into pool whenresolve_copilot_token()succeedstest_load_pool_does_not_seed_copilot_when_no_token— pool stays empty when no token availablePlatform tested