Conversation
- 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
| supportsDeviceFlow: true, | ||
| urlPattern: /(https:\/\/[^\s]+)/, | ||
| // Copilot uses gh CLI's auth - credentials stored via GitHub CLI config | ||
| credentialPath: '~/.config/gh/hosts.yml', |
There was a problem hiding this comment.
🔴 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:
extractCredentialsreads~/.config/gh/hosts.yml(line 810 of cli-auth.ts)- It calls
JSON.parse(content)on YAML content (line 811) JSON.parse()throws aSyntaxErrorbecause YAML is not valid JSON- The catch block at line 885 returns
null
The YAML format looks like:
github.com:
user: username
oauth_token: gho_xxxx
git_protocol: httpsImpact
checkProviderAuth('copilot')will always returnfalseeven when the user is authenticatedstartCLIAuthwill never detect existing credentials for copilot, forcing unnecessary re-authentication- After OAuth completion, credential extraction fails silently, so
session.tokenremains 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Since users are already authenticated with GitHub, this enables
easy integration with GitHub Copilot in cloud workspaces.
https://claude.ai/code/session_01W5rDi3F5VGd5oCwYbT6hJJ