Only reuse an OPEN pull request when re-applying an issue - #77
Merged
Conversation
`gh pr view <branch>` resolves a closed pull request as readily as an open one, so once an issue's pr had been closed, issue-to-pr took the "update the existing pr" path forever. It force-pushed a correctly rebuilt branch, ran `gh pr edit` against the closed pr, printed "updated", and exited 0 -- without opening anything. The workflow run is green in every respect. The only way to notice is to go looking for a pull request that isn't there. Found by replay_issues.py, which timed out twice on issue #9 rather than believing the run: the branch had been rebuilt (6c3b166..e81860c, forced) and the log read "updated .../pull/13", a pr closed on 2026-08-06. #10 and #65 are in the same state. `gh pr list --head "$BRANCH" --state open` is the check that means what this code intended. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Found by running the replay. Issue #9 timed out twice with the workflow reporting success both times.
What happens
gh pr view inv/issue-9resolves to PR #13 — closed on 2026-08-06. So the workflow takes the "update the existing PR" path, and from the run log:It force-pushed a correctly rebuilt branch, edited a closed PR, and exited 0. Once an issue's PR has been closed, that issue can never produce a new one again.
The run is green in every respect. The only way to notice is to go looking for a PR that isn't there — which is exactly what
replay_issues.pydoes instead of trusting the run, and why it caught this.The fix
gh pr list --head "$BRANCH" --state open— the check this code always meant. Verified against the live repo:--state openmatchinv/issue-9inv/issue-15Affects three issues
#9, #10 and #65 — the ones whose PRs were closed rather than merged. Their branches are already rebuilt and correct from the failed attempts; they just need re-triggering once this lands.
🤖 Generated with Claude Code