Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions hermes_cli/runtime_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,20 @@ def _resolve_runtime_from_pool_entry(
elif provider == "copilot":
api_mode = _copilot_runtime_api_mode(model_cfg, getattr(entry, "runtime_api_key", ""))
base_url = base_url or PROVIDER_REGISTRY["copilot"].inference_base_url
# Exchange the raw GitHub OAuth token (gho_/ghu_) for a short-lived
# Copilot API Bearer (tid=...). Without this, sending the raw token to
# /chat/completions makes GitHub map it to whatever integrator the
# originating OAuth app declared as default — typically
# ``copilot-language-server`` for Business seats — which has a
# restricted model allowlist that excludes Claude. The sibling
# ``resolve_api_key_provider_credentials("copilot")`` path does this
# exchange; the pool path was the only one skipping it.
if api_key and not api_key.startswith("tid="):
try:
from hermes_cli.copilot_auth import get_copilot_api_token
api_key = get_copilot_api_token(api_key)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_copilot_api_token() returns (api_token, base_url), not a token string (hermes_cli/copilot_auth.py:415-434). Unpack the result here; otherwise this tuple becomes the runtime bearer value.

except Exception:
pass
elif provider == "azure-foundry":
# Azure Foundry: read api_mode and base_url from config
cfg_provider = str(model_cfg.get("provider") or "").strip().lower()
Expand Down