Skip to content

Comments

feat: Add GitHub Copilot CLI integration#313

Open
khaliqgant wants to merge 1 commit intomainfrom
claude/add-copilot-integration-fFuNq
Open

feat: Add GitHub Copilot CLI integration#313
khaliqgant wants to merge 1 commit intomainfrom
claude/add-copilot-integration-fFuNq

Conversation

@khaliqgant
Copy link
Collaborator

@khaliqgant khaliqgant commented Jan 26, 2026

  • Add @github/copilot@0.0.395 to workspace Dockerfiles (base, local, browser)
  • Add Copilot CLI auth configuration with GitHub OAuth support
  • Add 'copilot' to CliType union for wrapper detection
  • Configure MCP server for Copilot in workspace Dockerfile
  • Support device flow authentication for headless environments

Since users are already authenticated with GitHub, this enables
easy integration with GitHub Copilot in cloud workspaces.

https://claude.ai/code/session_01W5rDi3F5VGd5oCwYbT6hJJ


Open with Devin

- Add @github/copilot@0.0.395 to workspace Dockerfiles (base, local, browser)
- Add Copilot CLI auth configuration with GitHub OAuth support
- Add 'copilot' to CliType union for wrapper detection
- Configure MCP server for Copilot in workspace Dockerfile
- Support device flow authentication for headless environments

Since users are already authenticated with GitHub, this enables
easy integration with GitHub Copilot in cloud workspaces.

https://claude.ai/code/session_01W5rDi3F5VGd5oCwYbT6hJJ
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View issue and 5 additional flags in Devin Review.

Open in Devin Review

supportsDeviceFlow: true,
urlPattern: /(https:\/\/[^\s]+)/,
// Copilot uses gh CLI's auth - credentials stored via GitHub CLI config
credentialPath: '~/.config/gh/hosts.yml',
Copy link
Contributor

Choose a reason for hiding this comment

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

🔴 Copilot credential extraction fails due to YAML file being parsed as JSON

The copilot provider configuration specifies credentialPath: '~/.config/gh/hosts.yml', which is a YAML file (GitHub CLI's credential storage format). However, the extractCredentials function in packages/daemon/src/cli-auth.ts uses JSON.parse(content) to parse all credential files.

Click to expand

How it fails

When the copilot provider is used:

  1. extractCredentials reads ~/.config/gh/hosts.yml (line 810 of cli-auth.ts)
  2. It calls JSON.parse(content) on YAML content (line 811)
  3. JSON.parse() throws a SyntaxError because YAML is not valid JSON
  4. The catch block at line 885 returns null

The YAML format looks like:

github.com:
    user: username
    oauth_token: gho_xxxx
    git_protocol: https

Impact

  • checkProviderAuth('copilot') will always return false even when the user is authenticated
  • startCLIAuth will never detect existing credentials for copilot, forcing unnecessary re-authentication
  • After OAuth completion, credential extraction fails silently, so session.token remains undefined
  • The authentication status will never show as successful in the UI

Missing code

The extractCredentials function has no else if (provider === 'copilot') branch to handle YAML parsing for the hosts.yml file.

Recommendation: Either: (1) Add YAML parsing support in extractCredentials for the copilot provider using a YAML parser library, or (2) Change the credentialPath to point to a JSON file that copilot CLI creates, or (3) Remove credentialPath if copilot doesn't store credentials in a file that can be easily read.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants