Repository navigation
Verify test-quarantine Source B PRs via batched GraphQL - #67115
Merged
wtgodbe merged 2 commits intoJun 10, 2026
Merged
Conversation
The daily test-quarantine workflow keeps tripping the 25M effective-tokens rail. The dominant cost in the 2026-06-09 failure was Source B's PR verification: the agent made 71 sequential pull_request_read MCP calls (one per unique PR) to check base branch and merged status. Because every turn re-sends the whole conversation, that per-PR loop dominates token usage, especially when CI flakiness inflates the unique-PR count. Rework Source B (prompt-only, runtime-imported — no lockfile recompile): - Apply the B4 failed-build filter BEFORE any GitHub call, using Azure DevOps build data already in hand. A PR with no failed/partial build can never qualify, so this correctness-preserving prefilter shrinks the set to verify from dozens to a handful. - Verify B2/B3 for the surviving PRs with a single batched GraphQL request per ~50 PRs (verify_prs helper) instead of one MCP call per PR, collapsing ~71 turns into ~1-2. baseRefName/merged/headRefOid map to REST base.ref/merged/ head.sha; headRefOid feeds the B1 SHA match. - The helper is fail-closed (exclude any PR it cannot positively verify) and fail-loud on systemic failures (missing token, 401/403, primary rate-limit, or every request failing) so the run aborts visibly rather than silently reporting a false 'no failures'. Handles GraphQL partial errors and nulls. - Print only the aggregated per-test table; never surface raw JSON. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the test-quarantine workflow instructions to reduce effective-token usage and CI flakiness impact by eliminating per-PR pull_request_read loops for Source B, replacing them with prefiltering plus batched GitHub GraphQL verification.
Changes:
- Prefilter Source B PR candidates using Azure DevOps build results (failed/partiallySucceeded) before any GitHub verification.
- Replace per-PR verification with a batched GraphQL approach and document fail-closed / fail-loud behavior.
- Add a
verify_prsPython helper example in the API Reference section.
Comment on lines
+635
to
+639
| path = err.get("path") or [] | ||
| if path and isinstance(path[-1], str) and path[-1].startswith("p"): | ||
| errored.add(path[-1]) | ||
| else: | ||
| chunk_untrusted = True |
Member
Author
There was a problem hiding this comment.
Good catch — fixed in 9938ed6. Now scans the whole error path for the first element matching the alias pattern p{n} (so field errors like ["repository","p123","merged"] exclude only that PR), and only treats a path with no alias as chunk-untrusted. Verified with an added unit-test scenario: a field-level error on one PR in a chunk now keeps the other PRs in that chunk.
GraphQL field errors put the alias in the middle of the error path
(e.g. ["repository","p123","merged"]), so checking only path[-1] marked
the whole chunk untrusted and over-excluded valid PRs. Scan the path for the
first element matching the alias pattern p{n} and exclude just that PR.
Co-authored-by: Copilot <[email protected]>
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.
Follow-up to #67085. The daily
test-quarantineworkflow keeps tripping the 25M effective-tokens rail. In the most recent failure the dominant cost was Source B's PR verification: the agent made ~71 sequentialpull_request_readMCP calls (one per unique PR) to check base branch and merged status. Because every inference turn re-sends the whole conversation, that per-PR loop dominates token usage — and CI flakiness inflates the unique-PR count.Prompt-only change to
.github/workflows/test-quarantine.md(runtime-imported, so no lockfile recompile):failed/partiallySucceededbuild (using Azure DevOps data already in hand) before any GitHub call. Correctness-preserving (such PRs can never qualify) and shrinks the set to verify from dozens to a handful.verify_prshelper that verifies B2/B3 for ~50 PRs per single GraphQL request (~71 turns → ~1–2).baseRefName/merged/headRefOidmap to RESTbase.ref/merged/head.sha;headRefOidfeeds the B1 SHA match.The
verify_prshelper was validated offline against 8 scenarios (happy path, partial errors, and every fail-loud/fail-closed branch).GITHUB_TOKENis available to the agent andapi.github.comis firewall-allowed.