Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Built-in skill `github-pr-media` cannot run: `gh auth token` is empty in a cloud agent session, and the endpoint rejects `Bearer`

Aberta Para iniciantes
#4,932 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
75/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
github-actions, shell

Direção de pesquisa

Veja builtin-skills/github-pr-media/SKILL.md. A issue descreve três falhas: o cabeçalho Authorization usa o esquema e a fonte do token errados, a etapa final de edição do PR requer um escopo adicional e há uma variável de ambiente não utilizada. Comece lendo o arquivo de skill para ver o comando curl e a chamada gh pr edit. Teste a correção proposta: altere 'Bearer $(gh auth token)' para 'token $GITHUB_COPILOT_API_TOKEN' e substitua gh pr edit por gh api --method PATCH. Verifique se copilot_swe_agent_use_attachment_proxy é referenciado em qualquer lugar da base de código. Verifique se as alterações funcionam em uma sessão de agente na nuvem executando a skill de ponta a ponta.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

triage
Describe the bug

The runtime ships builtin-skills/github-pr-media/SKILL.md. Run as written inside a Copilot cloud agent session, it fails at every step. A session can attach media - its own credential works -but not by following this skill.

Fault 1 - the authorization line is wrong twice

-H "Authorization: Bearer $(gh auth token)"
  • gh auth token returns nothing in a session. GH_TOKEN, GITHUB_TOKEN and GH_ENTERPRISE_TOKEN are all unset, and gh auth status reports the default token as invalid.
  • Bearer is the wrong scheme for this endpoint. It answers 404 Not Found, which reads as a missing endpoint rather than a wrong header.

Fault 2 - the final step needs a scope the session does not have

The skill finishes with gh pr edit --body-file -. That always requests the reviewRequests field, so it needs read:org. See cli/cli #13575, still open. gh api --method PATCH repos/{owner}/{repo}/pulls/{n} has no such requirement.

What actually works

A session holds GITHUB_COPILOT_API_TOKEN, a ghu_ GitHub App user-to-server token, and the attachment endpoint accepts it:

curl --fail-with-body -sS -X POST "$GITHUB_UPLOADS_URL" \
  --url-query "name=e.png" --url-query "content_type=image/png" \
  --url-query "repository_id=$GITHUB_REPOSITORY_ID" \
  -H "Content-Type: application/octet-stream" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  -H "Authorization: token $GITHUB_COPILOT_API_TOKEN" \
  --data-binary @e.png
HTTP/2 201
{"url":"https://<host>/user-attachments/assets/<uuid>"}

Six variants in one session, changing only the Authorization header:

Credential Scheme Answer
GITHUB_COPILOT_API_TOKEN Bearer HTTP/2 404
GITHUB_COPILOT_API_TOKEN token HTTP/2 201
COPILOT_SDK_AUTH_TOKEN Bearer HTTP/2 404
COPILOT_SDK_AUTH_TOKEN token HTTP/2 201
GITHUB_VERIFICATION_TOKEN Bearer HTTP/2 404
none - HTTP/2 404

The whole route then ran end to end in one session: make a PNG, open a draft pull request, upload, place the URL in the description with the harness tool, delete the file from the branch. The capture still renders, because the asset does not live in the repository.

Fault 3 - a flag that names nothing

The session environment carries copilot_swe_agent_use_attachment_proxy=true. I tested every local listener looking for what it selects. The Copilot API proxy answers 403 and the git credential proxy answers 406, and nothing in the runtime bundle reads that variable. Either wire it up or drop it, because it reads like a supported route and is not one.

What I ask for

  1. Change the skill to Authorization: token $GITHUB_COPILOT_API_TOKEN.
  2. Change its final step to gh api --method PATCH, or to the harness tool that writes the description.
  3. Remove or implement copilot_swe_agent_use_attachment_proxy.

Related: cli/cli refuses ghu_ in --attach for the same endpoint, which is the other half of why this looks unreachable. I filed that separately in #14495

Affected version

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Linguagem predominante
Shell
Estrelas
11.2k
Forks
1.9k
Merge médio
14h 16min
PRs com merge (30d)
6

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de github/copilot-cli

Todas as issues de github/copilot-cli

Issues semelhantes

Mais issues de Shell/Bash

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.