Built-in skill `github-pr-media` cannot run: `gh auth token` is empty in a cloud agent session, and the endpoint rejects `Bearer`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- github-actions, shell
- Lĩnh vực
- cli, developer-experience
Hướng nghiên cứu
Xem builtin-skills/github-pr-media/SKILL.md. Issue mô tả ba lỗi: tiêu đề Authorization sử dụng scheme và nguồn token sai, bước chỉnh sửa PR cuối cùng yêu cầu một phạm vi bổ sung và có một biến môi trường không được sử dụng. Bắt đầu bằng cách đọc tệp kỹ năng để xem lệnh curl và lệnh gọi gh pr edit. Kiểm tra bản sửa lỗi được đề xuất: đổi 'Bearer $(gh auth token)' thành 'token $GITHUB_COPILOT_API_TOKEN' và thay thế gh pr edit bằng gh api --method PATCH. Kiểm tra xem copilot_swe_agent_use_attachment_proxy có được tham chiếu ở bất kỳ đâu trong codebase không. Xác minh các thay đổi hoạt động trong phiên đại lý đám mây bằng cách chạy kỹ năng từ đầu đến cuối.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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 tokenreturns nothing in a session.GH_TOKEN,GITHUB_TOKENandGH_ENTERPRISE_TOKENare all unset, andgh auth statusreports the default token as invalid.Beareris the wrong scheme for this endpoint. It answers404 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
- Change the skill to
Authorization: token $GITHUB_COPILOT_API_TOKEN. - Change its final step to
gh api --method PATCH, or to the harness tool that writes the description. - 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
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/copilot-cli
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
github/copilot-cli#4909 ·
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
github/copilot-cli#4906 ·
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/copilot-cli#4848 ·
-
area:agents area:mcp
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/copilot-cli#4729 ·
-
area:sessions
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/copilot-cli#4712 ·
Tất cả issue của github/copilot-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug easy help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
lacs-project/sysknife#503 ·
-
help wanted kind/documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
liquidmetal-dev/flintlock#1239 ·