Repository navigation
fix(github): PR watches wait for required checks that have not started yet - #28200
juliusmarminge wants to merge 5 commits into
Conversation
These tests fail on main: a required status check from branch protection or a ruleset that has not started on the head commit is missing from the PR's checks, so a PR watch reports all required checks passed early. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PR watch could report every required check passed while a check the base branch requires was not on the head commit yet: an aggregate job with `needs:` only appears once it starts, and required checks were only known from `isRequired` on contexts already present. The detail read now also asks the base ref, on github.com only like `isRequired`, for branch protection's required contexts and the required status checks of active rulesets. Any required name no check on the head carries is appended as a pending required check, and the rollup reads pending unless something already failed. The >100-context path reuses the same helper, so it keeps those checks too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se rules A required check run by same-named jobs in several workflows was renamed "<Workflow> / <name>" before the presence check, so it got a phantom pending placeholder and the watch never passed. Presence now comes from the raw context names. Credentials refused baseRef.refUpdateRule or baseRef.rules would fail the whole detail read. Those selections get their own include variable, and a FORBIDDEN refusal on them (alone or with the requested-reviewer refusal) is retried once without the refused selections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…still fires Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…quired check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — PR watches now account for required checks that have not started, preventing premature completion. The change is limited to read-only status reporting and retains permission fallbacks and existing failure handling. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Required-rule query and data shapes packages/source-control-github/schema/github.graphql.ts, packages/source-control-github/src/server/pullRequestReads.graphql, packages/source-control-github/src/server/pullRequestReads.graphql.ts |
PullRequestCore conditionally reads required status-check contexts from base-ref update rules and repository rulesets. Its schemas include the corresponding rule data. |
Permission-aware query fallback packages/source-control-github/src/server/GitHubPullRequestApi.ts, packages/source-control-github/src/server/GitHubPullRequestApi.test.ts |
The detail read retries with refused optional fields disabled. Tests cover refusal of required rules, requested reviewers, and both fields together. |
Required-check conversion packages/source-control-github/src/server/gitHubPullRequestJson.ts, packages/source-control-github/src/server/gitHubPullRequestJson.test.ts, packages/source-control-github/src/server/GitHubPullRequestApi.ts, packages/source-control-github/src/server/GitHubPullRequestApi.test.ts, packages/source-control-github/src/server/GitHubPullRequestProvider.test.ts |
The conversion collects unique required check names and adds unmatched names as pending required checks when check contexts exist. Tests cover matching contexts, missing checks, empty rollups, and query pagination. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant GitHubPullRequestApi
participant GitHubGraphQL
participant toPullRequestCore
participant pullRequestChecksFromContexts
GitHubPullRequestApi->>GitHubGraphQL: Request PullRequestCore with requiredRules
GitHubGraphQL-->>GitHubPullRequestApi: Return base-ref rules and check contexts
GitHubPullRequestApi->>toPullRequestCore: Pass pull-request response
toPullRequestCore->>pullRequestChecksFromContexts: Pass contexts and requiredCheckNames
Suggested reviewers: scottn-pv, bil0000
Merge Risk: 
Low · up to 76a8b
-
The change is mergeable with awareness that PR watches may still report required checks as passed too early on branches with more than 100 applicable rules.
Pre-merge checks: 
4
-
Full details: Linked Issues check
-
Explanation
Issue
#28183requires PR watches to remain pending when a required GitHub check has not started. The change reads required check names frombaseRef.refUpdateRule.requiredStatusCheckContextsand ruleset parameters on github.com.pullRequestChecksFromContextsadds pending required checks for missing names, matches raw names, ignoresisRequired: falsenames, and preserves the empty-rollup behavior. The API applies the same helper after pagination and retainsisRequiredduring theFORBIDDENfallback. The added tests cover branch protection, rulesets, shared names, empty rollups, pagination, and fallback behavior.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within issue
#28183. Query schema updates support reading branch protection and ruleset requirements. Decoder changes create the required pending checks. API changes control the github.com gate and optional-field fallback. Tests validate the implementation. The generatedTypename.RuleParameterstype supports the added GraphQL union selection. No unrelated product behavior or client contract change is shown.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Problem
A PR watch on GitHub said "All N required checks passed" while a required check had not been created on the head yet. T3 learned which GitHub checks are required only from
isRequiredon the check contexts already on the commit. An aggregate job withneeds:, which GitHub creates only when it starts, was missing from that list. An agent that trusted the wake could report the PR done, or merge it, before that check ran. Our own repo hits this: the ruleset onmainrequiresCheck, whichneeds:jobs that are not required, so the other 7 required checks can pass beforeCheckexists.Change
PullRequestCorenow also reads the base branch's required checks, on github.com only, behind the same gate asisRequired. Classic branch protection comes frombaseRef.refUpdateRule.requiredStatusCheckContexts, rulesets frombaseRef.rules. Both can be read with READ permission.<Workflow> /prefix. A same-named check that GitHub marks as not required does not count as the required one having started.isRequired.The watch logic in
pullRequestWatch.tsis unchanged; it now gets the right checks. Clients show the added check through the existing pending-check rendering. No contract changes.Scope and approval
Fixes #28183
Verification
packages/source-control-github/src/server/gitHubPullRequestJson.test.ts:waits for a check branch protection requires that has not started yetandwaits for a check a ruleset requires that has not started yetfail on main: the result has onlylint, with no pendingDone.counts a required check as started when workflows share its name,waits for a required check that only a check GitHub calls not required shares a name with, andadds no required check to a head no check has reported oneach failed before their fix.GitHubPullRequestApi.test.ts:reads the detail without base branch rules refusedcovers rules refused alone and together with a reviewer refusal. In both cases the retry still asks forisRequired.vp test runon the three GitHub test files andapps/server/src/orchestration-v2/pullRequestWatch.test.ts: 217 passed.vp run check:changed: all passed (format, lint, knip, graphql codegen check, typecheck of 11 packages, tests).PullRequestCoreresponse for fix(web): terminal URLs like redis:// no longer become broken file links #28189, from each side's own generated query, decoded by each side'stoPullRequestCoreand passed toevaluatePullRequestWatch. To show the window, the requiredCheckcontext was removed from the head's checks:Not checked:
Triaged and fixed by Claude Opus 5.5 (claude-opus-5-5) in Claude Code inside T3 Code, with reviews by GPT-6.1 Sol in Codex.
🤖 Generated with Claude Code