Skip to content

fix(ci): resolve merged PR robustly in Direct Backport Push#4620

Merged
Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:fix/backport-discovery-race
May 1, 2026
Merged

fix(ci): resolve merged PR robustly in Direct Backport Push#4620
Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:fix/backport-discovery-race

Conversation

@Yicong-Huang
Copy link
Copy Markdown
Contributor

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 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)

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>
@github-actions github-actions Bot added fix ci changes related to CI labels May 1, 2026
@Yicong-Huang Yicong-Huang added the release/v1.1.0-incubating back porting to release/v1.1.0-incubating label May 1, 2026
@Yicong-Huang Yicong-Huang requested a review from aglinxinyuan May 1, 2026 21:35
@Yicong-Huang Yicong-Huang requested a review from bobbai00 May 1, 2026 21:36
@Yicong-Huang Yicong-Huang enabled auto-merge (squash) May 1, 2026 21:37
@Yicong-Huang Yicong-Huang merged commit ddb5c40 into apache:main May 1, 2026
33 of 42 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci changes related to CI fix release/v1.1.0-incubating back porting to release/v1.1.0-incubating

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Direct Backport Push misses PR right after merge due to commit→PR association lag

3 participants