Skip to content

fix: GitHub Copilot auth fails to open browser in Desktop app (#6957)#8019

Open
jh-block wants to merge 2 commits intomainfrom
jhugo/fix-issue-6957
Open

fix: GitHub Copilot auth fails to open browser in Desktop app (#6957)#8019
jh-block wants to merge 2 commits intomainfrom
jhugo/fix-issue-6957

Conversation

@jh-block
Copy link
Collaborator

Summary

GitHub Copilot device code OAuth flow was not opening the browser automatically in the Desktop app and was hiding the verification code, leaving users stuck on "Signing in..." indefinitely.

This fix enables automatic browser opening, copies the verification code to clipboard, and updates the UI to explain the device code flow.

Testing

  • Desktop app can now successfully configure GitHub Copilot: browser opens automatically and verification code is copied to clipboard
  • CLI flow unchanged (backward compatible)
  • Verification code is no longer logged at info level (security improvement)

Related Issues

Fixes #6957

GitHub Copilot device code OAuth flow was not opening the browser automatically and was hiding the verification code from Desktop users, causing them to get stuck on "Signing in..." indefinitely.

**Changes:**
- Added `arboard` crate for clipboard support
- Modified `GithubCopilotProvider.login()` to open browser via `webbrowser::open()` and copy the user code to clipboard
- Added `device_code_flow` field to `ConfigKey` to distinguish device-code OAuth from redirect-based OAuth
- Added `ConfigKey::new_oauth_device_code()` constructor for device code providers
- Updated Frontend to show device-code-specific help text: "A browser window will open and the verification code will be copied to your clipboard"
- Regenerated OpenAPI types

**Testing:**
Desktop app can now successfully configure GitHub Copilot: browser opens automatically and verification code is copied to clipboard. CLI flow unchanged (backward compatible).

Fixes #6957
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4f0de56c0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +296 to +297
if let Err(e) = webbrowser::open(&device_code_info.verification_uri) {
tracing::warn!("Failed to open browser: {}", e);

Choose a reason for hiding this comment

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

P1 Badge Avoid launching Copilot auth on the backend machine

This opens the verification URL from inside goosed, but the desktop app explicitly supports remote/external backends (ui/desktop/src/goosed.ts:194-208). In that setup the browser opens on the server host instead of the user's workstation, and /config/providers/{name}/oauth does not stream the device code back to the renderer (crates/goose-server/src/routes/config_management.rs:898-910), so GitHub Copilot sign-in is still unusable for external-backend users.

Useful? React with 👍 / 👎.

Comment on lines +289 to +293
if let Ok(mut clipboard) = arboard::Clipboard::new() {
if let Err(e) = clipboard.set_text(&device_code_info.user_code) {
tracing::warn!("Failed to copy verification code to clipboard: {}", e);
}
}

Choose a reason for hiding this comment

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

P2 Badge Surface a manual fallback when clipboard automation fails

If clipboard access is unavailable here (common in WSL/headless Linux/some sandboxed desktop sessions), the only fallback is the later println!, but the Electron wrapper stops forwarding goosed stdout after startup (ui/desktop/src/goosed.ts:306-316) and the OAuth endpoint only returns after the whole flow completes (crates/goose-server/src/routes/config_management.rs:898-910). In those environments the user still sits on "Signing in..." with no verification code to enter manually.

Useful? React with 👍 / 👎.

Signed-off-by: Douwe Osinga <douwe@squareup.com>
Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

Removed three restating inline comments (code quality rules). Everything else looks good — the fix is sound for the common local-backend case. The Codex P1/P2 concerns (remote backend, headless clipboard) are pre-existing limitations not introduced by this PR.

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.

GitHub Copilot authentication stuck on "Signing in..." in Windows Desktop (v1.23.0)

2 participants