Skip to content

Clarify GitHub API quota failures and reset diagnostics - #68737

Merged
pelikhan merged 2 commits into
mainfrom
pelikhan-github-quota-failure-diagnostics
Oct 14, 2026
Merged

pelikhan merged 2 commits into
mainfrom
pelikhan-github-quota-failure-diagnostics

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Why

Installation API quota failures currently obscure which request failed and can be confused with authentication failures or daily AI Credits overruns. Failure Investigator stopped on its first business API request with 0 of 15,000 requests remaining; PR Sous Chef failed fetching a review despite a separate client's healthy quota precheck. Neither observation establishes avoidable excessive consumption by the failed operation.

Approach

  • Derive secret-safe diagnostics from the failed business response, distinguishing exhausted quota, protective reserve stops, other rate limits, authentication failures, and permission denials.
  • Report validated quota counts, resource, UTC reset, and earliest retry constraints, with unknown values when evidence is absent. Invalid reset metadata cannot mask the original failure.
  • Identify the stopped daily AIC read and attempt count in restore logs and a step summary; retain the E099 PR/review boundary for review-fetch failures and include precise diagnostics in guardrail errors.
  • Classify headerless installation/secondary rate limits as quota failures so they cannot enter accounting-estimate fallback. Treat Retry-After presence as a restriction even when its deadline is zero or expired.

Credentials, actor-bound review validation, daily credit accounting, quota reserves, and retry bounds remain unchanged. No workflow sources, generated locks, or PR Sous Chef prefilter credential bindings changed. Shared installation quota remains an infrastructure limit; reset timestamps do not guarantee available capacity or schedule automatic retries.

Validation

  • Final make agent-report-progress passed build, typecheck, scoped lint, and 247 impacted JavaScript tests.
  • Broader focused validation passed 299 tests across seven suites, including artifact-client and daily AIC specification coverage.
  • make fmt-cjs and make lint-cjs passed. Seven pre-existing warnings on untouched lines remain; the new diagnostic helper is warning-free.
  • Read-only security review passed for the final revision with no confirmed vulnerabilities.
  • No workflow dispatches, reruns, cancellations, or live API tests were performed.

Distinguish exhausted and reserved API quota from authentication failures using failed-response metadata. Keep daily accounting fail-closed and review dismissal actor validation unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 14, 2026 15:33
Copilot AI balanced review requested due to automatic review settings October 14, 2026 15:33
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · 8.5 AIC · ⌖ 5.22 AIC · ⊞ 14.3K · ◷

Generated by Ponytail Reviewer for #68737

@github-actions

github-actions Bot commented Oct 14, 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 Oct 14, 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.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · opus50 · 13.5 AIC · ⌖ 40.3 AIC · ◇ 35.5 AIC · ⊞ 1.8K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · haiku45 · 4.2 AIC · ⌖ 8.84 AIC · ◇ 1.66 AIC · ⊞ 8.8K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-14T15:36:28.829+00:00
review_event: REQUEST_CHANGES
top_themes:
  - wrapped error diagnostics miss cause chains
  - 403 quota diagnostics can mask permission failures
files_reviewed:
  - actions/setup/js/check_daily_aic_workflow_guardrail.cjs
  - actions/setup/js/daily_aic_api_budget.cjs
  - actions/setup/js/dismiss_pull_request_review.cjs
  - actions/setup/js/github_api_diagnostics.cjs
  - actions/setup/js/restore_aic_scan_cache.cjs
comment_count: 2

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
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 · 40.9 AIC · ⌖ 5.8 AIC · ⊞ 21.3K · ◷
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 diagnostics are moving in the right direction, but two regressions here still break the failure reporting this patch is trying to improve: wrapped artifact quota failures never pick up the new diagnostic, and plain permission 403s can be mislabeled as quota exhaustion when x-ratelimit-remaining happens to be zero.

Blocking themes
  • Wrapped artifact_client failures are not unwrapped before deriving diagnostics, so restore and guardrail errors still lose quota_exhausted and retry_not_before context on artifact redirect and download paths.
  • remaining === 0 is being treated as a sufficient signal for rate limiting on every 403, which overwrites genuine permission failures with the wrong classification.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 40.9 AIC · ⌖ 5.8 AIC · ⊞ 21.3K
Comment /review to run again

Comment thread actions/setup/js/github_api_diagnostics.cjs
Comment thread actions/setup/js/github_api_diagnostics.cjs Outdated

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

Malformed Retry-After values can be accepted, and some restore failures omit the promised step summary.

2 open findings
What changed in this PR

Adds secret-safe GitHub API quota diagnostics to distinguish quota, authentication, permission, and rate-limit failures.

Changes:

  • Introduces validated quota metadata and failure classifications.
  • Adds restore summaries and review-fetch diagnostics.
  • Expands documentation and test coverage.
File Description
docs/​src/​content/​docs/​reference/​rate-limiting-controls.md Documents quota diagnostics.
actions/​setup/​js/​restore_aic_scan_cache.cjs Reports restore failures.
actions/​setup/​js/​github_api_diagnostics.cjs Implements diagnostic parsing.
actions/​setup/​js/​github_api_diagnostics.test.cjs Tests diagnostic behavior.
actions/​setup/​js/​dismiss_pull_request_review.cjs Adds review-fetch diagnostics.
actions/​setup/​js/​dismiss_pull_request_review.test.cjs Tests review failure classifications.
actions/​setup/​js/​daily_aic_scan.test.cjs Tests restore summaries.
actions/​setup/​js/​daily_aic_api_budget.cjs Integrates quota metadata.
actions/​setup/​js/​daily_aic_api_budget.test.cjs Tests quota handling.
actions/​setup/​js/​check_daily_aic_workflow_guardrail.cjs Adds guardrail diagnostics.
actions/​setup/​js/​check_daily_aic_workflow_guardrail.test.cjs Tests guardrail messages.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/setup/js/github_api_diagnostics.cjs Outdated
Comment thread actions/setup/js/restore_aic_scan_cache.cjs Outdated

@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 /diagnosing-bugs on the new github_api_diagnostics.cjs module. Requesting changes: a real classification bug where the exact scenario this PR aims to clarify (a protective-reserve stop on HTTP 403 with non-zero remaining quota) gets mislabeled permission_denied instead of quota_reserve, and the gap isn't covered by the new tests.

📋 Key Themes & Highlights

Key Themes

  • Classification precedence bug: in getGitHubAPIDiagnostic, the status === 403 && !limited ? "permission_denied" branch runs before the quota ? ... : quotaStopped ... branch is reached, so a DAILY_AIC_QUOTA_STOP failure at HTTP 403 with non-zero remaining is reported as permission_denied even though quota: true. This directly undermines the PR's goal of distinguishing reserve stops from permission failures — see inline comment on actions/setup/js/github_api_diagnostics.cjs:46.
  • Test coverage gap: existing tests for the quotaStopped+permission_denied interaction only use x-ratelimit-remaining: "100" with status 401/403 and no response headers set beyond that in one case, but don't specifically assert the 403+non-zero-remaining+quota_stop path produces quota_reserve. The triage above is the regression test that should be added.

Positive Highlights

  • ✅ Careful secret-safety discipline throughout: header values are strictly validated (regex + Number.isSafeInteger), and tests explicitly assert that raw payloads/URLs/auth headers never leak into diagnostic messages.
  • ✅ Good separation of concerns: getGitHubAPIQuota (pure header parsing) vs getGitHubAPIDiagnostic (classification) is a clean, testable split.
  • ✅ Solid regression coverage for malformed/overflow header values (Infinity, 1e300, 9999999999999999, etc.) and for retry/reset deadline precedence.
  • ✅ Consistent, minimal integration across daily_aic_api_budget.cjs, check_daily_aic_workflow_guardrail.cjs, restore_aic_scan_cache.cjs, and dismiss_pull_request_review.cjs — each call site reuses the shared helper rather than reimplementing classification logic.

@copilot please address the review comments above.

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

Comment thread actions/setup/js/github_api_diagnostics.cjs Outdated
Address review feedback with bounded cause traversal, sanitized access-failure evidence, HTTP-date Retry-After validation, and summaries for every attributed restore read failure.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan merged commit e768cb1 into main Oct 14, 2026
51 checks passed
@pelikhan
pelikhan deleted the pelikhan-github-quota-failure-diagnostics branch October 14, 2026 16:28
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.

2 participants