Skip to content

fix: Clarify error when GitHub PR merge refspec fetch fails - #4254

Merged
ss1909 merged 1 commit into
mainfrom
sneha/a-1711-pr-merge-refspec-error-message
Aug 20, 2026
Merged

fix: Clarify error when GitHub PR merge refspec fetch fails#4254
ss1909 merged 1 commit into
mainfrom
sneha/a-1711-pr-merge-refspec-error-message

Conversation

@ss1909

@ss1909 ss1909 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

refs/pull/N/merge only exists when GitHub can compute the speculative merge. When there's a real merge conflict the ref is never created and the fetch fails with a generic git error, which looks like transient flake rather than something the PR author needs to resolve. This fixes that by appending a clear hint when these errors surface.

Two fetch paths hit this ref, so both are covered:

  • fetchSource (canonical checkout) — already fails fast on a missing merge ref; now also gets the hint.
  • updateGitMirror (the --git-mirrors-path mirror-update fetch) — previously returned the raw git error with no hint, and unconditionally retried for ~2m17s even for the merge refspec. Now it gets the same hint and skips the retry for the merge refspec, matching fetchSource's existing rationale (a missing merge ref usually means a real conflict, not a transient issue worth retrying).

Context

A-1711, A-1722

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go tool gofumpt -extra -w .)

Affiliation (optional, external contributors)

Disclosures / Credits

@ss1909
ss1909 requested review from a team as code owners August 20, 2026 06:24
@ss1909 ss1909 added the cleanup Cleaning up code, refactoring, etc label Aug 20, 2026

@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.

The error-path change is straightforward. I left one non-blocking suggestion to pin the new diagnostic in the existing missing-merge-ref test.

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 18629, 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.

Comment thread internal/job/checkout_fetch.go
@ss1909
ss1909 force-pushed the sneha/a-1711-pr-merge-refspec-error-message branch from 1a87354 to 5403188 Compare August 20, 2026 06:30
@ss1909 ss1909 changed the title Clarify error when GitHub PR merge refspec fetch fails fix: Clarify error when GitHub PR merge refspec fetch fails Aug 20, 2026
@ss1909
ss1909 force-pushed the sneha/a-1711-pr-merge-refspec-error-message branch from 5403188 to 6ad5bb3 Compare August 20, 2026 06:33
@ss1909
ss1909 enabled auto-merge August 20, 2026 06:35
@ss1909 ss1909 added the bug label Aug 20, 2026

@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.

One supported checkout path still bypasses the new diagnostic; details inline.

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 18638, then answer my questions about the findings.

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

Comment thread internal/job/checkout_fetch.go Outdated
refs/pull/N/merge only exists when GitHub can compute the speculative
merge. When there's a real merge conflict the ref is never created and
the fetch fails with a generic git error, which looks like transient
flake rather than something the PR author needs to resolve.

A-1711, A-1722
@ss1909
ss1909 force-pushed the sneha/a-1711-pr-merge-refspec-error-message branch from 6ad5bb3 to 5ef69bd Compare August 20, 2026 07:05
@buildsworth-bk-app
buildsworth-bk-app Bot dismissed their stale review August 20, 2026 07:12

Previous concerns have been addressed.

@ss1909
ss1909 disabled auto-merge August 20, 2026 07:13
@ss1909
ss1909 merged commit 5c21980 into main Aug 20, 2026
5 checks passed
@ss1909
ss1909 deleted the sneha/a-1711-pr-merge-refspec-error-message branch August 20, 2026 23:38
@bk-docsbot

Copy link
Copy Markdown

🤖 Docs Draft Bot: I've created a draft documentation PR based on this change:

📝 Docs PR: https://github.com/buildkite/docs-private/pull/2023

Please review the draft and make any necessary adjustments.

1 similar comment
@bk-docsbot

Copy link
Copy Markdown

🤖 Docs Draft Bot: I've created a draft documentation PR based on this change:

📝 Docs PR: https://github.com/buildkite/docs-private/pull/2023

Please review the draft and make any necessary adjustments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cleanup Cleaning up code, refactoring, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants