You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Read retry history with fewer GitHub requests - #840
The PR latency report requests job records separately for each retry. This spends API quota when a workflow has several attempts.
What changed
Use one combined listing for retried runs. Fall back to exact attempts when the listing cannot account for the observed history. Keep the final verdict and the first failed verdict tied to the same workflow snapshot.
How we know
The six-attempt control returns the same 18 ordered job records with one request instead of six. The focused tests cover a new attempt starting during collection and inconsistent records. All 1,502 Node and 154 Python tests passed.
No actionable comments were generated in the recent review.
Walkthrough
The change adds validated bulk retrieval of jobs across workflow run attempts. When bulk history is incomplete or inconsistent, the code fetches jobs for each attempt separately. Collection and tests use and verify this behavior.
Changes: Workflow job history retrieval
Layer / File(s)
Summary
Validate bulk history and fall back scripts/pr_latency.py, scripts/__tests__/test_pr_latency.py
jobs_by_attempt accepts bulk results only when attempts and job records pass validation. Otherwise, it fetches each attempt separately. Tests check fallback for incomplete or inconsistent results.
Use attempt jobs during collection scripts/pr_latency.py, scripts/__tests__/test_pr_latency.py
collect uses jobs_by_attempt for latest jobs and prior-attempt history. The rerun test checks the bulk request, retained failure history, and successful gate result.
sequenceDiagram
participant collect
participant jobs_by_attempt
participant JobsAPI
collect->>jobs_by_attempt: Request jobs for a workflow run
jobs_by_attempt->>JobsAPI: Request all jobs with filter=all
JobsAPI-->>jobs_by_attempt: Return attempt-tagged jobs
alt Bulk history is valid and complete
jobs_by_attempt-->>collect: Return jobs grouped by attempt
else Bulk history is invalid or incomplete
jobs_by_attempt->>JobsAPI: Request jobs for each exact attempt
JobsAPI-->>jobs_by_attempt: Return per-attempt jobs
jobs_by_attempt-->>collect: Return per-attempt jobs
end
This change reduces GitHub API requests in the latency report for retried runs and falls back to exact per-attempt reads when the combined listing is incomplete or inconsistent. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title states the main change: the PR latency report reads retry history with fewer GitHub API requests. This matches the summary, which adds jobs_by_attempt so one combined jobs listing replaces p…
Description check
The description follows the template sections: Why, What changed, How we know, and a Related Issue link. It explains the API quota problem, the single-listing approach with exact-attempt fallback, and…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title states the main change: the PR latency report reads retry history with fewer GitHub API requests. This matches the summary, which adds jobs_by_attempt so one combined jobs listing replaces per-attempt requests for rerun workflows.
Full details: Description check
Explanation
The description follows the template sections: Why, What changed, How we know, and a Related Issue link. It explains the API quota problem, the single-listing approach with exact-attempt fallback, and the test evidence. It omits the Related Issue closing reference (it links a study comment instead), the Type of Change selection, and the Checklist. The template asks for these, so they are incomplete. The core sections are complete, so the check passes.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review details
Context from checks skipped due to timeout: 5
GitHub Check: CodeRabbit
GitHub Check: Script tests (ubuntu-latest)
GitHub Check: Script tests (macos-latest)
GitHub Check: Script tests (windows-latest)
GitHub Check: Unity 6000.5.2f1 all modes
Additional context used
Ruff (0.17.4)
scripts/__tests__/test_pr_latency.py
[warning] 84-84: Unused lambda argument: a
(ARG005)
[warning] 84-84: Unused lambda argument: kw
(ARG005)
[warning] 166-166: Unused lambda argument: a
(ARG005)
[warning] 166-166: Unused lambda argument: kw
(ARG005)
[warning] 166-166: Function definition does not bind loop variable responses
Review readback for 80c4d31e: OpenAI reports zero findings, CodeRabbit approved, and the inline review thread list is empty. The CodeRabbit summary includes test-only lint notes. The mock callbacks deliberately accept unused pagination arguments, and the loop callback is invoked synchronously inside each subtest while its response fixture is in scope. No deferred callback or unresolved behavior finding remains. Normal required checks still apply.
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
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.
Why
The PR latency report requests job records separately for each retry. This spends API quota when a workflow has several attempts.
What changed
Use one combined listing for retried runs. Fall back to exact attempts when the listing cannot account for the observed history. Keep the final verdict and the first failed verdict tied to the same workflow snapshot.
How we know
The six-attempt control returns the same 18 ordered job records with one request instead of six. The focused tests cover a new attempt starting during collection and inconsistent records. All 1,502 Node and 154 Python tests passed.
Study and acceptance checks.