Skip to content

feat(copilot): add support for GitHub Copilot as a provider and enhance OAuth handling#50

Merged
yacosta738 merged 2 commits into
mainfrom
feature/dallay-133-add-support-for-github-copilot-as-a-provider-for-models
Feb 19, 2026
Merged

feat(copilot): add support for GitHub Copilot as a provider and enhance OAuth handling#50
yacosta738 merged 2 commits into
mainfrom
feature/dallay-133-add-support-for-github-copilot-as-a-provider-for-models

Conversation

@yacosta738
Copy link
Copy Markdown
Contributor

@yacosta738 yacosta738 commented Feb 19, 2026

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:

  • Added "GitHub Copilot" as a selectable provider in the onboarding wizard, including it in the recommended tier and provider selection menus (wizard.rs) [1] [2].
  • Implemented canonicalization so both "copilot" and "github-copilot" are recognized as the same provider, with consistent handling in provider name resolution, default model selection, and curated model lists (wizard.rs) [1] [2] [3] [4] [5] [6] [7].

Authentication and environment variable support:

  • Added support for Copilot authentication via OAuth device code or GitHub token environment variables (wizard.rs, copilot.rs, mod.rs) [1] [2] [3] [4].
  • Updated environment variable resolution to include GITHUB_TOKEN and GH_TOKEN for Copilot [1] [2].

Copilot OAuth and API improvements:

  • Improved Copilot OAuth polling with a safety margin and interval handling, and ensured required HTTP headers are set for device code and token requests (copilot.rs) [1] [2] [3] [4] [5] [6].

Testing enhancements:

  • Added/expanded tests for Copilot provider canonicalization, default models, curated models, environment variable resolution, OAuth polling delay, and message/tool conversion logic (wizard.rs, copilot.rs) [1] [2] [3] [4] [5] [6] [7].

Other minor improvements:

  • Minor code style and formatting tweaks for consistency and readability (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

  • New Features
    • GitHub Copilot is now available as a first-class provider with support for multiple models including gpt-4o, Claude 3.5 Sonnet, and o3-mini.
    • Flexible authentication options via GitHub token or device login for seamless Copilot integration.
    • Enhanced OAuth device authentication flow with improved polling timing and robust HTTP header management for greater reliability.

@linear
Copy link
Copy Markdown

linear Bot commented Feb 19, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 19, 2026

Warning

Rate limit exceeded

@yacosta738 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 11 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Onboarding Wizard Integration
clients/agent-runtime/src/onboard/wizard.rs
Extended canonicalization, default model mapping, curated model lists, provider labels, authentication prompts, and summary messaging to include GitHub Copilot alongside existing providers. Model selection flow updated to present Copilot-specific options.
OAuth Device-Code Flow Refinement
clients/agent-runtime/src/providers/copilot.rs
Added OAuth polling safety margin constant and delay calculation helper. Enhanced HTTP requests with User-Agent and Content-Type headers. Reworked polling delay from fixed Duration to numeric interval with safety margin guard. Expanded test coverage for header presence, delay calculation, and tool message conversion paths.
Credential Resolution
clients/agent-runtime/src/providers/mod.rs
Extended provider credential lookup to recognize "copilot" and "github-copilot" aliases, mapping them to GITHUB_TOKEN and GH_TOKEN environment variables.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main changes: adding GitHub Copilot support as a provider and enhancing OAuth handling, which are the core objectives of this changeset.
Description check ✅ Passed The PR description comprehensively covers the pull request objectives, including GitHub Copilot provider integration, authentication support, OAuth improvements, and testing enhancements with detailed references to relevant code sections.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from DALLAY-133: adding Copilot as a pluggable provider, testing compatibility with existing workflows, implementing OAuth integration, and supporting environment variable credentials.
Out of Scope Changes check ✅ Passed All changes are directly related to GitHub Copilot provider integration and OAuth handling as specified in the linked issue; no out-of-scope modifications were identified in the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/dallay-133-add-support-for-github-copilot-as-a-provider-for-models

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 19, 2026

✅ Contributor Report

User: @yacosta738
Status: Passed (12/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 89% >= 30%
Repo Quality Repos with ≥100 stars 0 >= 0
Positive Reactions Positive reactions received 9 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 3037 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 363 >= 0
Merger Diversity Unique maintainers who merged PRs 3 >= 0
Repo History Merge Rate Merge rate in this repo 87% >= 0%
Repo History Min PRs Previous PRs in this repo 33 >= 0
Profile Completeness Profile richness (bio, followers) 90 >= 0
Suspicious Patterns Spam-like activity detection 1 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-02-19 to 2026-02-19

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 | 🟠 Major

Copilot env‑var resolution is currently bypassed in provider construction.

You added GITHUB_TOKEN/GH_TOKEN candidates here, but create_provider_with_url still passes the raw api_key into CopilotProvider::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.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 19, 2026

Deploying corvus with  Cloudflare Pages  Cloudflare Pages

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

View logs

@yacosta738 yacosta738 merged commit be6208f into main Feb 19, 2026
12 checks passed
@yacosta738 yacosta738 deleted the feature/dallay-133-add-support-for-github-copilot-as-a-provider-for-models branch February 19, 2026 22:41
@yacosta738 yacosta738 mentioned this pull request Mar 16, 2026
This was referenced Apr 19, 2026
This was referenced Apr 29, 2026
@dallay-bot dallay-bot Bot mentioned this pull request May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant