Skip to content

fix(ci): resolve fork PR by head ref, not laggy commit association - #3915

Draft
Andrei Kvapil (kvaps) wants to merge 1 commit into
mainfrom
fix/e2e-fork-resolve-pr-by-head-ref
Draft

fix(ci): resolve fork PR by head ref, not laggy commit association#3915
Andrei Kvapil (kvaps) wants to merge 1 commit into
mainfrom
fix/e2e-fork-resolve-pr-by-head-ref

Conversation

@kvaps

Copy link
Copy Markdown
Member

What this PR does

The privileged E2E (fork) workflow resolves a fork PR's number from the head SHA its Pull Request run built, then posts the required E2E Tests status back on that SHA. It resolved the PR with listPullRequestsAssociatedWithCommit, whose commit→PR association index is populated asynchronously and lags minutes — longer for forks — behind a head force-push. A fork PR that was just rebased therefore reads back zero associations, and the resolve guard fails E2E Tests closed with expected exactly one open PR for <sha>, found 0 — a red the author cannot clear by pushing again, since the SHA is already correct and only the index is behind.

This resolves the PR by its head ref instead — owner:branch, both taken from the workflow_run event — via pulls.list, which is answered from the live PR table and returns the PR the instant the push lands. The head.sha === HEAD_SHA filter and the exactly-one check are unchanged, so the guard stays exactly as narrow as before: only one open PR sitting AT the built SHA satisfies it, and a stacked second PR or a stale run whose ref has since moved still fails closed.

Observed on a rebased fork PR: its head SHA was correct and refs/pull/N/head resolved in the base repo, yet listPullRequestsAssociatedWithCommit returned 0 for that head across an extended window while pulls.list by head ref returned the PR immediately.

This is a disclosure per the project's AI-assistance guidance: the change was drafted with AI assistance and reviewed by the author, who remains responsible for it.

Downstream repositories

  • No downstream repository is affected by this change

Release note

fix(ci): the fork e2e workflow resolves a PR by its head ref instead of by commit association, so a rebased fork PR is no longer failed closed on "E2E Tests" while GitHub's commit→PR index catches up

The e2e-fork resolve guard mapped the built head SHA back to its PR with
listPullRequestsAssociatedWithCommit, whose commit->PR index lags minutes
-- longer for forks -- behind a head force-push. A freshly rebased fork PR
read back zero associations, so the guard failed "E2E Tests" closed on a
state the author could not clear by pushing again.

Resolve by the fork head ref (owner:branch, from the workflow_run event)
via pulls.list, which is answered from the live PR table and returns the
PR the instant the push lands. The head.sha === HEAD_SHA filter and the
exactly-one check are unchanged, so the guard stays as narrow as before.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d3b65c1c-06f0-487d-ac26-91e6d3391cdf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added area/ci Issues or PRs related to CI workflows, GitHub Actions, automation kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files labels Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci Issues or PRs related to CI workflows, GitHub Actions, automation kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant