Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ci): retry markdown link checks on timeouts

Steven Enamakel6957b2e6fb59
diff --git a/scripts/__tests__/retry-markdown-links.test.mjs b/scripts/__tests__/retry-markdown-links.test.mjs
index 2e95742345..5545e348a2 100644
--- a/scripts/__tests__/retry-markdown-links.test.mjs
+++ b/scripts/__tests__/retry-markdown-links.test.mjs
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
import test from "node:test";
import {
retryServiceUnavailable,
- serviceUnavailableUrls,
+ retryableFailureUrls,
} from "../ci/retry-markdown-links.mjs";
const unavailable =
@@ -110,7 +110,6 @@ test("404 or mixed failures are not retried", async () => {
missing,
unavailable + missing,
"",
- "* [TIMEOUT] <https://example.test/> | Timeout\n",
]) {
const { calls, check } = checker([]);
assert.equal(
@@ -139,7 +138,7 @@ test("a permanent error discovered on retry remains a failure", async () => {
});
test("retry inputs deduplicate repeated failures without dropping URL fragments", () => {
- assert.deepEqual(serviceUnavailableUrls(unavailable.repeat(3)), [
+ assert.deepEqual(retryableFailureUrls(unavailable.repeat(3)), [
"https://example.test/docs#anchor",
]);
});
diff --git a/scripts/ci/retry-markdown-links.mjs b/scripts/ci/retry-markdown-links.mjs
index a40e6c3c5f..39d6ece465 100644
--- a/scripts/ci/retry-markdown-links.mjs
+++ b/scripts/ci/retry-markdown-links.mjs
@@ -4,14 +4,14 @@ import { spawnSync } from "node:child_process";
import { setTimeout as delay } from "node:timers/promises";
import { fileURLToPath } from "node:url";
-const TRANSIENT_HTTP_STATUSES = new Set(["500", "502", "503", "504"]);
+const RETRYABLE_FAILURE_STATUSES = new Set(["TIMEOUT", "500", "502", "503", "504"]);
-/** Extract URLs only when every reported link failure is a transient HTTP 5xx. */
-export function serviceUnavailableUrls(report) {
+/** Extract URLs only when every reported link failure is a retryable timeout or HTTP 5xx. */
+export function retryableFailureUrls(report) {
const failures = [...report.matchAll(/^\*\s+\[([^\]]+)\]\s+<([^>]+)>/gm)];
if (
!failures.length ||
- failures.some(([, status]) => !TRANSIENT_HTTP_STATUSES.has(status))
+ failures.some(([, status]) => !RETRYABLE_FAILURE_STATUSES.has(status))
)
return null;
return [...new Set(failures.map(([, , url]) => url))];
@@ -24,7 +24,7 @@ export async function retryServiceUnavailable({
wait = delay,
log = console.info,
}) {
- let urls = serviceUnavailableUrls(initialReport);
+ let urls = retryableFailureUrls(initialReport);
if (!urls) {
log("[link-retry] reason=ineligible-report status=1");
return 1;
@@ -43,7 +43,7 @@ export async function retryServiceUnavailable({
log("[link-retry] reason=recovered status=0");
return 0;
}
- urls = serviceUnavailableUrls(result.report);
+ urls = retryableFailureUrls(result.report);
if (!urls) {
log(`[link-retry] reason=non-transient-failure status=${status}`);
return status;