Skip to content

fix(pr-pipeline): isolate pr-merge re-fire failures per PR and skip workflow-owned branches - #11283

Merged
kyle-sexton merged 8 commits into
mainfrom
fix/pr-merge-refire-isolate-failures
Oct 30, 2026
Merged

kyle-sexton merged 8 commits into
mainfrom
fix/pr-merge-refire-isolate-failures

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

No related issue: a defect in pr-merge's re-fire step that poteto (the pr-merge owner) assigned directly, with the fix shape agreed, after run 41065454536 failed.

Summary

Run 41065454536's merge job failed at "Re-fire lane runs refused as workflow-modified" with #11271: PATCH /repos/melodic-software/claude-code-plugins/git/refs/heads/release/plugins failed with status 422. #11271 is the release PR on release/plugins, a branch release-publish-plugins.yml owns and rebuilds. The step already went on to the other PRs after that error, but it exited 1 at the end, so a failure on one PR failed the whole job.

Fix

  • Failures that belong to one PR stay with that PR. In .github/scripts/pr-merge/refire-refused.mjs, these are reported as ::warning title=refire-refused::#N: ... without changing the exit code, and the other PRs still re-fire:
    • a PR that changed since the listing;
    • a GitHubError 409 or 422 on the ref update (PATCH git/refs/heads/<branch>) when a fresh GET git/ref/heads/<branch> answers 404 (the branch is gone) or a SHA other than the head the push was built on (the branch moved).
  • A ref update refused on an unmoved branch fails the step. After a 409 or 422, a re-read that returns the same head SHA, answers anything but 200 or 404, or returns no SHA stops the run with ::error and exit 1, and no further PR is pushed. A fast-forward refused on a branch that did not move is not a race, so it would hit every PR.
  • Any error writing the new commit fails the step. POST git/commits goes through the plain client: a commit object names only its tree and parent, so no branch move can refuse it, and any error there (a 409 included) exits 1 with ::error at the first PR.
  • Every other failure fails the step. It stops the run and exits 1 with ::error. This covers an auth refusal, a server error after retries, a failed run, comment or refusal read, a main blob read in blobOf, setup errors (repository name, a tag named main, main's tip, the sender id, the skip list) and a failed run listing for a lane. Such failures would hit every PR the same way, so a green step would hide them. The lanes review of 76e60c9 asked for this split.
  • A push that never landed asks for a person. A PR whose marker is at its current head but whose push has not landed an hour later is logged as ::warning title=refire-refused::#N not re-fired: its push for <file> at <blob> did not land; a person looks, so it shows in the run's annotations.
  • The outcome is logged either way. The step logs and summarizes refire-refused: outcome re-fired=N failed=N skipped-owned=N deferred=N once it has listed the PRs, whether or not the run stopped.
  • Workflow-owned branches are skipped. The new merge.refire-skip-branches key is added to pr-pipeline.schema.json and resolved in resolve-config's resolveMerge with a default of []. docs/conventions/pr-pipeline.yaml sets it to [release/plugins]. The step reads the key from resolve-config's output file, which the merge job's config step already writes, through the new RESOLVED_CONFIG_PATH env in pr-merge.yml. This is the same file the mode step reads merge.lane-prs from. An owned PR is dropped when the open PRs are listed, so the step spends no reads on it, never comments on it and never pushes to it. Skipping another owned branch takes only a config edit. A missing or malformed list stops the step before any push.
  • One existing test changed on purpose. "A PR pushed, drafted or closed since the listing" now expects exit 0 and that PR's warning, because the owner's direction changes that contract. It still checks that nothing was pushed or posted. "A failed marker comment pushes nothing and fails the run" still expects exit 1.
  • A changelog fragment is added under .changes/pr-pipeline/ (minor: new config key).

Verification

TDD: each new behavior's test was written first and failed against the script as it stood. The tests in refire-refused.test.mjs that pin this PR's behavior:

  • one PR's 422 on its ref update, with the branch re-read at a moved SHA, warns for that PR while the other two still re-fire (exit 0, re-fired=2 failed=1);
  • a 409 on the ref update of a branch the re-read finds deleted (404) warns for that PR alone (exit 0);
  • a 422 on the ref update of a branch still at the head it was read at exits 1 at that PR with ::error, and the next PR is not pushed;
  • a 409 on the ref update whose re-read answers 500, or answers with no SHA, exits 1 with ::error and no warning;
  • a 409 on the commit write exits 1 at the first PR with ::error, one commit write attempted and no warning;
  • a 403 on the ref update exits 1 at the first PR with no warnings;
  • a push that has not landed an hour after its marker logs ::warning title=refire-refused::#9 not re-fired: ...;
  • a PR pushed, drafted or closed since the listing warns for that PR (exit 0, nothing pushed or posted);
  • a missing main blob, a failed marker comment and a failed pr-unblock.yml run listing each exit 1;
  • a release/plugins PR is never commented on or PATCHed while another PR is; the skip list comes from config; an unreadable or malformed config stops the step before any push.

The fail-closed re-read test was checked by changing both branches to warnings: it went red, and the code was restored.

Run with node --test on head 791b9fa (origin/main merged; the remerge-diff is empty):

Test file Pass Fail
.github/scripts/pr-merge/refire-refused.test.mjs 37 0
.github/scripts/pr-merge/workflow.test.mjs (new test: the step's RESOLVED_CONFIG_PATH is the config step's output-path) 94 0
.github/scripts/pr-merge/merge-job.test.mjs 85 0
every test file under .github/scripts/pr-merge/ 757 0
.github/actions/resolve-config/merge-authority.test.mjs (new test: the key is validated and the schema default equals the resolver's) 26 0
.github/actions/resolve-config/live-config.test.mjs (new test: the live config skips release/plugins) 44 0

scripts/check-changelog-fragments.sh --check exits 0.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 6 commits October 30, 2026 10:32
…orkflow-owned branches

Run 41065454536's merge job failed because one PR's re-fire ref update
(#11271 on release/plugins) answered 422 and the step exited 1.

- Each failed run read, marker comment or ref update is now a
  ::warning:: for that PR; the others still re-fire and the step passes.
  A closing `refire-refused: outcome re-fired=N failed=N skipped-owned=N
  deferred=N` line counts them in the log and step summary. Setup errors
  and a failed run listing still fail the step.
- New merge.refire-skip-branches config key (schema, resolver default
  []), set to [release/plugins] in pr-pipeline.yaml. The step reads it
  from resolve-config's output, so skipping another owned branch takes
  only a config edit. An unreadable or malformed list stops the step
  before any push.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lanes review of 76e60c9 found that every per-PR error had become a
warning, so a 401 or 403 on every write, a persistent 5xx or a failed
main blob read still passed green.

Only a PR that changed since the listing, or a 409 or 422 on the new
commit or the ref update (the branch moving under the push), now warns
for that PR. Any other failure stops the run with ::error and exits 1.
The outcome line is still logged when the run stops. New tests cover a
409 commit write, a 403 ref update, a missing main blob and a failed
run listing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new commit object names only its tree and parent, so no branch move can
refuse it: any error writing it now fails the step. A 409 or 422 on the ref
update re-reads the branch: moved or deleted warns for that pull request
alone, still at the head it was read at fails the step. A push that has not
landed an hour after its marker is now a warning, so a person looks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A 500 on the re-read, or an answer with no SHA, fails the run at that pull
request instead of warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 30, 2026 16:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T16:18:59.727417Z 60abbcc Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 4496c166f5c06b13709c32ab62f4556ad2fe0d23: 0 finding(s), 0 as inline comments.

Incremental review of .changes/pr-pipeline/fix-pr-merge-refire-isolate-failures-4a151f0c.md only. The change adds one clause to a changelog fragment: a 409 or 422 on a ref update whose branch tip cannot be read again still fails the step. It is documentation only, with no code, workflow, permission or trust-boundary change. No security findings. No cost impact. The other files were reviewed at 60abbcc and have not changed since.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 4496c166f5c06b13709c32ab62f4556ad2fe0d23: 0 finding(s), 0 as inline comments.

Incremental review of .changes/pr-pipeline/fix-pr-merge-refire-isolate-failures-4a151f0c.md since 60abbcc: no findings.

The only change adds "or whose tip cannot be read again" to the list of failures that still fail the step. That matches the PR description. There, a re-read after a 409 or 422 that answers anything but 200 or 404, or returns no SHA, stops the run with ::error and exit 1. I read only the changelog fragment and the PR description. I did not open the refire-refused.mjs source or its tests, so the claim is checked against the description, not the code.

The fragment is prose only, so it adds no security surface. It changes no behavior and spends no billed resources.

@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head 60abbcc92a79c61c465f746e7b763680255c3ba9. What it wrote, as data:

What it wrote (29 lines)
Summary: PR #11283 links no issue, so its own title and body are the spec. The code largely does
  what the body asks: it skips workflow-owned branches through the new `merge.refire-skip-branches`
  key, warns for a PR that changed since the listing, fails on everything else and logs the outcome
  line. But the diff contradicts the body on which failures count as one PR's alone. The body says a
  GitHubError 409 or 422 on the new commit (`POST git/commits`) or on the ref update is reported as
  a warning and the step exits 0. The code treats any error on the commit write as fatal, and a new
  test asserts that a 409 there exits 1. The code also warns on a 409 or 422 from the ref update
  only after a fresh read shows the branch moved or deleted. The body's Verification section says a
  test showing a 409 on the commit write warning and exiting 0 passes, but no such test is in the
  diff. Either the code or the body has to change so they agree before this can pass.
- `.github/scripts/pr-merge/refire-refused.mjs:283`: the spec (the PR body, Fix section) says a
  GitHubError 409 or 422 on `POST git/commits` warns for that PR and leaves the exit code alone. The
  code instead throws `Fatal` for any commit-write error, and `refire-refused.test.mjs:437` asserts
  exit 1 with no warnings. Pick one: change the code to warn on a 409 or 422 from the commit write,
  or update the PR body to say a commit-write error fails the step. The changelog fragment already
  says the latter.
- `.github/scripts/pr-merge/refire-refused.mjs:149-173`: the body says any 409 or 422 on `PATCH
  git/refs` warns. The code warns only when a re-read of `git/ref/heads/{branch}` shows the branch
  moved or deleted, and fails the step when the branch is still at the head it was read at. This
  rule looks sound, but the body must describe it, or the code must follow the body.
- PR body, Verification section: it says a test showing 'a 409 on the commit write warns for each PR
  it hits and exits 0' passes. The diff contains the opposite test. Correct the Verification section
  and the test counts so they match the tests the diff actually contains.
- `.github/workflows/pr-merge.yml:1825`: `RESOLVED_CONFIG_PATH` points at `${{ runner.temp
  }}/resolved-config.json`, which matches the config step's `output-path` that `workflow.test.mjs`
  checks. No problem there.
- `.github/scripts/pr-merge/refire-refused.mjs:241`: `blobOf` now runs outside the per-PR try, so a
  missing blob error is logged without a `#N` prefix. This is intended and covered by a test; noted
  for awareness only.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass at a new commit removes the label.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Oct 30, 2026
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Oct 30, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 91ef27a Oct 30, 2026
51 checks passed
@kyle-sexton
kyle-sexton deleted the fix/pr-merge-refire-isolate-failures branch October 30, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant