Skip to content

fix(pr-pipeline): wait out a lane token 503 github-rate-limited - #7958

Merged
kyle-sexton merged 3 commits into
mainfrom
fix/lane-token-wait-rate-limited
Oct 18, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
fix/lane-token-wait-rate-limited

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: melodic-software/azure-iac#34

Summary

The lanes broker (azure-iac#35) now has two
new 503 answers. github-rate-limited comes before any reservation and carries GitHub's wait as a
Retry-After header (1-3600 s), with limit, resource and retry_after in the body.
mint-unavailable comes after the job's one mint reservation, so no retry can redo it.
request-lane-token now handles both.

Fix

  • .github/actions/request-lane-token/action.yml: the retry loop from
    #7944 also retries
    github-rate-limited. That retry waits exactly Retry-After (a minute when the header is
    missing) plus 0-20 s of jitter, with the jitter cut so the wait ends inside the budget. The
    backoff ladder is not used for it. If elapsed time plus Retry-After would pass the 8-minute
    budget, the step fails at once, with no sleep, and names the limit kind, the resource and the
    reset time. mint-unavailable is never retried, and its failure ends final: the broker had reserved this job's one mint, so no retry can mint it.
  • The action README, the broker status table in docs/conventions/pr-pipeline/pr-run-activity.md
    (now listing github-rate-limited as 503, Retry-After, retryable, and mint-unavailable as 503,
    final), and pr-pipeline CHANGELOG 2.8.2.

Basis: GitHub REST rate limits, Exceeding the rate limit:
"If the retry-after response header is present, you should not retry your request until after
that many seconds has elapsed", and otherwise "wait for at least one minute before retrying".

Verification

  • Wrote six new tests in request-lane-token.test.mjs first and watched all six fail on the old
    script. They cover: the wait is Retry-After plus jitter, not the ladder; three retries then red;
    no header means a minute; a 470 s wait fits the budget; a 481 s wait fails at once, with the
    reset time checked against the test's clock; mint-unavailable is final. After the fix,
    node --test passes 45 of 45.
  • actionlint clean; zizmor --offline on the action and pr-run-activity-write.yml: no
    findings; shellcheck on the extracted run script clean; markdownlint clean on the three docs.

Related

  • #7944: the
    github-unavailable retry this extends.
  • azure-iac#35: the broker change that
    adds the two answers.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits October 17, 2026 23:46
The lanes broker now answers 503 github-rate-limited, with GitHub's wait
as Retry-After, before it reserves a mint, and 503 mint-unavailable after
the reservation. request-lane-token retries github-rate-limited after
exactly its Retry-After plus up to 20 s of jitter, fails at once naming
the limit kind and reset time when that wait would pass the 8-minute
budget, and never retries mint-unavailable, whose failure now says it is
final.

Basis: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api#exceeding-the-rate-limit
(do not retry before retry-after or x-ratelimit-reset has passed).

Refs: melodic-software/azure-iac#34

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…absent

A github-rate-limited answer with no Retry-After header waits the
one-minute default, so the budget failure no longer calls that time
GitHub's reset. Note that the limit and resource allowlists are the only
barrier between broker text and the ::error:: command.

Refs: melodic-software/azure-iac#34

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 18, 2026 03:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T03:51:12.629523Z 289b662 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed e059d63ca6fe4f424265e967a940a461b6c7c622: 0 finding(s), 0 as inline comments.

No security findings in PR #7958 at head e059d63.

The PR changes the request-lane-token composite action, its test, README and docs. I reviewed the diff for logic and trust-boundary issues. Actions-hardening categories (triggers, permissions, pins) are zizmor's lane and the diff doesn't touch them.

  • Broker text reaching workflow commands: The new github-rate-limited failure path adds broker-supplied fields to the ::error:: message and $GITHUB_OUTPUT. Each is allowlisted before use: reason must match ^github-(unavailable|rate-limited)$ for the retry, or ^[a-z]+(-[a-z]+)*$ for the final message; limit must be primary or secondary, else unknown; resource must match ^[a-z_]{1,40}$, else it is dropped. The reset time is computed locally with jq now + $delay, not taken from the broker. detail still goes through the existing one_line sanitizer. Bash =~ anchors only match at end of string, so an embedded newline can't slip a value past them.
  • Retry-After arithmetic: The awk filter accepts only digit-only values of at most 6 characters and normalizes them with + 0. That rules out octal parsing and arithmetic injection. A wait that would end past the 480 s budget fails immediately rather than sleeping, so a hostile header can't hold a runner. The jitter clamp can't go negative on that path.
  • Token minting: mint-unavailable is no longer retried; only 503s that come before the broker reserves the job's mint are. Each retry takes a fresh OIDC token. There is no new path to a second mint, and no token or OIDC value is logged. The existing masking and unset oidc are unchanged.
  • Instruction surfaces: The diff deletes or softens no standing instruction, rule, hook allowlist or deny list. The docs and CHANGELOG edits only describe the new retry behavior. I did not read the instruction exception register because nothing in the diff removes an instruction.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed e059d63ca6fe4f424265e967a940a461b6c7c622: 0 finding(s), 0 as inline comments.

No blocking findings. I read the full diff and the PR context, and grepped action.yml and the test file for variable collisions and the BUDGET and JITTER constants. I did not run the tests or the script, so the author's "45 of 45" and lint claims are unverified here.

What I checked by reading:

  • Retry loop (action.yml, rate-limited branch):
    • The 8-minute budget check runs before any sleep.
    • The jitter cut can't go negative, because the budget check already guarantees budget - elapsed - delay >= 0.
    • A Retry-After of 0 and an absent header are both handled (${after:-60}).
    • Broker text reaches the ::error:: line only through the anchored allowlists for limit and resource. delay is digits-only, so passing it to jq --argjson is safe.
  • Last answer inside 9.5 minutes: a retry starts at most 480 s after the first request, then adds the 30 s OIDC timeout and the 60 s broker timeout, which gives 570 s. That holds, so the comment is accurate.
  • Failure-message cleanup: the generalised retried rule drops the "after 503 …" suffix only when the final answer has the same reason as the earlier retried 503. Other combinations still name the earlier 503.
  • mint-unavailable: it is excluded from the retry regex, so it fails final with the explanatory suffix.
  • Tests: they cover the ladder versus Retry-After, exhaustion after three retries, a missing header, jitter cut to fit the budget, failing at once past the budget with the reset time checked against the clock, and mint-unavailable being final.

Not blocking:

  • The PR body says "CHANGELOG 2.8.2", but the changelog entry is 2.9.1, which follows the existing 2.9.0. The body is stale; the file is right.
  • A mint-unavailable 503 with an empty detail would produce a message that starts ; final: …. This is cosmetic only.
  • The closing-issue criteria don't apply. The PR uses Refs: for a cross-repo issue, and no closing-issue section is in the context file.

@kyle-sexton
kyle-sexton enabled auto-merge October 18, 2026 04:00
@kyle-sexton
kyle-sexton disabled auto-merge October 18, 2026 04:00
…ate-limited

# Conflicts:
#	docs/conventions/pr-pipeline/CHANGELOG.md
@melodic-automation-lanes melodic-automation-lanes Bot added the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 18, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

The pr-unblock lane stopped on this pull request and needs a person: the merge stages a change under .github/workflows/, which the lane does not push.

  • Reason: workflow-staged
  • Resume key: e059d63ca6fe4f424265e967a940a461b6c7c622 (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=7958 and activity=resolve-conflicts:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=7958 -f activity=resolve-conflicts

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit 850aff1 Oct 18, 2026
51 of 52 checks passed
@kyle-sexton
kyle-sexton deleted the fix/lane-token-wait-rate-limited branch October 18, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant