feat: GitHub Copilot provider with proper OAuth auth and token validation#1896
Merged
feat: GitHub Copilot provider with proper OAuth auth and token validation#1896
Conversation
When config.yaml had a non-default model (e.g. gpt-5.3-codex) and the provider was openai-codex, _normalize_model_for_provider() would replace it with the latest available codex model because _model_is_default only checked the CLI argument, not the config value. Now _model_is_default is False when config.yaml has a model that differs from the global fallback (anthropic/claude-opus-4.6), so the user's explicit config choice is preserved. Fixes #1887
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
Integrates GitHub Copilot as a first-class provider in Hermes, building on PR #1879 from @mchzimm with critical auth improvements modeled after opencode's implementation.
What's included
From PR #1879 (merged into this branch):
copilotandcopilot-acpas first-class providers[SILENT]cron marker for suppressing empty deliveries_saved_tool_namesNameError (fixed 17 test failures on main)New in this branch (auth improvements):
hermes_cli/copilot_auth.py— dedicated Copilot auth module:ghp_*) with clear error messages explaining supported typesCOPILOT_GITHUB_TOKEN→GH_TOKEN→GITHUB_TOKEN(matching Copilot CLI docs)Openai-Intent: conversation-edits,x-initiator: agent|user,Copilot-Vision-Request: true(matching opencode)hermes modelcopilot flow offers OAuth device code login when no token is foundWhy the auth changes matter
The Copilot API explicitly rejects classic PATs (
ghp_*) with400: Personal Access Tokens are not supported. Per GitHub docs:gho_github_pat_ghu_ghp_Without validation, users with classic PATs (common default for
gh auth login --with-token) get an opaque API error. The device code flow provides a direct way to get a proper OAuth token.Tests