Skip to content

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

Merged
DOsinga merged 3 commits intomainfrom
jhugo/fix-issue-6957
Mar 26, 2026
Merged

fix: GitHub Copilot auth fails to open browser in Desktop app (#6957)#8019
DOsinga merged 3 commits intomainfrom
jhugo/fix-issue-6957

Conversation

@jh-block
Copy link
Copy Markdown
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
Copy Markdown

@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);
Copy link
Copy Markdown

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);
}
}
Copy link
Copy Markdown

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 👍 / 👎.

Copy link
Copy Markdown
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.

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	crates/goose/Cargo.toml
@DOsinga DOsinga enabled auto-merge March 26, 2026 18:03
@DOsinga DOsinga added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 11f46dc Mar 26, 2026
21 of 25 checks passed
@DOsinga DOsinga deleted the jhugo/fix-issue-6957 branch March 26, 2026 18:39
michaelneale added a commit that referenced this pull request Mar 26, 2026
* main: (337 commits)
  fix: replace panics with user-friendly errors in CLI session builder (#7901)
  fix: read GOOSE_CONTEXT_LIMIT from config.yaml, not just env vars (#7900)
  fix: deliver truncation notice as separate content block (#7899)
  fix: use platform-appropriate commands in developer extension instructions (#7898)
  fix: replace any with proper SVG types in icon components (#7873)
  chore: remove debug console.log statements, stale comments, and dead code (#8142)
  feat: Gemini OAuth provider (#8129)
  chore(deps): bump picomatch from 2.3.1 to 2.3.2 in /documentation (#8123)
  feat: show installed skills in UI (#7910)
  fix(deps): gate keyring platform features behind target-specific deps (#8039)
  chore(deps): bump yaml from 2.8.2 to 2.8.3 in /evals/open-model-gym/suite (#8124)
  fix: strip message wrapper in CLI session title generation (#7996)
  fix(providers): fall back to configured models when models endpoint fetch fails (#7530)
  chore(deps): bump brace-expansion from 5.0.3 to 5.0.5 in /evals/open-model-gym/suite (#8139)
  fix: prevent Ollama provider from hanging on tool-calling requests (#7723)
  fix: VMware Tanzu Platform provider - bug fixes, streaming, UI improvements (#8126)
  feat: allow GOOSE_CLI_SHOW_THINKING to be set in config.yaml (#8097)
  fix: GitHub Copilot auth fails to open browser in Desktop app (#6957) (#8019)
  fix(ci): produce .tar.gz archives for Zed ACP registry compatibility (#8054)
  feat: add GOOSE_SHOW_FULL_OUTPUT config to disable tool output truncation (#7919)
  ...

# Conflicts:
#	crates/goose/src/providers/formats/openai.rs
hydrosquall pushed a commit to hydrosquall/goose that referenced this pull request Mar 31, 2026
…6957) (block#8019)

Signed-off-by: Douwe Osinga <[email protected]>
Co-authored-by: Douwe Osinga <[email protected]>
Signed-off-by: Cameron Yick <[email protected]>
blackgirlbytes pushed a commit that referenced this pull request Apr 2, 2026
* main: (337 commits)
  fix: replace panics with user-friendly errors in CLI session builder (#7901)
  fix: read GOOSE_CONTEXT_LIMIT from config.yaml, not just env vars (#7900)
  fix: deliver truncation notice as separate content block (#7899)
  fix: use platform-appropriate commands in developer extension instructions (#7898)
  fix: replace any with proper SVG types in icon components (#7873)
  chore: remove debug console.log statements, stale comments, and dead code (#8142)
  feat: Gemini OAuth provider (#8129)
  chore(deps): bump picomatch from 2.3.1 to 2.3.2 in /documentation (#8123)
  feat: show installed skills in UI (#7910)
  fix(deps): gate keyring platform features behind target-specific deps (#8039)
  chore(deps): bump yaml from 2.8.2 to 2.8.3 in /evals/open-model-gym/suite (#8124)
  fix: strip message wrapper in CLI session title generation (#7996)
  fix(providers): fall back to configured models when models endpoint fetch fails (#7530)
  chore(deps): bump brace-expansion from 5.0.3 to 5.0.5 in /evals/open-model-gym/suite (#8139)
  fix: prevent Ollama provider from hanging on tool-calling requests (#7723)
  fix: VMware Tanzu Platform provider - bug fixes, streaming, UI improvements (#8126)
  feat: allow GOOSE_CLI_SHOW_THINKING to be set in config.yaml (#8097)
  fix: GitHub Copilot auth fails to open browser in Desktop app (#6957) (#8019)
  fix(ci): produce .tar.gz archives for Zed ACP registry compatibility (#8054)
  feat: add GOOSE_SHOW_FULL_OUTPUT config to disable tool output truncation (#7919)
  ...

# Conflicts:
#	crates/goose/src/providers/formats/openai.rs
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