Skip to content

Add Github Copilot Provider#2185

Open
zortos293 wants to merge 14 commits intopingdotgg:mainfrom
zortos293:feat/add-copilot-sdk-support
Open

Add Github Copilot Provider#2185
zortos293 wants to merge 14 commits intopingdotgg:mainfrom
zortos293:feat/add-copilot-sdk-support

Conversation

@zortos293
Copy link
Copy Markdown
Contributor

@zortos293 zortos293 commented Apr 18, 2026

What Changed

  • Added GitHub Copilot as a first-class provider using the official Copilot SDK.
  • Wired Copilot through the server runtime, including provider detection, auth/status reporting, model discovery, session startup/resume, turn sending, request handling, and event streaming.
  • Added Copilot-backed git text generation for commit messages, PR content, branch names, and thread titles.
  • Added Copilot to shared contracts/settings so it behaves like the existing providers for model selection, reasoning options, defaults, and persisted settings.
  • Updated the web app so Copilot appears in the provider/model dropdowns, settings panels, custom model management, composer state, and git writing model selection.

Why

T3 Code already supports multiple agent providers, but it did not have GitHub Copilot support. This change adds Copilot end to end in the same shape as the other providers instead of treating it as a one-off integration.

That keeps the UX and server behavior consistent: users can configure Copilot in settings, select Copilot models from the same pickers, use it for git text generation, and rely on the same persistence and runtime flows that already exist for other providers. Using the official SDK also keeps the integration aligned with GitHub’s supported protocol and model discovery/auth flows.

UI Changes

  • Added Copilot to the provider picker.
  • Added a Copilot settings section with binary path, server URL, and custom model configuration.
  • Added Copilot to the git writing model picker and traits handling.
image image 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

High Risk
Introduces a new first-class provider with a large new session/event adapter and shared client lifecycle management, touching core runtime orchestration, settings/contracts, and UI model selection paths; failures could impact session handling and provider routing across the app.

Overview
Adds GitHub Copilot as a first-class provider end-to-end (dependency on @github/copilot-sdk), including provider status probing/model discovery (CopilotProviderLive), a full runtime session adapter with event streaming, permission/user-input handling, resume support, and ndjson native event logging (CopilotAdapterLive).

Extends git text generation routing to support copilot via CopilotTextGenerationLive, which reuses a shared started Copilot client across requests with an idle shutdown TTL and structured-JSON prompting/validation for commit messages, PR content, branch names, and thread titles.

Updates shared contracts/settings and the web UI to include copilot everywhere providers/models are handled (provider kind enums, default models, reasoning-effort options, provider ordering, model pickers/traits, settings panel fields, persisted draft normalization), plus adds targeted tests for the new Copilot runtime, provider probe error surfacing, and git client reuse.

Reviewed by Cursor Bugbot for commit 01451c8. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add GitHub Copilot as a provider for chat, text generation, and settings

  • Integrates the @github/copilot-sdk as a new copilot provider across the full stack: provider registry, adapter, text generation, model selection, and settings UI.
  • Adds CopilotProvider and CopilotAdapter layers that probe SDK availability, surface auth status, and stream provider state changes via the existing managed provider infrastructure.
  • Implements CopilotTextGenerationLive for commit messages, PR content, branch names, and thread titles using a shared client with session-per-request semantics and a 30-second idle shutdown.
  • Extends contracts and settings schemas to include CopilotSettings, CopilotModelOptions (with reasoningEffort: xhigh/high/medium/low), and CopilotModelSelection.
  • Adds the GitHub Copilot provider card to the settings UI, model picker sidebar, and composer registry; removes the old "Coming soon" placeholder.
  • Risk: the Copilot SDK binary is resolved from settings and the environment; inherited COPILOT_CLI_PATH is explicitly deleted to prevent unintended CLI selection.

Macroscope summarized 01451c8.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

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: 2c5cb2de-5450-451a-9857-c839198e9293

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 and usage tips.

@zortos293 zortos293 mentioned this pull request Apr 18, 2026
4 tasks
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Apr 18, 2026
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 18, 2026

Approvability

Verdict: Needs human review

1 blocking correctness issue found. This PR adds GitHub Copilot as a new provider, introducing ~4000 lines of new code including SDK integration, session management, and permission handling. The substantial scope, new external dependency, and unresolved high-severity comment about incomplete turn event lifecycle in error paths warrant thorough human review.

You can customize Macroscope's approvability policy. Learn more.

Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
@zortos293
Copy link
Copy Markdown
Contributor Author

This needs to be tested if the desktop app is working fine with Copilot

@brrock
Copy link
Copy Markdown

brrock commented Apr 19, 2026

Because julius plumbed in ACP can't we just use ACP, I guess the copilot sdk has copilot specific stuff

Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts 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/Layers/CopilotAdapter.ts Outdated
@zortos293 zortos293 force-pushed the feat/add-copilot-sdk-support branch from f02de1a to 290befb Compare April 20, 2026 08:04
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
Comment thread apps/server/src/git/Layers/CopilotTextGeneration.ts Outdated
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts Outdated
Comment thread apps/server/src/git/Layers/CopilotTextGeneration.ts
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
Comment thread apps/server/src/git/Layers/CopilotTextGeneration.ts
fav-devs added a commit to fav-devs/fdcode that referenced this pull request Apr 21, 2026
});
export type CodexSettings = typeof CodexSettings.Type;
export const CopilotSettings = Schema.Struct({
enabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot enabled by default causes unwanted CLI spawns

Medium Severity

CopilotSettings defaults enabled to true, meaning every existing user who upgrades will have Copilot auto-enabled. Combined with the 1-hour COPILOT_REFRESH_INTERVAL, this will repeatedly spawn the bundled Copilot CLI binary, attempt auth checks, and fail for the majority of users who have no GitHub Copilot subscription or auth configured. Unlike Codex/Claude/OpenCode which are the app's core providers, Copilot is a newly added optional integration — defaulting to false (like Cursor does) would avoid unnecessary process spawns and error noise on every refresh cycle.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c9b8512. Configure here.

readonly raw?: SessionEvent | undefined;
}) {
return {
eventId: EventId.make(Effect.runSync(Random.nextUUIDv4)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-idiomatic UUID generation bypasses Effect runtime

Low Severity

createBaseEvent uses Effect.runSync(Random.nextUUIDv4) to generate event IDs, creating a throwaway mini-runtime on every call. The Claude adapter, by contrast, uses yield* Random.nextUUIDv4 within Effect generators. Since createBaseEvent is called from both Effect and async/promise contexts (via emitAsync and handleSdkEvent), the runSync escape hatch is used as a workaround. A reviewer already noted this file is "a bit too promise based" — wrapping the SDK with a thin Effect shim would let createBaseEvent live inside the Effect context and use the runtime's Random service idiomatically.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c9b8512. Configure here.

@rgembalik
Copy link
Copy Markdown

I am not a maintainer, but I did couple of local tests. There were few cases where session stopped without showing final results message. I don't know if this is upstream bug, or something related to the PR (currently I have only copilot license so it's hard to test against other providers). After asking, I got a response that the results were there, but probably didn't show on my end.

image

@zortos293
Copy link
Copy Markdown
Contributor Author

i'l look into this

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 01451c8. Configure here.

Comment thread apps/server/src/provider/copilotRuntime.ts
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
Comment thread apps/server/src/provider/Layers/CopilotAdapter.ts
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.

4 participants