@actions/artifact: recognized network errors bypass the configured Twirp retry budget and lose their cause

Đang mở
#2,579 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
api, networking

Hướng nghiên cứu

Start in the artifact Twirp client's ArtifactHttpClient.retryableRequest catch block, where ECONNRESET, ENOTFOUND, ETIMEDOUT, ECONNREFUSED and EHOSTUNREACH currently throw NetworkError immediately, and check how the outer request wrapper drops the code and cause. Run the issue's mocked HttpClient.prototype.post script to confirm one call instead of the expected retries. Done means transient codes retry within maxAttempts with the structured code and cause kept, while 4xx and quota errors still fail at once; the lost-finalize-response policy is a separate design question.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

While checking the latest @actions/[email protected] on Node 26.13.1, I reproduced a recognized transient network error bypassing the configured Twirp retry budget. I searched existing network/retry/FinalizeArtifact reports, including #2575 (a different download-response cleanup bug), and found no report for this branch.

In ArtifactHttpClient.retryableRequest, the catch block immediately throws new NetworkError(error.code) for ECONNRESET, ENOTFOUND, ETIMEDOUT, ECONNREFUSED and EHOSTUNREACH. Therefore maxAttempts: 3 does not retry even one simulated ECONNRESET followed by success. The outer request wrapper then discards the structured code/cause, making callers parse the error message to recognize the transient failure.

Reproduce without any real network access, credentials or waiting after installing @actions/[email protected] and @actions/[email protected]:

import assert from 'node:assert/strict';
import { HttpClient } from '@actions/http-client';
// Relative path is intentional: this is a diagnostic of the published internal transport.
import { internalArtifactTwirpClient } from './node_modules/@actions/artifact/lib/internal/shared/artifact-twirp-client.js';

process.env.ACTIONS_RUNTIME_TOKEN = 'example-runtime-token';
process.env.ACTIONS_RESULTS_URL = 'https://example.invalid';
let calls = 0;
HttpClient.prototype.post = async () => {
  calls++;
  if (calls === 1) throw Object.assign(new Error('mock reset'), { code: 'ECONNRESET' });
  return { message: { statusCode: 200, headers: {} }, readBody: async () => JSON.stringify({ ok: true }) };
};
const client = internalArtifactTwirpClient({ maxAttempts: 3, retryIntervalMs: 1 });
await assert.rejects(client.CreateArtifact({ workflowRunBackendId: '1', workflowJobRunBackendId: '2', name: 'evidence', version: 7 }), /ECONNRESET/);
assert.equal(calls, 1);

Could retryable network failures participate in the existing bounded policy, with structured code/cause retained? Keep permanent 4xx and quota errors immediate. For state-changing calls, please also document/support safe lost-response handling: a finalized upload may exist when its response was lost, so blindly restarting the entire upload can cause an existing-name conflict. An SDK-supported operation-level policy would let consumers avoid duplicating that recovery logic.

Our retained consumer workaround in https://github.com/link-foundation/python-ai-driven-development-pipeline-template/pull/152 bounds retries at the artifact transport boundary, without repeating the test/build producer. Names must be unique per producer; it rejects artifacts present before the first attempt, and only reconciles/replaces that producer's unique name on a retry. Existing mocked tests cover transient codes, permanent failures, bounded exhaustion, lost finalize responses, preexisting-artifact refusal, download digest validation and strict extraction. The checked-in experiment additionally exercises this actual published SDK branch, rather than only a mock of our own adapter.

Ngôn ngữ chính
TypeScript
Star
5.9k
Fork
1.8k
Merge trung bình
15 phút
Pull request đã merge (30 ngày)
1

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 khác của actions/toolkit

Tất cả issue của actions/toolkit

Issue tương tự

Thêm issue về TypeScript

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.