fix(ci): resolve merged PR robustly in Direct Backport Push#4620
Merged
Yicong-Huang merged 1 commit intoMay 1, 2026
Conversation
The discover step relied solely on GET /commits/{sha}/pulls, whose
backing index lags for tens of seconds after a squash merge. When the
push event fires before the index catches up, the step finds no PR,
push-backports is skipped, and the run becomes a no-op until someone
re-runs it manually.
Resolve the PR in two stages:
1. Parse the squash-merge commit message. .asf.yaml forces squash with
PR_TITLE_AND_DESC, so the first line ends with "(#NNNN)". Extracting
that number and fetching the PR directly via /pulls/{N} bypasses the
association index entirely.
2. Fall back to /commits/{sha}/pulls with 5 attempts at exponential
backoff (0, 2, 4, 8, 16 seconds — ~30s worst case) when the message
does not match (manual or unconventional commits).
Closes apache#4617
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aglinxinyuan
approved these changes
May 1, 2026
bobbai00
approved these changes
May 1, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
May 1, 2026
### What changes were proposed in this PR?
The `Discover direct backport targets` step in
`direct-backport-push.yml` previously relied solely on `GET
/commits/{sha}/pulls`. That endpoint is backed by an async association
index that lags for tens of seconds after a squash merge — see [run
25233602734 attempt
1](https://github.com/apache/texera/actions/runs/25233602734) for #4600,
which logged `No merged pull request is associated with ...` and skipped
`push-backports` even though the PR carried a `release/*` label.
Resolve the PR in two stages, in order:
1. **Parse the squash-merge commit message.** `.asf.yaml` forces squash
merges with `PR_TITLE_AND_DESC`, so the first line of every merge commit
on `main` ends with `(#NNNN)`. Regex-extracting that number and fetching
the PR directly via `/pulls/{N}` bypasses the association index
entirely. We also verify `pr.merged === true` before trusting the
result.
2. **Fall back to `/commits/{sha}/pulls` with retries.** If the message
does not match (manual or unconventional commits), retry the original
API call up to 5 times with exponential backoff (`0s, 2s, 4s, 8s, 16s` —
~30s worst case).
### Any related issues, documentation, discussions?
Closes #4617
### How was this PR tested?
YAML parses locally (`python3 -c "import yaml; yaml.safe_load(...)"`).
The fix runs the same final code path as before — only the resolution
method changes — so existing `push-backports` behavior is unchanged once
a PR is found. Will be exercised the next time a PR with `release/*`
labels merges to `main`.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.7)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(backported from commit ddb5c40)
SarahAsad23
pushed a commit
to SarahAsad23/texera
that referenced
this pull request
May 4, 2026
) ### What changes were proposed in this PR? The `Discover direct backport targets` step in `direct-backport-push.yml` previously relied solely on `GET /commits/{sha}/pulls`. That endpoint is backed by an async association index that lags for tens of seconds after a squash merge — see [run 25233602734 attempt 1](https://github.com/apache/texera/actions/runs/25233602734) for apache#4600, which logged `No merged pull request is associated with ...` and skipped `push-backports` even though the PR carried a `release/*` label. Resolve the PR in two stages, in order: 1. **Parse the squash-merge commit message.** `.asf.yaml` forces squash merges with `PR_TITLE_AND_DESC`, so the first line of every merge commit on `main` ends with `(#NNNN)`. Regex-extracting that number and fetching the PR directly via `/pulls/{N}` bypasses the association index entirely. We also verify `pr.merged === true` before trusting the result. 2. **Fall back to `/commits/{sha}/pulls` with retries.** If the message does not match (manual or unconventional commits), retry the original API call up to 5 times with exponential backoff (`0s, 2s, 4s, 8s, 16s` — ~30s worst case). ### Any related issues, documentation, discussions? Closes apache#4617 ### How was this PR tested? YAML parses locally (`python3 -c "import yaml; yaml.safe_load(...)"`). The fix runs the same final code path as before — only the resolution method changes — so existing `push-backports` behavior is unchanged once a PR is found. Will be exercised the next time a PR with `release/*` labels merges to `main`. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 4.7) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
What changes were proposed in this PR?
The
Discover direct backport targetsstep indirect-backport-push.ymlpreviously relied solely onGET /commits/{sha}/pulls. That endpoint is backed by an async association index that lags for tens of seconds after a squash merge — see run 25233602734 attempt 1 for #4600, which loggedNo merged pull request is associated with ...and skippedpush-backportseven though the PR carried arelease/*label.Resolve the PR in two stages, in order:
.asf.yamlforces squash merges withPR_TITLE_AND_DESC, so the first line of every merge commit onmainends with(#NNNN). Regex-extracting that number and fetching the PR directly via/pulls/{N}bypasses the association index entirely. We also verifypr.merged === truebefore trusting the result./commits/{sha}/pullswith retries. If the message does not match (manual or unconventional commits), retry the original API call up to 5 times with exponential backoff (0s, 2s, 4s, 8s, 16s— ~30s worst case).Any related issues, documentation, discussions?
Closes #4617
How was this PR tested?
YAML parses locally (
python3 -c "import yaml; yaml.safe_load(...)"). The fix runs the same final code path as before — only the resolution method changes — so existingpush-backportsbehavior is unchanged once a PR is found. Will be exercised the next time a PR withrelease/*labels merges tomain.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.7)