feat(copilot): add support for GitHub Copilot as a provider and enhance OAuth handling#50
Conversation
…ce OAuth handling
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThis pull request integrates GitHub Copilot as a first-class provider in the agent runtime. Changes include adding Copilot to the onboarding wizard (provider options, model lists, authentication prompts), improving OAuth device-code flow with polling delays and HTTP headers, and extending credential resolution to recognize Copilot-specific environment variables. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Contributor ReportUser: @yacosta738
Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-02-19 to 2026-02-19 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
clients/agent-runtime/src/providers/mod.rs (1)
302-307:⚠️ Potential issue | 🟠 MajorCopilot env‑var resolution is currently bypassed in provider construction.
You added
GITHUB_TOKEN/GH_TOKENcandidates here, butcreate_provider_with_urlstill passes the rawapi_keyintoCopilotProvider::new, so env‑var resolution is ignored unless callers explicitly pass the key. That makes the new mapping ineffective and forces device login even when tokens are set.🐛 Proposed fix
- "copilot" | "github-copilot" => { - Ok(Box::new(copilot::CopilotProvider::new(api_key))) - }, + "copilot" | "github-copilot" => { + Ok(Box::new(copilot::CopilotProvider::new(key))) + },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@clients/agent-runtime/src/providers/mod.rs` around lines 302 - 307, The provider_env_candidates mapping is unused because create_provider_with_url passes the raw api_key into CopilotProvider::new, so env-var resolution is bypassed; update create_provider_with_url (the code path that constructs "copilot" / "github-copilot") to resolve the api key using the provider_env_candidates for the given name (check GITHUB_TOKEN and GH_TOKEN) and pass the resolved token (falling back to the provided api_key if env lookup yields nothing) into CopilotProvider::new instead of the raw api_key to ensure env-based tokens are honored.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@clients/agent-runtime/src/providers/mod.rs`:
- Around line 302-307: The provider_env_candidates mapping is unused because
create_provider_with_url passes the raw api_key into CopilotProvider::new, so
env-var resolution is bypassed; update create_provider_with_url (the code path
that constructs "copilot" / "github-copilot") to resolve the api key using the
provider_env_candidates for the given name (check GITHUB_TOKEN and GH_TOKEN) and
pass the resolved token (falling back to the provided api_key if env lookup
yields nothing) into CopilotProvider::new instead of the raw api_key to ensure
env-based tokens are honored.
…oving unnecessary parameter
Deploying corvus with
|
| Latest commit: |
8438e5d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ee682190.corvus-42x.pages.dev |
| Branch Preview URL: | https://feature-dallay-133-add-suppo.corvus-42x.pages.dev |
This pull request adds first-class support for GitHub Copilot as a provider in the onboarding wizard and authentication flow, along with improvements to Copilot OAuth handling and expanded tests. The changes ensure Copilot is discoverable, selectable, and usable in the agent runtime, with appropriate model defaults, curated model lists, and authentication options.
GitHub Copilot provider integration:
wizard.rs) [1] [2].wizard.rs) [1] [2] [3] [4] [5] [6] [7].Authentication and environment variable support:
wizard.rs,copilot.rs,mod.rs) [1] [2] [3] [4].GITHUB_TOKENandGH_TOKENfor Copilot [1] [2].Copilot OAuth and API improvements:
copilot.rs) [1] [2] [3] [4] [5] [6].Testing enhancements:
wizard.rs,copilot.rs) [1] [2] [3] [4] [5] [6] [7].Other minor improvements:
wizard.rs,copilot.rs) [1] [2].These changes collectively make GitHub Copilot a first-class, user-friendly provider option in the agent runtime with robust authentication and model selection support.
Summary by CodeRabbit
Release Notes