bug: dist/index.js is stale — calls deprecated Azure endpoint, breaking prompt/advanced modes entirely
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 86/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- github-actions, javascript
- Lĩnh vực
- build-system, ci-cd
Hướng nghiên cứu
Bắt đầu với action.yml để xác nhận dist/index.js là điểm vào runtime, sau đó so sánh src/agent.js với dist/index.js được tạo và xem xét build-dist.yml. Chạy npm ci và npm run build, kiểm tra các thay đổi tạo ra trong dist/ và xác minh rằng artifact được tạo phản ánh mã nguồn hiện tại trước khi commit nó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Report
Summary
dist/index.js — the actual file that runs when the action is invoked (per action.yml: main: dist/index.js) — is severely out of sync with the current src/ code. This makes prompt and advanced modes completely non-functional for every user of this action.
What the dist does (broken)
// dist/index.js — what actually runs
const response = await fetch("https://models.inference.ai.azure.com/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json",
// No Accept header
// No X-GitHub-Api-Version header
// No AbortController / timeout
},
});
if (!response.ok) {
core.setFailed(...); // crashes the entire action on any API error
}
// No null checks — throws if AI returns unexpected JSON shape
const resultObj = JSON.parse(data.choices[0].message.content);
What the src does (correct)
// src/agent.js — never built into dist
const response = await fetch("https://models.github.ai/inference/chat/completions", {
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json",
"Accept": "application/vnd.github+json",
"X-GitHub-Api-Version": "2026-03-10",
},
signal: controller.signal, // 30s timeout via AbortController
});
if (!response.ok) {
core.warning(...); // graceful degradation
return [];
}
// full null-safety, JSON parse error handling, deduplication logic
Comparison Table
dist/index.js (what runs) |
src/agent.js (never built) |
|
|---|---|---|
| API endpoint | models.inference.ai.azure.com (deprecated) |
models.github.ai/inference |
| Timeout | None — hangs forever | 30s AbortController |
| On API error | core.setFailed — kills entire action |
core.warning + graceful [] |
| JSON parse safety | Crashes on bad AI response | Try/catch with warning |
| Accept header | Missing | application/vnd.github+json |
| API version header | Missing | X-GitHub-Api-Version: 2026-03-10 |
| Base issue merging/dedup | Missing | Full deduplication logic |
Impact
promptandadvancedmodes are 100% broken — the old Azure endpoint either rejects requests or returns responses in a format the old code cannot handle, causing the action to crash viasetFailed.presetmode still works because it does not touch the AI endpoint.- This affects every repository using this action in
promptoradvancedmode.
Root Cause
The build-dist.yml workflow only rebuilds dist/ when a PR is merged to main. The current src/agent.js was updated with a new endpoint, timeout, better error handling, and deduplication logic — but a rebuild was never committed. The stale dist/index.js therefore still targets the old deprecated Azure endpoint.
Fix
Run npm run build and commit the result:
npm ci
npm run build
git add dist/
git commit -m "fix: rebuild dist with correct GitHub Models endpoint and error handling"
git push
- Ngôn ngữ chính
- JavaScript
- Star
- 7
- Fork
- 3
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
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 tương tự
-
Design only Leadership Survey SLFS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
bcgov/digital-journeys#2293 ·
-
Toolkit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
API Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ProjectSidewalk/SidewalkWebpage#5556 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
jessepollak/home#1454 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
opensearch-project/OpenSearch-Dashboards#12822 ·
Maintainer thường phản hồi trong vòng 1 ngày