Repository navigation
fix(running-in-ci): re-read the branch before a terminal action on a PR - #944
Merged
Merged
Conversation
tend-agent
commented
Aug 11, 2026
tend-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
The rule lands where the blind spot is, and the scoping — keep the withdraw authority, put the check on the terminal action — reads right against #943. One nit on the recipe.
…the thread A session that opened a PR and stayed alive polling it can take a terminal action — close, revert, force-push — on a head a sibling session has already moved. Every existing recheck counts comments and reviews or asserts state == OPEN, all of which pass while a pushed, CI-green sibling commit sits on the branch; --delete-branch then makes the loss destructive. Refs #943
…hold A closing summary is the only durable record a session leaves, and a claim about the PR's state can be false seconds after it is written. Re-check the claim as it is written, and prefer reporting what the session did over reporting a state it doesn't control. Closes #943
max-sixty
force-pushed
the
fix/issue-943
branch
from
August 11, 2026 23:36
5187194 to
26a7848
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#943 reports a
tend-nightlysession closing (with--delete-branch) a PR it had opened, seconds after atend-mentionsession had pushed the review's remedy to that same PR and polled its checks green. The branch ref is gone; the commit survives only through the PR ref.The blind spot is structural, not bad luck. Every recheck a session runs before a terminal action looks at the thread: Recheck Before Posting counts comments and reviews, Re-check PR state before pushing a follow-up commit asserts
state == OPEN(true here), and the closing session's own re-read wasgh pr view --json reviews. A close collides with commits and branch state, which none of those queries return — so the sibling's pushed, CI-green work was invisible by construction, and the same query replays identically every time.The second, separable half from the report: the mention session's closing summary — "PR is open and awaiting a maintainer" — was false 71 seconds after it was written, and it is the only durable record that session leaves.
Solution
Two rules, one per commit, both in
running-in-ci.gh pr close, a revert, or a force-push, re-readheadRefOid,commitsrather than the thread. If the head moved past the SHA the session last pushed, read the sibling's commits before deciding. Deliberately not a stand-down: withdrawing a PR whose premise a review invalidated is the PR-holder's call and it was the right call in nightly closes a PR out from under the mention session that just fixed it — divergent dispositions on the same review (#865 sibling) #943 — what changes is that the close comment says what the sibling landed and why it stands anyway, and drops--delete-branchso that work stays reachable.Relationship to #870
Complementary, and deliberately not the same rule. #870 makes a PR-holding session stand down from a review that lands mid-poll — applied to #943 that would have prevented the destructive close, but only by making nobody withdraw a PR that should have been withdrawn, since the mention session held author role and had no standing to conclude the PR shouldn't exist. This PR keeps the withdraw authority and puts the check on the terminal action itself, so it holds whether or not #870 lands. The two touch different sections of
running-in-ci(this one is under Recheck Before Posting and End the turn…; #870 is under Pushing to PR Branches and CI Monitoring), so they don't conflict textually either.Testing
Skill prose — no test surface. Verified the file has no bang-backtick preprocessor poison, no trailing whitespace, and a trailing newline (the three local hooks that apply to it), and re-read both edits in place.
Closes #943 — automated triage