From 43b46a19bec8253deaf46057ecff156567edc8bc Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Thu, 12 Feb 2026 16:16:47 +0000 Subject: [PATCH] Retry API authentication errors since these can be transient --- lib/analyze-action-post.js | 6 ++++++ lib/analyze-action.js | 6 ++++++ lib/autobuild-action.js | 6 ++++++ lib/init-action-post.js | 6 ++++++ lib/init-action.js | 6 ++++++ lib/resolve-environment-action.js | 6 ++++++ lib/setup-codeql-action.js | 6 ++++++ lib/start-proxy-action-post.js | 6 ++++++ lib/start-proxy-action.js | 6 ++++++ lib/upload-lib.js | 6 ++++++ lib/upload-sarif-action-post.js | 6 ++++++ lib/upload-sarif-action.js | 6 ++++++ src/api-client.test.ts | 3 +++ src/api-client.ts | 6 ++++++ 14 files changed, 81 insertions(+) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index 501535bd7..bbdda873f 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -160929,6 +160929,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 8dc9a5964..7e4e89eea 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -106639,6 +106639,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index ef55653c2..e495cffbe 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -103300,6 +103300,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 3f2764926..1f1869f41 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -164145,6 +164145,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/init-action.js b/lib/init-action.js index 721758e0d..34c83bc4a 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -103986,6 +103986,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index eafa726a6..2e5438c36 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -103308,6 +103308,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index fe37a2dbd..445f3b576 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -103417,6 +103417,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index 49ba37483..1730dbe7b 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -160812,6 +160812,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index b361c5136..1aa9d0f63 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -120388,6 +120388,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/upload-lib.js b/lib/upload-lib.js index ce94ad390..7310bb940 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -106277,6 +106277,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index 60dcac6d8..012fb84a6 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -160812,6 +160812,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index e300737a9..e326893e6 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -106323,6 +106323,12 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) info: core5.info, warn: core5.warning, error: core5.error + }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451] } }) ); diff --git a/src/api-client.test.ts b/src/api-client.test.ts index 073f68ff1..3af9ae282 100644 --- a/src/api-client.test.ts +++ b/src/api-client.test.ts @@ -36,6 +36,9 @@ test("getApiClient", async (t) => { baseUrl: "http://api.github.localhost", log: sinon.match.any, userAgent: `CodeQL-Action/${actionsUtil.getActionVersion()}`, + retry: { + doNotRetry: [400, 410, 422, 451], + }, }), ); }); diff --git a/src/api-client.ts b/src/api-client.ts index f2fe01edf..13babcd38 100644 --- a/src/api-client.ts +++ b/src/api-client.ts @@ -51,6 +51,12 @@ function createApiClientWithDetails( warn: core.warning, error: core.error, }, + retry: { + // The default is 400, 401, 403, 404, 410, 422, and 451. We have observed transient errors + // with authentication, so we remove 401, 403, and 404 from the default list to ensure that + // these errors are retried. + doNotRetry: [400, 410, 422, 451], + }, }), ); }