github / github/copilot-cli

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

Ouverte
#4,650 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

triage
Langage dominant
Shell
Étoiles
11.2k
Forks
1.9k
Merge moyen
14 h 16 min
PR mergées (30 j)
6

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire l’échec avec la CLI copilot en utilisant -p, --agent et la commande /login dans un environnement Enterprise ghe.com ; comparez le comportement avec une exécution interactive de copilot et vérifiez gh auth status. C’est terminé lorsque -p et --agent utilisent tous deux le chemin d’authentification Enterprise correct sans perturber les commandes suivantes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
github, shell
Domaine
authentication, cli
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
À clarifier
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.