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
There was a problem hiding this comment.
One retained error-convention issue in the new Copilot runtime. Details inline.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 07f5e62. Configure here.

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
High Risk
Large changes to checkpoint revert ordering and provider lifecycle ingestion affect all providers; incorrect rollback or completion handling could leave sessions stuck or filesystem state inconsistent.
Overview
Introduces
CopilotDriverand@github/copilot/@github/copilot-sdkon the server so Copilot instances get the same snapshot, adapter, and text-generation wiring as other built-in providers.Checkpoint revert now verifies the target ref exists, restores the filesystem first, then calls provider rollback; failed rollback attempts to restore the current checkpoint, refreshes workspace entries, and records a failure activity instead of leaving disk and provider history out of sync (important when Copilot cannot roll back conversations).
Provider runtime ingestion accepts
turn.completedwithout a turn id when the active turn matches the provider session (or the provider already cleared the active turn), rejects completion when no provider session exists, infers turn id on completion when the guard accepts the event, and projectscontent.deltainto reasoning and tool-output activities; conflicting lifecycle events emit warning logs.First-turn orchestration queues title and branch generation through a drainable worker (drain waits for title jobs), retries transient title generation, and broadens
canReplaceThreadTitleso truncated client seeds and provider-expanded prompts can be replaced without overwriting user-edited titles.Projection keeps
latestTurnIdonthread.session-setwhenactiveTurnIdis null. Integration and unit tests cover missing turn-id completion, revert failure paths, Copilot rollback limitations, and the title/runtime behaviors above.Reviewed by Cursor Bugbot for commit 4cc4486. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add GitHub Copilot as a built-in provider with adapter, text generation, and settings support
copilotprovider driver (CopilotDriver.ts) that initializes a per-instance home directory, starts a Copilot SDK adapter, and refreshes provider status hourly.CopilotTextGeneration(CopilotTextGeneration.ts) with shared client pooling, a 30-second idle TTL, and strict JSON schema decoding for commit messages, PR content, branch names, and thread titles.CopilotSettingsto server settings schema withbinaryPath,serverUrl, andcustomModelsfields; exposes settings via the UI with an 'Early Access' badge.applyThreadDetailEventno longer runs its branch whenactiveTurnIdis null; non-effort select descriptors (e.g.,contextTier) are no longer treated aspromptEffort;deriveLatestContextWindowSnapshotnow correctly handles compaction boundaries.@github/copilotand@github/copilot-sdkas runtime dependencies; the Copilot adapter starts an external SDK process per provider instance.Macroscope summarized 4cc4486.
Copilot SDK Lifecycle Note (Adapter)