Add GitHub Copilot as a built-in provider#3076
Conversation
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>
Expose the new Copilot CLI max reasoning effort option in model capabilities. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Emit command metadata separately from command output so Copilot command rows render like Codex. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep sidebarThreadSummaryById owned by shell updates by removing the detail-stream metadata patch and its regression test. 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>
Ensure Copilot session.error events complete the active turn as failed before clearing active turn state, and cover the lifecycle with a regression test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes 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 fa9f054. Configure here.
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. |
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>
| message: event.data.message.trim(), | ||
| detail: event.data, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
🟡 Medium Layers/CopilotAdapter.ts:1855
event.data.message.trim() throws when event.data.message is null or undefined. Other handlers in this file use trimOrUndefined() to safely handle optional SDK messages.
- payload: {
- message: event.data.message.trim(),
- detail: event.data,
- },
+ payload: {
+ message: trimOrUndefined(event.data.message) ?? "",
+ detail: event.data,
+ },🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/provider/Layers/CopilotAdapter.ts around lines 1855-1858:
`event.data.message.trim()` throws when `event.data.message` is `null` or `undefined`. Other handlers in this file use `trimOrUndefined()` to safely handle optional SDK messages.
Evidence trail:
apps/server/src/provider/Layers/CopilotAdapter.ts line 1855 (direct .trim() on event.data.message), line 1761 (same field uses trimOrUndefined for session.error), apps/server/src/provider/copilotRuntime.ts lines 63-65 (trimOrUndefined definition with null-safe ?.trim())
Import the mock API directly from vitest in server tests and keep the patched @effect/vitest runner resolution aligned with the workspace vitest alias. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid @effect/vitest in the tailscale package because its patched runner import can resolve incompatible Vitest internals under vp test. Run the Effects through a local Vitest helper instead and depend directly on the repo Vitest catalog alias.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.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
High Risk
Touches checkpoint revert ordering, provider rollback recovery, and a new full provider adapter—errors could leave filesystem and conversation state inconsistent or mis-project active turns.
Overview
Adds GitHub Copilot as a built-in provider via
CopilotDriver, the official SDK dependencies, and a largeCopilotAdaptersurface (sessions, permissions, event normalization, diffs, titles, background tasks) with extensive adapter tests.Checkpoint and revert behavior is tightened: missing placeholder git refs are only captured once the session is no longer
running, with athread.session-setpath to flush remaining placeholders; revert restores the filesystem before providerrollbackConversation, rolls back the workspace on provider failure (with optional restore to the current checkpoint), skips provider rollback when filesystem restore fails, and preflights checkpoint ref availability. Checkpoint diffs return a clearer error when a ref is missing.Orchestration/projections avoid advancing
latestTurnwhile another turn is still active, mapcontent.deltastreams into reasoning and tool-output activities, and improve first-turn title/branch generation (drain waits on title jobs, retries, truncated-seed matching, Copilot model selection in tests).Test harnesses move some
viimports tovitestand add regression coverage across checkpoint store, checkpoint reactor, provider command reactor, and runtime ingestion.Reviewed by Cursor Bugbot for commit df43adf. 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
CopilotDriveras a registered built-in provider, wiring together aCopilotAdapterfor session/turn/approval flows andmakeCopilotTextGenerationfor commit messages, PR content, branch names, and thread titlesCopilotSettingsto server config (binary path, server URL, custom models) and exposes Copilot in the settings UI; removes GitHub Copilot from the "coming soon" listcreateCopilotClienthandles CLI path resolution, POSIX shell normalization, environment setup, and model capability mapping (reasoning effort, context tier)(cwd, settings)key, creates isolated sessions per request, retries on failure, and shuts down idle clients after 30 seconds@github/copilotand@github/copilot-sdkas runtime server dependencies; Copilot sessions time out at 180s with no streaming supportMacroscope summarized df43adf.