Add GitHub Copilot as a built-in provider - #3076
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
ApprovabilityVerdict: Needs human review Diff is too large for automated approval analysis. A human reviewer should evaluate this PR. You can customize Macroscope's approvability policy. Learn more. |
5ae2460 to
acf1c04
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
might add new providers after orchestrator has merged #2829 |
…a178) Upgrade the in-tree GitHub Copilot provider from the older copy merged on 2026-07-14 (from the now-closed PR pingdotgg#3076) to the source branch's current tip. Brings the Copilot hardening authored after that cut: provider/session lifecycle and per-thread serialization (new threadLifecycleLock), failed and rejected turn completion, stale provider-instance recovery, settings-watcher races, client stop failures, MCP bearer-auth extraction (new copilotMcpBearerAuth), summarized and custom thread titles, and the Copilot CLI/SDK bump to 1.0.69 / 1.0.6. Conflict resolution: - Copilot-specific files taken from the branch (our side never edited them). - Wiring/contract files kept ours -- HEAD already had the provider wired, so they net to no change and preserve our newer providers (incl. pi). - Settings watcher: kept our eager subscribeChanges consumer alongside their PubSub replay:1 (both now present in serverSettings). - Work log (session-logic): kept our running-tool-call / subagent-lifecycle behavior over the branch's older omit-tool-started variant. - copilotRuntime: dropped a stale PROVIDER arg to match the current 3-arg providerModelsFromSettings signature. Verified: typecheck (server/web/contracts) clean; 185 targeted tests pass (Copilot adapter/provider/runtime/text-gen, ProviderRegistry, web session-logic, contracts settings); lint clean. Co-authored-by: Hugo Blom <hugo@nullshard.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This PR supersedes #2185. It includes the full Copilot integration from that PR plus the fixes and hardening discovered while testing it against the current codebase.
What Changed
Why
T3 Code supports multiple agent providers, but did not have GitHub Copilot support. This adds Copilot end to end in the same shape as the existing providers, so users can configure Copilot, select Copilot models, use Copilot for git text generation, and rely on the same session/runtime flows as other providers.
The extra hardening keeps Copilot predictable under real usage: turns complete once, tool output and reasoning project correctly, diffs are only emitted when meaningful, permission replies resolve cleanly, checkpoint handling is safer, and provider status/model data stays accurate.
UI Changes
Updated model picker:

Provider settings:

Checklist
Note
Medium Risk
New external SDK integration on the provider/session path with complex turn-idle queuing and permission handling; risk is mitigated by broad adapter tests but runtime behavior is still new surface area.
Overview
Adds
@github/copilotand@github/copilot-sdkto the server and introducesCopilotDriver, which follows the sameProviderDrivershape as other agents: per-instance state underproviders/copilot/{instanceId}, a managed provider snapshot (hourly refresh),makeCopilotAdapterfor sessions/turns/events, andmakeCopilotTextGenerationfor git-style text tasks.The bulk of the diff is a new
CopilotAdapter.testsuite (mocked SDK runtime) that locks in Copilot-specific behavior: permission and user-input flows (including bootstrap correlation andacceptForSession), MCP OAuth/header refresh without leaking secrets, resume/rollback via SDK history truncate, queued-turn and multi-session.idlecompletion semantics, plan-mode andTask_completeprojection, diffs from writes/Apply_patch, interrupts, stop-session draining, and failure paths (quota, send reject).Reviewed by Cursor Bugbot for commit 5e461d8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add GitHub Copilot as a built-in provider with full text generation support
copilotdriver registered in the provider registry, backed by the@github/copilot-sdkpackage, with settings forbinaryPath,serverUrl, and custom models.CopilotTextGenerationthat shares a singleCopilotClientper (cwd, settings) key, coalesces concurrent startups, and auto-stops idle clients after 30 seconds.CopilotAdapterfor session/turn/tool management andCopilotProviderfor status probing, auth snapshots, and model enumeration including long-context tier detection.gpt-4.1; the 'Coming soon' placeholder is removed.ServerSettingsServicenow replays its latest snapshot to late subscribers ({ replay: 1 }), changing subscription semantics for all consumers.Macroscope summarized 5e461d8.
Copilot SDK Lifecycle Note (Adapter)