Skip to content

Handle GitHub reaction rate limits gracefully - #58610

Merged
pelikhan merged 3 commits into
mainfrom
copilot/handle-github-rate-limiting-errors
Sep 4, 2026
Merged

Handle GitHub reaction rate limits gracefully#58610
pelikhan merged 3 commits into
mainfrom
copilot/handle-github-rate-limiting-errors

Conversation

Copilot AI commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

GitHub reaction requests can return 403 when API rate limits are exhausted. These transient failures currently fail workflow activation.

Changes

  • Error handling
    • Detect rate-limit errors in standalone and combined reaction paths.
    • Emit a warning and continue instead of failing the workflow.
  • Failure isolation
    • Preserve existing failures for permission errors and unrelated API failures.
    • Retain non-fatal handling for locked resources.
  • Coverage
    • Add regression cases for rate-limited reaction requests.

Copilot AI and others added 2 commits September 4, 2026 21:06
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan September 4, 2026 21:16
@pelikhan
pelikhan marked this pull request as ready for review September 4, 2026 21:21
Copilot AI balanced review requested due to automatic review settings September 4, 2026 21:21
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed: PR does not have the implementation label and has ≤100 new lines of code in business logic directories.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer failed. Please review the logs for details.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by Ponytail Reviewer for #58610

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Completed PR review with one blocking comment and submitted overall review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /codebase-design — small, well-scoped fix for GitHub reaction rate-limit 403s, mirrored across both reaction paths with matching regression tests.

📋 Key Themes & Highlights

Key Themes

  • Scope question: in add_reaction_and_edit_comment.cjs, the isRateLimitError check sits in the shared try/catch covering both the reaction call and the subsequent comment-edit call, so a rate-limit-shaped failure from the comment-edit step would also be downgraded to a warning — unlike add_reaction.cjs where the check is scoped only to the reaction handler. Worth confirming this is intentional.

Positive Highlights

  • ✅ Reuses the existing isLockedError pattern consistently for the new isRateLimitError check
  • ✅ Regression tests added for both call sites, asserting core.warning fires and core.setFailed does not
  • error_helpers.cjs centralizes the rate-limit detection logic with clear docstring

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 22.7 AIC · ⌖ 15.6 AIC · ⊞ 10.3K
Comment /matt to run again

return;
}
const errorMessage = getErrorMessage(error);
if (isRateLimitError(error)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] This isRateLimitError check sits in the outer try/catch that wraps both the reaction call and the subsequent addCommentWithWorkflowLink call. A rate-limited comment-edit failure will now also be silently downgraded to a warning, not just a rate-limited reaction — is that the intended scope, or should the rate-limit check be scoped to the reaction step only (mirroring add_reaction.cjs, where it only guards handleReactionError)?

💡 Why it matters

If a genuinely important comment-edit failure (e.g. workflow-run link update) starts throwing a rate-limit-shaped error message, it would now fail silently with only a warning instead of setFailed, which could mask a real issue for maintainers monitoring workflow health. The existing test only exercises the reaction-request path (mockGithub.request.mockRejectedValueOnce), so this broader catch scope is untested.

@copilot please address this.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The classifier misses common status-, header-, and secondary-rate-limit response shapes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Handles reaction API rate-limit failures without blocking workflow activation.

Changes:

  • Adds non-fatal warning handling for recognized rate limits.
  • Preserves locked-resource and unrelated-error behavior.
  • Adds regression tests for installation rate limits.
File summaries
File Description
actions/setup/js/add_reaction.cjs Handles recognized reaction rate limits.
actions/setup/js/add_reaction.test.cjs Tests standalone rate-limit handling.
actions/setup/js/add_reaction_and_edit_comment.cjs Handles recognized combined-path rate limits.
actions/setup/js/add_reaction_and_edit_comment.test.cjs Tests combined-path rate-limit handling.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Balanced

return;
}
const errorMessage = getErrorMessage(error);
if (isRateLimitError(error)) {
return;
}
const errorMessage = getErrorMessage(error);
if (isRateLimitError(error)) {
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-09-04T21:24:43.818+00:00
review_event: REQUEST_CHANGES
top_themes:
  - rate-limit detection boundary is under-specified
files_reviewed:
  - actions/setup/js/add_reaction.cjs
  - actions/setup/js/add_reaction.test.cjs
  - actions/setup/js/add_reaction_and_edit_comment.cjs
  - actions/setup/js/add_reaction_and_edit_comment.test.cjs
  - actions/setup/js/error_helpers.cjs
  - actions/setup/js/error_helpers.test.cjs
comment_count: 1

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 17.9 AIC · ⌖ 7.41 AIC · ⊞ 23.5K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes

The new fail-open path for reaction writes is reasonable, but this PR still needs a tighter contract around what gets downgraded to a warning. Right now the changed code relies entirely on message text matching for rate-limit detection, so any future GitHub error shape drift here turns into either a silent false negative or a silently swallowed real failure.

Blocking theme

The implementation only proves the happy-path wording for one installation rate-limit message. These scripts are handling workflow activation side effects, so the downgrade path needs tests that lock down the exact boundary between transient throttling and real 403/API failures across both REST and GraphQL call sites.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 17.9 AIC · ⌖ 7.41 AIC · ⊞ 23.5K
Comment /review to run again

Comments that could not be inline-anchored

actions/setup/js/add_reaction.cjs:18

This downgrade path is only guarded by free-form message matching, so a GitHub error wording change can flip a real API failure into a warning or start failing genuine throttling again without any test catching it.

<details><summary>💡 Tighten the contract</summary>

The new behavior is intentionally fail-open, which makes boundary coverage more important than before. Please add table-driven coverage around isRateLimitError for the concrete response shapes you expect from both REST and Graph…

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator
pr-sous-chef

@copilot Please take the next forward-progress pass on this PR.

  • Copilot review and code-quality feedback both point at the same gap: tighten the rate-limit downgrade contract so only genuine throttling shapes are swallowed, and add regression coverage that locks down the accepted REST/GraphQL error variants.
  • Please address the outstanding review comments, rerun the relevant tests, and then run the pr-finisher skill before handing back to maintainers.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 31.1 AIC · ⌖ 8.7 AIC · ⊞ 9K ·
Comment /souschef to run again

@pelikhan
pelikhan merged commit a627c51 into main Sep 4, 2026
1 of 2 checks passed
@pelikhan
pelikhan deleted the copilot/handle-github-rate-limiting-errors branch September 4, 2026 22:02
Copilot stopped work on behalf of gh-aw-bot due to an error September 4, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants