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

オープン
#2,579 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
node.js, typescript
領域
api, networking

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
5.9k
フォーク
1.8k
平均マージ
15分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

actions/toolkit のほかの issue

actions/toolkit の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。