Skip to content

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

ci: make markdown link retries cancel-aware and observable

Steven Enamakel7221b352d29a
diff --git a/.github/workflows/pr-quality.yml b/.github/workflows/pr-quality.yml
index d1db604f54..c3e7cbc8de 100644
--- a/.github/workflows/pr-quality.yml
+++ b/.github/workflows/pr-quality.yml
@@ -100,8 +100,10 @@ jobs:
fail: true
- name: Recheck transient service failures
if: steps.link-check.outcome == 'failure'
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
run: >-
- node scripts/ci/retry-markdown-links.mjs
+ bash scripts/ci-cancel-aware.sh node scripts/ci/retry-markdown-links.mjs
target/link-check/report.md
"$RUNNER_TEMP/lychee/bin/lychee"
appimage-rpath-guard:
diff --git a/scripts/ci/retry-markdown-links.mjs b/scripts/ci/retry-markdown-links.mjs
index 496717e4db..a0b6d44bf4 100644
--- a/scripts/ci/retry-markdown-links.mjs
+++ b/scripts/ci/retry-markdown-links.mjs
@@ -17,18 +17,32 @@ export async function retryServiceUnavailable({
initialReport,
check,
wait = delay,
+ log = console.info,
}) {
let urls = serviceUnavailableUrls(initialReport);
- if (!urls) return 1;
+ if (!urls) {
+ log("[link-retry] reason=ineligible-report status=1");
+ return 1;
+ }
let status = 1;
for (let attempt = 0; attempt < 3; attempt++) {
- await wait(5000 * 2 ** attempt);
+ const backoff = 5000 * 2 ** attempt;
+ log(`[link-retry] attempt=${attempt + 1} backoff_ms=${backoff} urls=${urls.length}`);
+ await wait(backoff);
const result = await check(urls);
status = result.status;
- if (status === 0) return 0;
+ log(`[link-retry] attempt=${attempt + 1} status=${status}`);
+ if (status === 0) {
+ log("[link-retry] reason=recovered status=0");
+ return 0;
+ }
urls = serviceUnavailableUrls(result.report);
- if (!urls) return status;
+ if (!urls) {
+ log(`[link-retry] reason=non-transient-failure status=${status}`);
+ return status;
+ }
}
+ log(`[link-retry] reason=retries-exhausted status=${status}`);
return status;
}