feat: integrate GitHub Copilot providers across Hermes#1879
Merged
teknium1 merged 1 commit intoNousResearch:mainfrom Mar 18, 2026
Merged
feat: integrate GitHub Copilot providers across Hermes#1879teknium1 merged 1 commit intoNousResearch:mainfrom
teknium1 merged 1 commit intoNousResearch:mainfrom
Conversation
Add first-class GitHub Copilot and Copilot ACP provider support across model selection, runtime provider resolution, CLI sessions, delegated subagents, cron jobs, and the Telegram gateway. This also normalizes Copilot model catalogs and API modes, introduces a Copilot ACP OpenAI-compatible shim, and fixes service-mode auth by resolving Homebrew-installed gh binaries under launchd. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR integrates GitHub Copilot as a first-class inference provider across Hermes’ CLI, runtime provider resolution, agent execution paths, and gateway/cron routing—adding both a direct Copilot API provider (copilot) and a local external-process-backed ACP provider (copilot-acp).
Changes:
- Add new providers (
copilot,copilot-acp) with live Copilot model catalog support, model-id normalization, and API mode selection (chat_completionsvscodex_responses). - Propagate ACP runtime metadata (
command,args) through CLI sessions, smart routing, delegation, cron jobs, and gateway flows; add an OpenAI-compatible ACP client shim. - Update docs and expand test coverage to validate provider resolution, persisted config, and Copilot-specific request shaping.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/user-guide/configuration.md | Documents Copilot/Copilot ACP setup and provider usage in config. |
| website/docs/reference/environment-variables.md | Updates provider override documentation for the new provider. |
| website/docs/reference/cli-commands.md | Updates CLI --provider reference to reflect provider additions. |
| tools/delegate_tool.py | Propagates ACP runtime details to delegated child agents; fixes tool-name restoration handling. |
| tests/test_run_agent_codex_responses.py | Adds Copilot Responses payload-shaping tests. |
| tests/test_run_agent.py | Adds reasoning/Copilot ACP client selection tests. |
| tests/test_model_provider_persistence.py | Ensures Copilot/Copilot ACP selections persist correctly to config. |
| tests/test_api_key_providers.py | Adds registry, aliasing, auth-status, and runtime-resolution tests for Copilot providers. |
| tests/hermes_cli/test_setup_model_provider.py | Verifies hermes setup flows for Copilot and Copilot ACP model pickers. |
| tests/hermes_cli/test_model_validation.py | Adds Copilot catalog probing, reasoning-effort, normalization, and API-mode tests. |
| tests/agent/test_auxiliary_client.py | Confirms auxiliary client uses Copilot runtime credentials/headers. |
| run_agent.py | Adds ACP client wiring and Copilot-specific payload adjustments for Responses/reasoning. |
| pyproject.toml | Bumps project version to 0.4.0. |
| hermes_cli/setup.py | Adds Copilot/Copilot ACP setup flows, model picker integration, and reasoning selection. |
| hermes_cli/runtime_provider.py | Adds Copilot ACP runtime resolver + Copilot dynamic API-mode selection. |
| hermes_cli/models.py | Introduces Copilot catalog fetch, model normalization, API-mode inference, and reasoning-effort helpers. |
| hermes_cli/main.py | Adds hermes model flows for Copilot and Copilot ACP, plus reasoning-effort selection. |
| hermes_cli/auth.py | Registers providers; adds gh auth token fallback + external-process provider credential resolution. |
| hermes_cli/init.py | Bumps Hermes CLI version/date metadata. |
| gateway/run.py | Propagates ACP command/args into gateway runtime kwargs. |
| cron/scheduler.py | Propagates ACP command/args into cron job agent construction. |
| cli.py | Adds Copilot model normalization + API-mode adjustment and propagates ACP metadata. |
| agent/smart_model_routing.py | Extends routing signatures/runtime payloads to include ACP command/args. |
| agent/copilot_acp_client.py | Adds Copilot ACP OpenAI-compatible client shim that spawns copilot --acp --stdio. |
| agent/auxiliary_client.py | Uses runtime credential resolver for API-key providers; adds Copilot default headers. |
| acp_adapter/session.py | Propagates ACP runtime metadata through ACP adapter session creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| | Variable | Description | | ||
| |----------|-------------| | ||
| | `HERMES_INFERENCE_PROVIDER` | Override provider selection: `auto`, `openrouter`, `nous`, `openai-codex`, `anthropic`, `zai`, `kimi-coding`, `minimax`, `minimax-cn`, `kilocode`, `alibaba` (default: `auto`) | | ||
| | `HERMES_INFERENCE_PROVIDER` | Override provider selection: `auto`, `openrouter`, `nous`, `openai-codex`, `copilot`, `anthropic`, `zai`, `kimi-coding`, `minimax`, `minimax-cn`, `kilocode`, `alibaba` (default: `auto`) | |
| | `-m`, `--model <model>` | Override the model for this run. | | ||
| | `-t`, `--toolsets <csv>` | Enable a comma-separated set of toolsets. | | ||
| | `--provider <provider>` | Force a provider: `auto`, `openrouter`, `nous`, `openai-codex`, `anthropic`, `zai`, `kimi-coding`, `minimax`, `minimax-cn`. | | ||
| | `--provider <provider>` | Force a provider: `auto`, `openrouter`, `nous`, `openai-codex`, `copilot`, `anthropic`, `zai`, `kimi-coding`, `minimax`, `minimax-cn`. | |
Comment on lines
+1383
to
+1401
| if resolved_provider == "copilot": | ||
| try: | ||
| from hermes_cli.models import copilot_model_api_mode, normalize_copilot_model_id | ||
|
|
||
| canonical = normalize_copilot_model_id(current_model, api_key=self.api_key) | ||
| if canonical and canonical != current_model: | ||
| if not self._model_is_default: | ||
| self.console.print( | ||
| f"[yellow]⚠️ Normalized Copilot model '{current_model}' to '{canonical}'.[/]" | ||
| ) | ||
| self.model = canonical | ||
| current_model = canonical | ||
| changed = True | ||
|
|
||
| resolved_mode = copilot_model_api_mode(current_model, api_key=self.api_key) | ||
| if resolved_mode != self.api_mode: | ||
| self.api_mode = resolved_mode | ||
| changed = True | ||
| except Exception: |
Comment on lines
+728
to
+736
| def _copilot_catalog_ids( | ||
| catalog: Optional[list[dict[str, Any]]] = None, | ||
| api_key: Optional[str] = None, | ||
| ) -> set[str]: | ||
| if catalog is None and api_key: | ||
| catalog = fetch_github_model_catalog(api_key=api_key) | ||
| if not catalog: | ||
| return set() | ||
| return { |
Comment on lines
+396
to
+405
| if method == "session/request_permission": | ||
| response = { | ||
| "jsonrpc": "2.0", | ||
| "id": message_id, | ||
| "result": { | ||
| "outcome": { | ||
| "outcome": "allow_once", | ||
| } | ||
| }, | ||
| } |
teknium1
pushed a commit
that referenced
this pull request
Mar 18, 2026
…ation Builds on PR #1879's Copilot integration with critical auth improvements modeled after opencode's implementation: - Add hermes_cli/copilot_auth.py with: - OAuth device code flow (copilot_device_code_login) using the same client_id (Ov23li8tweQw6odWQebz) as opencode and Copilot CLI - Token type validation: reject classic PATs (ghp_*) with a clear error message explaining supported token types - Proper env var priority: COPILOT_GITHUB_TOKEN > GH_TOKEN > GITHUB_TOKEN (matching Copilot CLI documentation) - copilot_request_headers() with Openai-Intent, x-initiator, and Copilot-Vision-Request headers (matching opencode) - Update auth.py: - PROVIDER_REGISTRY copilot entry uses correct env var order - _resolve_api_key_provider_secret delegates to copilot_auth for the copilot provider with proper token validation - Update models.py: - copilot_default_headers() now includes Openai-Intent and x-initiator - Update main.py: - _model_flow_copilot offers OAuth device code login when no token is found, with manual token entry as fallback - Shows supported vs unsupported token types - 22 new tests covering token validation, env var priority, header generation, and integration with existing auth infrastructure
This was referenced Mar 18, 2026
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.
Summary
This PR adds first-class GitHub Copilot integration across Hermes' main CLI/app flows and the messaging gateway stack.
What changed
copilotas a first-class provider with live GitHub Copilot model catalog supportcopilot-acpas a first-class provider backed by a new OpenAI-compatiblecopilot --acpshimhermes modelandhermes setupshow real model pickers for Copilot and Copilot ACPchat_completionsvscodex_responses)ghbinaries under launchdWhy
This makes GitHub Copilot usable end-to-end in Hermes:
Release metadata
0.4.0v2026.3.18Testing
Passed:
523 passed