fix: GitHub Copilot auth fails to open browser in Desktop app (#6957)#8019
fix: GitHub Copilot auth fails to open browser in Desktop app (#6957)#8019
Conversation
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
There was a problem hiding this comment.
💡 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".
| if let Err(e) = webbrowser::open(&device_code_info.verification_uri) { | ||
| tracing::warn!("Failed to open browser: {}", e); |
There was a problem hiding this comment.
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 👍 / 👎.
| 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); | ||
| } | ||
| } |
There was a problem hiding this comment.
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 <[email protected]>
DOsinga
left a comment
There was a problem hiding this comment.
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
* 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
…6957) (block#8019) Signed-off-by: Douwe Osinga <[email protected]> Co-authored-by: Douwe Osinga <[email protected]> Signed-off-by: Cameron Yick <[email protected]>
* 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
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
Related Issues
Fixes #6957