fix(scripts-github): stop hammering the GitHub API after an auth failure - #36563
Open
Martin Hochel (Hotell) wants to merge 2 commits into
Open
fix(scripts-github): stop hammering the GitHub API after an auth failure#36563Martin Hochel (Hotell) wants to merge 2 commits into
Martin Hochel (Hotell) wants to merge 2 commits into
Conversation
When the changelog renderer resolves PRs for a release, it calls the GitHub API once per changelog entry. If the token is expired, revoked or blocked by policy, every one of those calls fails with 401/403 - a v8 release logged 20 consecutive auth errors, and a v9 release would log ~90. The real problem (one bad token) was buried in the noise. Short-circuit after the first auth failure: the failure is logged once, and subsequent lookups skip the request and fall back to no PR link. Non-auth errors keep their existing per-entry behaviour, since those are genuinely per-PR (deleted PR, race, transient 5xx). Also exports hasGitHubAuthFailed()/resetGitHubAuthFailure() so callers can detect the degraded state, and fixes a pre-existing lint error on the type import. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Aug 12, 2026
📊 Bundle size report✅ No changes found |
|
Pull request demo site: URL |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves resiliency and log signal-to-noise in the private scripts/github helper used by release tooling by short-circuiting GitHub PR lookups after the first authentication/authorization failure, avoiding repeated failing requests and repeated stack traces during changelog generation.
Changes:
- Adds a module-level auth-failure latch to skip subsequent PR lookups after the first
401/403. - Logs a single Azure Pipelines warning (
##vso[task.logissue]) on the first auth failure and degrades gracefully by returning no PR. - Exposes
hasGitHubAuthFailed()andresetGitHubAuthFailure()and fixes a pre-existing lint issue by converting a value import to a type-only import.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/github/src/pullRequests.ts | Adds auth-failure short-circuiting, one-time warning logging, and exported helpers for detecting/resetting degraded mode. |
| scripts/github/src/index.ts | Re-exports the new auth-failure helper APIs from the package entrypoint. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…failure GitHub overloads 403: it means 'forbidden' for a bad or policy-blocked token, but also for primary and secondary rate limits. Reporting all of them as 'authentication failed' would send someone to rotate a perfectly good PAT in the middle of a release - the exact misdirection this logging exists to stop. Tell them apart via the rate-limit headers (retry-after, x-ratelimit-remaining) and handle 429 too. Both still latch, since further lookups cannot succeed either way, but the advice now matches the cause. Also renames the module-level flag: it gates requests and backs hasGitHubAuthFailed(), so 'authFailureLogged' understated what it controlled. It now records why lookups are disabled, and hasGitHubAuthFailed() reports only genuine auth failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous Behavior
When the changelog renderer resolves PRs for a release, it calls the GitHub API once per changelog entry. If the token is expired, revoked or blocked by policy, every one of those calls fails with
401/403.The v8 release on 2026-06-30 logged 20 consecutive auth errors. A v9 release would log ~90. The actual problem — one bad token — was buried in the noise, which made the failure considerably harder to diagnose than it needed to be.
New Behavior
Short-circuit after the first auth failure. The failure is logged once, and subsequent lookups skip the request and fall back to no PR link (the changelog still renders, just without links).
Non-auth errors keep their existing per-entry behavior, since those are genuinely per-PR — a deleted PR, a race, a transient
5xx— and should not disable lookups for the rest of the run.Also exports
hasGitHubAuthFailed()/resetGitHubAuthFailure()so callers can detect the degraded state, and fixes a pre-existing lint error on the type import inpullRequests.ts.Notes for reviewers
resetGitHubAuthFailure()exists so tests and long-lived processes are not stuck with a sticky module-level flag.scripts/githubis private, so no change file is required.Independent of the other two PRs in this series (#36564, #36565) — mergeable in any order. Worth noting this one stands on its own merit regardless of the others: it improves diagnosability of any future token failure.
Related Issue(s)
N/A — follow-up to the 2026-06-30 v8 release incident.