github / github/copilot-cli

Blocked as auth fails whenever -p or --agent used (enterprise login)

オープン
#4,650 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

triage
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
6

説明

Describe the bug

copilot fails to load due to auth issues when using -p --agent:

copilot -p "hello"

...worked fine.

Then if you run this, with --agent, it breaks:

copilot -p "hello" --agent my-agent

! Third-party MCP servers are disabled by your organization's Copilot policy. Only built-in servers are available.

Error: Authentication failed (Request ID: 2915:A0B85:4D563A2:5BD65FE:6A915A71)

Your GitHub token may be invalid, expired, or lacking the required permissions.

To resolve this, try the following:
  • Start 'copilot' and run the '/login' command to re-authenticate
  • If using a Fine-Grained PAT, ensure it has the 'Copilot Requests' permission enabled
  • If using COPILOT_GITHUB_TOKEN, GH_TOKEN or GITHUB_TOKEN environment variable, verify the token is valid and not expired
  • Run 'gh auth status' to check your current authentication status

And further more, once you do the above, then:

copilot -p "hello"

...is permanently broken too now with the same error as above, despite working moments before. Strange.

It's enterprise, so we are logged in via ghe.com.

Running a regular "copilot" is fine.

Version: 1.0.81

Can you please fix this latest blocking login bug. There should be no differing auth code paths just because of a -p or --agent parameter.

I suspect you've hardcoded or chosen api.githubcopilot.com incorrectly again (if so, please add some effective guardrails to prevent this, this is a repeated root cause of various login issues).

Affected version

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、ghe.com Enterprise 環境で -p--agent、および /login コマンドを使用して copilot CLI の失敗を再現します。インタラクティブな copilot の実行と動作を比較し、gh auth status を確認します。-p--agent の両方が正しい Enterprise 認証パスを使用し、その後のコマンドを壊さなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github, shell
領域
authentication, cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
説明が足りない
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。