Skip to content

fix(repin): keep the open re-pin PR open when a newer release re-runs it - #17333

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/repin-keep-pr-open
Nov 19, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/repin-keep-pr-open

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: defect found and fixed while re-running the ci-workflows re-pin for v0.76.1.

Summary

When a newer ci-workflows release re-runs maintenance-repin-ci-workflows.yml while its earlier re-pin PR is still open, the step reset chore/repin-ci-workflows to the base before committing. That emptied the open PR's diff, GitHub closed the PR, and the final gh pr merge --auto failed on the closed PR: run 44433009022 closed #17322 (GraphQL: Pull request Pull request is closed (enablePullRequestAutoMerge)).

Fix

  • The commit is built with createCommitOnBranch on a scratch branch chore/repin-ci-workflows-<run id> created at the base, and the scratch branch is deleted on exit.
  • chore/repin-ci-workflows then moves to that commit in one force update (or is created there), so an open PR's diff is never empty.
  • No ruleset covers chore/* branches (only the default branch and release/plugins), so the App can create and delete the scratch branch.

Verification

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C

A re-run reset chore/repin-ci-workflows to the base before committing,
which emptied the open PR's diff; GitHub closed it, and the auto-merge
step then failed on the closed PR (run 44433009022, #17322). The commit
is now built on a scratch branch and the PR branch moved to it in one
force update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 19, 2026 01:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T01:06:08.422064Z b910fcd 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

Copy link
Copy Markdown
Contributor

claude-security-review reviewed b910fcd3b284e32a550b73023af9c73e9d1bc559: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #17333

I read the whole change in .github/workflows/maintenance-repin-ci-workflows.yml, which is on the trusted-path list, along with the job it sits in. I found no security issues.

What changed: the step used to reset chore/repin-ci-workflows to the base before committing. Now it:

  1. Builds the GitHub-signed createCommitOnBranch commit on a scratch branch named $branch-$GITHUB_RUN_ID.
  2. Force-moves the real branch to that commit in one update, or creates the branch there.
  3. Deletes the scratch branch through an EXIT trap.

Checks against the trust boundary:

  • Who reaches it: only schedule and workflow_dispatch start the job (L4-L7). It runs in the plugin-release environment, which admits only main (L21-L23). Checkout is pinned to the resolved default branch with persist-credentials: false. No pull-request, issue or comment text reaches the changed lines.
  • Injection: the only new value interpolated is GITHUB_RUN_ID, which is numeric and set by the runner. The scratch branch name reaches GraphQL through jq --arg, never by string concatenation. The single-quoted trap expands $refs and $scratch when it fires, and both are set by then.
  • Token scope: the App token request is unchanged: contents, pull-requests and workflows write, for this repository only (L74-L76). The new calls are a ref create and a ref delete, which that scope already allowed. Nothing widens.
  • Signing and merge path: the commit is still made by createCommitOnBranch against expectedHeadOid equal to the base SHA. The force update only moves the bot-owned chore/repin-ci-workflows branch to that signed commit. Main's rules and the merge gates still apply to the pull request, and no hold logic changed.
  • Failure handling: set -euo pipefail together with jq -er … >"$RUNNER_TEMP/oid" stops the job before any ref moves if the GraphQL commit fails. The trap still deletes the scratch branch.

No trust control, kill switch, merge hold, plugin manifest or instruction surface is touched.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed b910fcd3b284e32a550b73023af9c73e9d1bc559: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings. This is a full review: no earlier head was reviewed and the prior-findings file lists no posts.

What the change does: in .github/workflows/maintenance-repin-ci-workflows.yml, the re-pin step used to reset chore/repin-ci-workflows to the base before committing. That reset emptied an open re-pin PR's diff, and GitHub closed the PR. The step now builds the signed createCommitOnBranch commit on a scratch branch, chore/repin-ci-workflows-$GITHUB_RUN_ID, and moves $branch to that commit in one force PATCH, or creates it there with a POST. An EXIT trap deletes the scratch branch.

What I checked:

  • Pull request goal. The PR body states it. The branch only ever moves from the old PR head to a commit whose parent is base_sha and that carries the re-pin changes, so the open PR's diff never goes empty in between. The early exit for "already re-pins to this tag" is unchanged.
  • The EXIT trap (L114) doesn't replace any other trap. .github/actions/log-api-budget/api-budget.bash sets no EXIT trap. It only forbids TERM traps and nested bash -c, and the change uses neither. The trap is installed only after the scratch ref exists, so it never tries to delete a branch that was never created.
  • Ref names. chore/repin-ci-workflows-<id> doesn't clash with chore/repin-ci-workflows; only a chore/repin-ci-workflows/<id> path would.
  • Workflow triggers. Every push: trigger in .github/workflows/ filters to main, so creating, committing to and deleting the scratch branch starts no extra runs.
  • Failure handling. jq -er … >"$RUNNER_TEMP/oid" still fails the step under set -euo pipefail when GraphQL returns no oid, so $branch is never moved to an empty SHA.
  • Other references. No other code in the repository uses the chore/repin-ci-workflows head ref, so nothing else depends on how this branch is built.

One candidate I dropped as too minor to post: the scratch name uses GITHUB_RUN_ID but not GITHUB_RUN_ATTEMPT. If an attempt's cleanup DELETE fails (|| true hides the failure), a "Re-run failed jobs" of the same run would hit a 422 on the scratch POST. The next scheduled run gets a new run id and recovers, so the cost is one failed re-run and a leftover branch. Adding -$GITHUB_RUN_ATTEMPT to scratch would remove it.

Verification: the PR's claims that actionlint passes and that "the next re-pin run exercises the path" are the author's and unverified; I ran nothing. No automated test covers this workflow step's branch handling.

Criteria sources: there's no closing issue ("No related issue"), so no acceptance criteria apply. No .claude/rules/ rule's paths: matches the changed file. There's no embedded instruction text in the PR context. The changed file is on a trusted path; I read its whole change and the step it belongs to.

Loosened-check verdict: fail (default; the prompt carried no loosened_check_verdict: / loosened_check_patterns: lines); patterns: 0. The change loosens no check; the || true only covers branch cleanup. There was no loosened_check_decision_record: line, so the citation requirement was not checked.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit f7904fe Nov 19, 2026
83 checks passed
@kyle-sexton
kyle-sexton deleted the fix/repin-keep-pr-open branch November 19, 2026 01:33
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant