Skip to content

ci: add a maintainer override for Lychee HTTP 429 failures - #3155

Merged
rwgk merged 3 commits into
mainfrom
rwgk/lychee-maintainer-429-override
Oct 20, 2026
Merged

rwgk merged 3 commits into
mainfrom
rwgk/lychee-maintainer-429-override

Conversation

@rwgk

@rwgk rwgk commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Highlights

Give maintainers a narrow way to unblock a PR when external sites keep returning HTTP 429 rate limits after Lychee exhausts its retries. The ci: lychee-non-blocking label applies to both authored and rendered documentation checks.

  • Accept only rate limits: every remaining failure must be an HTTP 429 response from an external HTTP(S) URL. Mixed failures still block.
  • Keep the evidence: Lychee still runs and retries. Warnings and retained reports identify the URLs that remain unverified.
  • Preserve other checks: hook setup, report validation, offline smoke checks, and other pre-commit hooks remain blocking.
  • Use the current decision: jobs query the PR's current labels, so a rerun picks up an added or removed override. Lookup failures retry before falling back to the normal policy with a warning.

This follows the rate-limit discussion in #3142. #3142 is merged; this now targets main and starts the remaining review stack: #3155 → #3143 → #3147. The override is separate from #3143's checkout-aware link feature; each can be reviewed on its own merits.

Policy and tradeoffs

The proposed explicit override has no URL-count limit. Applying the label accepts the remaining rate-limited URLs as unverified, with the decision visible in warnings and reports. Failed checks are never cached as successes.

All other failures still block, including missing files or rendered anchors, timeouts, HTTP 403/404/5xx responses, and mixtures of those failures with 429s. Missing or invalid reports and hook execution errors also remain errors. Other exceptional failures continue to require the normal admin-merge decision.

Label lookup uses up to three attempts, with 5- and 10-second delays between attempts. If the API keeps failing or returns an unexpected response, the job warns and uses its normal policy; it never applies the override without confirming the label.

Without a confirmed label, authored checks remain strict and rendered checks retain their existing allowance for at most ten distinct HTTP 429 URLs. Local checks, default-branch checks, and nightly cache production keep their existing policies.

Using the override

  1. Inspect the failure reports and apply ci: lychee-non-blocking to the affected PR.
  2. Rerun the affected Linux/Windows pre-commit jobs or rendered-documentation job.

Adding or removing the label does not itself trigger CI. Each job reads current labels when it runs. If lookup retries are exhausted, the warning asks the maintainer to rerun to apply the override. Under the override, the report-based Lychee result becomes the final link gate; the subsequent full pre-commit invocation runs all remaining hooks once, even if that link gate fails. Its failure still keeps the job red.

Suggested review order

  1. Failure policy, then CLI selection: add the explicit allow-429 policy while retaining report validation and retries.
  2. Shared link-check action, pre-commit workflow and rendered-docs workflow: callers supply an optional pr-number; the action handles fresh label lookup and selects the policy. Its allow-429 output lets the authored workflow avoid a duplicate strict Lychee invocation when the override is active. Calls without a PR number do not query labels.
  3. CI guide and focused tests: operational guidance and coverage for accepted rate limits and failures that must remain blocking.

Validation

  • All 220 CI-tool tests and 36 subtests passed locally on the rebased revision, including both documentation modes, retries, mixed failures, malformed reports, and setup errors.
  • Local probes executed the action's actual lookup script in 11 cases, covering absent/present labels, API failures, retry recovery, malformed responses, and calls without a PR number. Policy and hook selection were checked alongside 36 combinations of job state and cancellation.
  • pre-commit run --all-files passed, including authored Lychee checks and workflow linting.

Full CI requested for this revision. The local workflow probes use simulated label responses; they do not establish hosted execution of the override on GitHub.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@rwgk rwgk added this to the cuda.bindings next milestone Oct 19, 2026
@rwgk rwgk added enhancement Any code-related improvements CI/CD CI/CD infrastructure labels Oct 19, 2026
@rwgk rwgk self-assigned this Oct 19, 2026
@rwgk
rwgk requested a review from juenglin October 19, 2026 19:30
@rwgk
rwgk marked this pull request as draft October 19, 2026 19:34
@copy-pr-bot

copy-pr-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rwgk

rwgk commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

I cancelled the CI and converted to draft only to not wast runner time. I'll merge #3142 first, then run the CI here against the new main.

@juenglin

Copy link
Copy Markdown
Contributor

Suggestion: make the PR label fetch more fault tolerant.

The "Read the PR's Lychee rate-limit override" step (in pre-commit.yml and build-docs.yml) runs on every PR push. If gh pr view hits a transient API error, the step fails the job, even for PRs that never use the override. In pre-commit.yml it also skips the later steps, so formatter results are hidden.

Without the label, the safe fallback is the strict default policy. So a failed lookup could retry a few times, then warn and fall back to strict instead of failing:

allow_429=false
lookup_ok=false
for attempt in 1 2 3; do
  # A command in an if condition is exempt from `set -e`.
  if result="$(gh pr view "$PR_NUMBER" --json labels \
      --jq '.labels | any(.name == "ci: lychee-non-blocking")')"; then
    allow_429="$result"
    lookup_ok=true
    break
  fi
  sleep $((attempt * 5))
done
if [[ "$lookup_ok" != true ]]; then
  echo "::warning::Could not read PR labels; using the strict link policy. Rerun to apply ci: lychee-non-blocking."
elif [[ "$allow_429" == true ]]; then
  echo "::notice::ci: lychee-non-blocking permits only HTTP 429 failures after retries."
fi
echo "allow-429=$allow_429" >> "$GITHUB_OUTPUT"

Effect:

  • An API blip with no label no longer adds a red check; the job continues with a warning.
  • An API blip with the label present falls back to strict, so the override is never applied silently. If a 429 then fails the check, the warning tells the maintainer to rerun.
  • Later steps still run, so formatter results stay visible.

ci/README.md would then say that a failed label lookup falls back to the strict default with a warning, instead of "failed label lookups remain blocking".

Optional: the lookup could move into the composite action behind a pr-number input, to avoid repeating the script in two workflows.

Base automatically changed from rwgk/lychee-pre-commit-ci to main October 19, 2026 22:20
rwgk added 2 commits October 19, 2026 15:20
Read current PR labels for authored and rendered checks. The explicit override accepts only HTTP 429 failures after retries, retaining reports and all other blocking checks. Normal policies remain unchanged.

Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
LYCHEE_ARGS belonged to the removed rerun path and is no longer read. Keep this cleanup separate from the maintainer HTTP 429 override, as requested in review.

Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
@rwgk
rwgk force-pushed the rwgk/lychee-maintainer-429-override branch from 2e90ecf to 7f14d10 Compare October 19, 2026 22:20
Read current PR labels once in the shared composite action. Retry failed or malformed lookups three times with 5/10-second delays, then warn and retain the normal link policy. An unconfirmed label never enables the override.

Expose the early label decision to the authored pre-commit job so other hooks still run after an ordinary labeled link failure. Nightly and default-branch calls do not query PR labels.

Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
@rwgk

rwgk commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b7b4f2f

@github-actions

Copy link
Copy Markdown
Contributor

@rwgk

rwgk commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Suggestion: make the PR label fetch more fault tolerant.

Done in commit b7b4f2f. Thanks for catching this!

@rwgk
rwgk marked this pull request as ready for review October 19, 2026 23:38
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 239da395-9c95-476c-b01d-fdf94d0d57da
📥 Commits

Reviewing files that changed from the base of the PR and between b1c2d2f and b7b4f2f.

📒 Files selected for processing: 8
  • .github/actions/lychee-links/action.yml
  • .github/workflows/build-docs.yml
  • .github/workflows/pre-commit.yml
  • ci/README.md
  • ci/tools/retry_lychee.py
  • ci/tools/run_lychee_precommit.py
  • ci/tools/tests/test_retry_lychee.py
  • ci/tools/tests/test_run_lychee_precommit.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved documentation link checks for rate-limited responses.
    • Pull requests with the designated maintainer override can continue with warnings when all remaining external failures are HTTP 429 rate limits.
    • Other link failures remain blocking, and lookup errors retain the default behavior.
    • Added retries and clearer reporting for rate-limit handling.
  • Documentation

    • Documented the maintainer override, retry behavior, and conditions under which rate-limited checks may pass.

The Lychee link-check flow adds an allow-429 policy for HTTP 429-only failures. Pull-request workflows can select it through the ci: lychee-non-blocking label. Tests and CI documentation cover the policy and its use.

Changes: Lychee HTTP 429 maintainer override

Layer / File(s) Summary
Add and validate the allow-429 retry policy
ci/tools/retry_lychee.py, ci/tools/run_lychee_precommit.py, ci/tools/tests/*
The retry implementation and CLI accept allow-429. Tests cover rate-limit-only failures, other failure types, retry attempts, and reports.
Resolve the label and wire workflow checks
.github/actions/lychee-links/action.yml, .github/workflows/build-docs.yml, .github/workflows/pre-commit.yml, ci/README.md
The action reads the pull-request label and selects the policy. Workflows pass pull-request numbers and handle allowed Lychee failures. The CI documentation describes the override.

Suggested reviewers: juenglin, mdboom

Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to b7b4f

The change adds a narrow maintainer override for HTTP 429 link-check failures while other failures still block. No merge-blocking risk is evident from the supplied change.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@rwgk
rwgk merged commit b1e2788 into main Oct 20, 2026
219 of 221 checks passed
@rwgk
rwgk deleted the rwgk/lychee-maintainer-429-override branch October 20, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure enhancement Any code-related improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants