hermes - ✅(Solved) Fix Copilot OAuth client_id prevents copilot_internal token exchange; live model catalog requires workaround [1 pull requests, 4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#16551Fetched 2026-04-28 06:52:34
View on GitHub
Comments
4
Participants
3
Timeline
12
Reactions
0
Timeline (top)
labeled ×5commented ×4cross-referenced ×1referenced ×1

Root Cause

# hermes_cli/copilot_auth.py
COPILOT_OAUTH_CLIENT_ID = "Ov23li...Qebz"   # GitHub App client id

This is a GitHub App client id (Ov23li... prefix). Tokens minted by it are not authorized for copilot_internal/v2/token, regardless of the user's Copilot plan.

The official VS Code / Copilot CLI / opencode flow uses the legacy OAuth App id:

Iv1.b507a08c87ecfe98

A token from this client_id (with read:user scope) successfully exchanges at copilot_internal/v2/token and lists the full live model catalog (including gpt-5.5, claude-opus-4.5, etc.) — confirmed by manual reproduction.

Fix Action

Fix

Change COPILOT_OAUTH_CLIENT_ID to Iv1.b507a08c87ecfe98. After this, the live /models catalog populates correctly and dynamic model discovery works as designed.

PR fix notes

PR #16562: fix(cli): use correct legacy OAuth App client_id for Copilot auth

Description (problem / solution / changelog)

What does this PR do?

Fixes Copilot OAuth device-code flow using the wrong client_id. The current GitHub App client_id (Ov23li... prefix) cannot access copilot_internal/v2/token, causing HTTP 404 for all Copilot users and blocking live model discovery (including gpt-5.5 and other newer models).

Replaces it with the legacy OAuth App client_id (Iv1.b507a08c87ecfe98) used by VS Code, Copilot CLI, and opencode.

Related Issue

Fixes #16551

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • hermes_cli/copilot_auth.py: Changed COPILOT_OAUTH_CLIENT_ID from GitHub App client_id to legacy OAuth App client_id (Iv1.b507a08c87ecfe98)
  • tests/hermes_cli/test_copilot_auth.py: Added test verifying the client_id value

How to Test

  1. Run hermes auth add copilot with a GitHub account that has an active Copilot subscription
  2. Complete the device-code authorization flow
  3. Verify that exchange_copilot_token() succeeds (no HTTP 404)
  4. Verify that hermes model shows the full live Copilot catalog including newer models
  5. Run the targeted test: pytest tests/hermes_cli/test_copilot_auth.py -v
  6. Run full suite: pytest tests/ -q --ignore=tests/integration --ignore=tests/e2e

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes
  • I've tested on my platform: macOS (Darwin 25.4.0, Apple Silicon), Python 3.11

Documentation & Housekeeping

  • Updated relevant documentation — or N/A
  • Updated cli-config.yaml.example — or N/A
  • Updated contributing / agents docs — or N/A
  • Considered cross-platform impact — or N/A
  • Updated tool descriptions/schemas — or N/A

Changed files

  • hermes_cli/copilot_auth.py (modified, +2/-2)
  • tests/hermes_cli/test_copilot_auth.py (modified, +8/-0)

Code Example

# hermes_cli/copilot_auth.py
COPILOT_OAUTH_CLIENT_ID = "Ov23li...Qebz"   # GitHub App client id

---

Iv1.b507a08c87ecfe98
RAW_BUFFERClick to expand / collapse

Bug

hermes_cli/copilot_auth.py uses an OAuth client_id that cannot access the Copilot API, so any user who logs in via hermes auth add copilot (or the existing device-code flow) ends up with a token that gets HTTP 404 from https://api.github.com/copilot_internal/v2/token, even when their GitHub account has an active Copilot subscription.

Root cause

# hermes_cli/copilot_auth.py
COPILOT_OAUTH_CLIENT_ID = "Ov23li...Qebz"   # GitHub App client id

This is a GitHub App client id (Ov23li... prefix). Tokens minted by it are not authorized for copilot_internal/v2/token, regardless of the user's Copilot plan.

The official VS Code / Copilot CLI / opencode flow uses the legacy OAuth App id:

Iv1.b507a08c87ecfe98

A token from this client_id (with read:user scope) successfully exchanges at copilot_internal/v2/token and lists the full live model catalog (including gpt-5.5, claude-opus-4.5, etc.) — confirmed by manual reproduction.

Reproduction

  1. hermes auth add copilot (or call copilot_device_code_login() directly)
  2. Authorize as a user with an active Copilot subscription (Individual/Business)
  3. Hermes saves token to COPILOT_GITHUB_TOKEN
  4. Any code path calling exchange_copilot_token()HTTP 404 Not Found
  5. fetch_github_model_catalog() returns None, so hermes model falls back to the hardcoded curated list — which is missing gpt-5.5 and other newer models.

Symptoms users see

  • /model gpt-5.5 not in the list even though it works in VS Code on the same account
  • hermes model shows a stale subset of the Copilot catalog
  • Token exchange silently fails; users assume their account doesn't have access

Fix

Change COPILOT_OAUTH_CLIENT_ID to Iv1.b507a08c87ecfe98. After this, the live /models catalog populates correctly and dynamic model discovery works as designed.

Side issues spotted while debugging

  • hermes auth add copilot --type oauth returns not implemented for auth type oauth yet. — the device-code flow is only reachable via setup wizard / internal call, not via the documented auth add path.
  • After copilot_device_code_login() returns a token, hermes_cli/main.py (line ~3528) calls save_env_value("COPILOT_GITHUB_TOKEN", token), but save_env_value is no longer importable from hermes_cli.main (got ImportError on current main branch). Token is fetched but never persisted.

Environment

  • Hermes Agent (current main)
  • Linux (cachyos), Python 3.11
  • Account: GitHub Individual Copilot subscription

extent analysis

TL;DR

Change the COPILOT_OAUTH_CLIENT_ID to Iv1.b507a08c87ecfe98 to fix the token exchange issue with the Copilot API.

Guidance

  • Update the COPILOT_OAUTH_CLIENT_ID in hermes_cli/copilot_auth.py to the correct legacy OAuth App ID.
  • Verify that the token exchange is successful by checking the response from https://api.github.com/copilot_internal/v2/token.
  • After updating the client ID, test the hermes auth add copilot command to ensure it works as expected.
  • Additionally, address the side issues spotted during debugging, such as implementing the OAuth flow for hermes auth add copilot --type oauth and fixing the save_env_value import error.

Example

# hermes_cli/copilot_auth.py
COPILOT_OAUTH_CLIENT_ID = "Iv1.b507a08c87ecfe98"  # Updated client ID

Notes

The fix assumes that the legacy OAuth App ID Iv1.b507a08c87ecfe98 is the correct one for the Copilot API. If this ID changes or is deprecated, the fix may need to be updated accordingly.

Recommendation

Apply the workaround by changing the COPILOT_OAUTH_CLIENT_ID to Iv1.b507a08c87ecfe98, as this is the only known solution to the token exchange issue with the Copilot API.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING