Skip to content

Add GitHub Copilot as a built-in provider - #3076

Closed
huxcrux wants to merge 155 commits into
pingdotgg:mainfrom
huxcrux:hux-copliot-fix
Closed

Add GitHub Copilot as a built-in provider#3076
huxcrux wants to merge 155 commits into
pingdotgg:mainfrom
huxcrux:hux-copliot-fix

Conversation

@huxcrux

@huxcrux huxcrux commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

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

  • Added GitHub Copilot as a first-class provider using the official Copilot SDK.
  • Wired Copilot through the server runtime for auth/status checks, model discovery, session start/resume, turn sending, permission replies, request handling, and event streaming.
  • Added Copilot-backed git text generation for commit messages, PR descriptions, branch names, and thread titles.
  • Added Copilot provider settings, defaults, model traits, reasoning effort, context window handling, and persisted configuration.
  • Updated the web UI so Copilot appears in provider/model pickers, settings, icons, context window selection, task rendering, and git writing model selection.
  • Hardened Copilot runtime behavior for queued turns, duplicate completions, tool-only turns, empty diffs, missing checkpoint refs, stale resume cursors, failed sends, task completions, and rollback-safe checkpointing.
  • Added regression coverage for the Copilot adapter, provider probing, text generation, context window handling, and related projection flows.

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

  • Added Copilot to the provider/model picker.
  • Added Copilot settings and model configuration surfaces.
  • Added Copilot icons, reasoning/context-window controls, and task output rendering.

Updated model picker:
image

Provider settings:
image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

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/copilot and @github/copilot-sdk to the server and introduces CopilotDriver, which follows the same ProviderDriver shape as other agents: per-instance state under providers/copilot/{instanceId}, a managed provider snapshot (hourly refresh), makeCopilotAdapter for sessions/turns/events, and makeCopilotTextGeneration for git-style text tasks.

The bulk of the diff is a new CopilotAdapter.test suite (mocked SDK runtime) that locks in Copilot-specific behavior: permission and user-input flows (including bootstrap correlation and acceptForSession), MCP OAuth/header refresh without leaking secrets, resume/rollback via SDK history truncate, queued-turn and multi-session.idle completion semantics, plan-mode and Task_complete projection, 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

  • Adds a copilot driver registered in the provider registry, backed by the @github/copilot-sdk package, with settings for binaryPath, serverUrl, and custom models.
  • Implements CopilotTextGeneration that shares a single CopilotClient per (cwd, settings) key, coalesces concurrent startups, and auto-stops idle clients after 30 seconds.
  • Adds CopilotAdapter for session/turn/tool management and CopilotProvider for status probing, auth snapshots, and model enumeration including long-context tier detection.
  • Supports both local stdio (via bundled or configured CLI binary) and remote URI connection modes; normalizes the runtime environment for POSIX shell compatibility.
  • The provider appears in the UI with an 'Early Access' badge and defaults to gpt-4.1; the 'Coming soon' placeholder is removed.
  • Risk: ServerSettingsService now replays its latest snapshot to late subscribers ({ replay: 1 }), changing subscription semantics for all consumers.

Macroscope summarized 5e461d8.

Copilot SDK Lifecycle Note (Adapter)

  • Turn completion is now signal-driven only: completion happens on assistant.idle or session.idle, not local timeout heuristics.
  • assistant.turn_end is treated as a completion marker for the active turn, but final completion waits for an idle signal to avoid ending multi-loop SDK turns too early.
  • Queued follow-up user turns can still settle the previous ended turn through the guarded completePendingActiveTurnEnd path before the next SDK turn is attributed.
  • Duplicate or repeated idle/end events remain idempotent through completedTurnIds and strict turn mapping guards.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3cb296f8-92d5-4a74-8abd-6b104dee05de

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Jun 14, 2026
Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts
Comment thread packages/shared/src/providerToolClassification.ts Outdated
Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts Outdated
Comment thread packages/shared/src/providerToolClassification.ts Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
Comment thread pnpm-workspace.yaml Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
Comment thread apps/server/src/provider/copilotRuntime.ts Outdated
Comment thread packages/contracts/src/settings.ts
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
Comment thread apps/server/src/orchestration/Layers/ProviderCommandReactor.ts Outdated
@huxcrux
huxcrux force-pushed the hux-copliot-fix branch 4 times, most recently from 5ae2460 to acf1c04 Compare June 18, 2026 01:41
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
Comment thread apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts Outdated
huxcrux and others added 26 commits July 20, 2026 10:38
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>
@juliusmarminge

Copy link
Copy Markdown
Member

might add new providers after orchestrator has merged #2829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants