Skip to content

[Backport] PS-2073: Validate GitHub pull request merge heads - #4253

Merged
SorchaAbel merged 1 commit into
v3from
ps-2073-validate-pr-merge-head-v3
Aug 19, 2026
Merged

[Backport] PS-2073: Validate GitHub pull request merge heads#4253
SorchaAbel merged 1 commit into
v3from
ps-2073-validate-pr-merge-head-v3

Conversation

@SorchaAbel

Copy link
Copy Markdown
Contributor

Description

This is the v3 backport of the already-merged Agent v4 fix in #4251.

It prevents the Agent from accepting a stale GitHub refs/pull/<PR>/merge after the pull request head has been force-pushed. The companion server-side change that supplies the expected head commit has also merged in https://github.com/buildkite/buildkite/pull/30177.

No Agent release or version change is included in this PR; releasing the fix remains a separate step.

Context

Changes

The behavior matches the merged v4 implementation. The bootstrap flag uses the urfave/cli v1 conventions retained by Agent v3.

Testing

  • Focused checkout and configuration tests pass
  • Stale merge-ref integration tests pass with the race detector
  • All internal/job tests pass except the existing macOS setgid-preservation failure in TestUpdateGitMirrorCreatesFromRemoteMirrorAndKeepsCanonicalOrigin
  • Code is formatted (with go tool gofumpt -extra -w .)

Disclosures / Credits

Prepared and validated with Amp as a v3 translation of the merged v4 change.

Backport of #4251.

The CLI flag uses the urfave/cli v1 conventions retained on v3.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a00dfe-698c-730e-ae98-26abce2ae925
@SorchaAbel
SorchaAbel requested review from a team as code owners August 19, 2026 04:18

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes merge-ref checkout acceptance and retry behavior, which is above this review's L1 approval ceiling. I found no actionable issues in the v3 translation; it matches the merged v4 change apart from the expected urfave/cli v1 wiring.

Want to dig deeper?

Paste this into your agent to explore the findings from this review's Buildkite build:

Download the buildsworth logs from build 18003, then answer my questions about the findings.

Install the reading-buildsworth-logs skill to run this.

About buildsworth

Model: gpt-5.6-sol with xhigh thinking.

How to request a review: Comment @buildsworth-bk review on the PR, or request buildsworth-bk as a reviewer.

Risk labels (how buildsworth classifies risk) — buildsworth classifies risk itself from the diff. Unless repository policy already allows L2 approval, grant it by mentioning @buildsworth-bk (see approval ceiling and L2 approval grant):

  • L1 — Low risk (dep bumps, docs/copy, lockfiles, small presentational fixes). buildsworth may approve by default.
  • L2 — Standard risk (new UI, additive API fields, refactors). Approved only when repository policy or a verified grant allows it; otherwise comment-only.
  • L3 — High risk (auth, migrations, payments, secrets, perf-critical paths). Human review always required.

@SorchaAbel SorchaAbel added the bug label Aug 19, 2026
@SorchaAbel
SorchaAbel requested a review from lox August 19, 2026 04:52
@SorchaAbel
SorchaAbel merged commit f03f48a into v3 Aug 19, 2026
5 of 6 checks passed
@SorchaAbel
SorchaAbel deleted the ps-2073-validate-pr-merge-head-v3 branch August 19, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants