Skip to content

fix(ci): harden links job against linkinator exit-13 crash#59

Merged
jdevalk merged 1 commit into
mainfrom
fix/linkinator-exit-13-flake
Jun 25, 2026
Merged

fix(ci): harden links job against linkinator exit-13 crash#59
jdevalk merged 1 commit into
mainfrom
fix/linkinator-exit-13-flake

Conversation

@jdevalk

@jdevalk jdevalk commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Fixes #58.

Problem

The Internal links check flakes with exit code 13 ("unsettled top-level await"). linkinator@6's CLI runs await main() at the top level; on newer Node the event loop can empty while that await is still pending, aborting the crawl right after fetching / — before it recurses into any other page. The result is a false-red run that blocks PR merges (seen on #56), even though the content scans clean.

Both local and CI currently resolve linkinator@6 to the same 6.3.0, so this is a genuine timing race, not a version-specific bug — pinning alone wouldn't stop the current flake.

Fix

Two layers, applied to both jobs in links.yml:

  1. Pin the exact version (linkinator@6.3.0) so an upstream 6.x patch can't silently shift the behaviour underneath us.
  2. Retry only on the exit-13 crash (up to 3 attempts). The crash is cleanly distinguishable from a real finding: linkinator exits 1 for genuine broken links, so those still fail the job immediately with no retry — no risk of masking real rot.

Verified the loop logic locally: an exit-13-then-0 sequence recovers and passes; an exit-1 broken-link finding fails on the first attempt without retrying.

🤖 Generated with Claude Code

linkinator@6's CLI runs `await main()` at the top level; on newer Node the
event loop can empty while that await is pending, aborting the crawl with
exit 13 ("unsettled top-level await") after fetching only /. That's a tooling
crash, not a broken link, producing false-red Internal links runs that block
PRs.

Pin the exact version (6.3.0) so an upstream 6.x patch can't silently shift
the behaviour, and wrap the invocation in a retry that fires *only* on exit
13 — real broken-link findings exit 1 and still fail the job immediately.
Applied to both the internal (blocking) and external (daily) jobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying specification-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: f28d39c
Status: ✅  Deploy successful!
Preview URL: https://97e5510b.specification-website.pages.dev
Branch Preview URL: https://fix-linkinator-exit-13-flake.specification-website.pages.dev

View logs

@jdevalk jdevalk merged commit 726f932 into main Jun 25, 2026
8 checks passed
@jdevalk jdevalk deleted the fix/linkinator-exit-13-flake branch June 25, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: "Internal links" job flakes — linkinator@6 crashes with exit 13 ("unsettled top-level await")

1 participant