github / github/copilot-cli

Fix browser login URL wrapping and fallback

未关闭
#4,400 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:authentication area:terminal-rendering
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the bug

The Device Code login flow works as expected: it displays a one-time code and URL, opens the URL automatically, and offers to copy the code to the clipboard when a key is pressed.

The Sign in with your browser (recommended) flow behaves differently. Although it displays a message such as “If your browser didn't open, visit:”, pressing a key does not open the browser. The fallback URL is also difficult or impossible to use in the terminal:

  • The URL is long enough to wrap across terminal lines.
  • Only the beginning of the URL (for example, https://github.com/login/oauth/authorize?) is rendered as a clickable link.
  • The query string containing client_id and the remaining parameters appears after the line break and is neither clickable nor reliably selectable/copied.
  • Resizing the terminal changes the wrapping behavior unpredictably; depending on the width, the URL may appear on one line with its end clipped or wrap inconsistently.

This prevents users from completing browser authentication when automatic browser opening fails.

Affected environment

  • GitHub Copilot CLI
  • Linux under WSL2

Steps to reproduce

  1. Start the GitHub Copilot CLI login flow.
  2. Select Sign in with your browser (recommended).
  3. Observe the fallback message and URL.
  4. Press a key when prompted.
  5. If the browser does not open, try selecting or clicking the displayed URL, then resize the terminal and observe the URL again.

Expected behavior

The browser login flow should use the same browser-opening behavior as the Device Code flow: pressing a key should open the browser automatically.

If automatic browser opening fails, the complete fallback URL should be rendered as one usable clickable link without being split into a non-interactive suffix. The CLI should also provide a final copy-to-clipboard option so users can paste the complete URL into a browser manually.

Additional context

Please preserve the full URL and its query parameters across terminal widths, or otherwise provide a terminal-safe presentation that remains clickable and copyable.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 GitHub Copilot CLI 登录流程开始,对比“Sign in with your browser”路径和 Device Code 流程。跟踪回退 URL 在不同终端宽度下的呈现;完成的标准是按下一个键即可打开浏览器,并且完整的回退 URL 仍可点击和复制,最后还提供剪贴板选项。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
authentication, cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。