Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

bug: dist/index.js is stale — calls deprecated Azure endpoint, breaking prompt/advanced modes entirely

Đang mở Phù hợp với người mới
#2 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
  • prompt and advanced modes 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 via setFailed.
  • preset mode still works because it does not touch the AI endpoint.
  • This affects every repository using this action in prompt or advanced mode.

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.