Skip to content

prs merge: leave an already-merged PR alone instead of trying to repair it - #102

Merged
ralyodio merged 1 commit into
masterfrom
worktree-prs-merge-skip-closed
Sep 25, 2026
Merged

ralyodio merged 1 commit into
masterfrom
worktree-prs-merge-skip-closed

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

The bug

A sweep printed this about crawlproof.com#316:

FIXING .../pull/316 — state=MERGED; asking GitHub to merge the base branch in
FIXME  .../pull/316 — GitHub could not merge the base in: GraphQL: Could not resolve head ref 'ads-media-rotation'.

The PR was merged between gh search and gh pr view. Merging deletes the head branch, so update-branch had nothing to resolve. Two alarming lines about a PR that was simply already done.

isUpdatable never looked at pr.state, and a merged PR reports mergeStateStatus=UNKNOWN, which reads as updatable.

The fix

Repair is for open PRs. Gate the --fix block and isUpdatable on state === 'OPEN'; a settled PR falls through to the ordinary SKIP … state=MERGED.

Same root cause in Gh.pullRequest: mergeable=UNKNOWN means "ask again" only while a PR is open. A merged one rests there permanently, so every read spent all five attempts — 8s per merged PR — waiting out a verdict that was never coming. Non-open PRs now return on the first read.

Tests

Three added; prs-merge suite 41/41 green, tsc --noEmit clean. The suite also dropped from 5.5s to 0.5s, which is the polling fix showing up directly.

test/root-ubuntu.test.ts has 6 failures on this box; verified identical on a reverted tree, so pre-existing and unrelated.

🤖 Generated with Claude Code

…ir it

A PR merged between the search and the read came back state=MERGED, and
--fix still ran it through the repair path: mergeStateStatus=UNKNOWN reads
as updatable, so the sweep asked GitHub to merge the base into a head branch
the merge had just deleted. The output was two alarming lines -- FIXING then
FIXME "Could not resolve head ref" -- about a PR that was simply already done.

Repair is for open PRs. Gate the --fix block and isUpdatable on state, so a
settled PR falls through to the ordinary SKIP state=MERGED.

Same root cause in Gh.pullRequest: mergeable=UNKNOWN means "ask again" only
while a PR is open. A merged one rests there for good, so every read spent
the full five attempts -- eight seconds per merged PR -- waiting out a verdict
that was never coming. Return a non-open PR on the first read.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

23 finding(s)

HIGH/CRITICAL: 4 | MEDIUM: 10 | LOW: 9

Severity Rule Location
HIGH sh-remote-script-execution root-ubuntu.sh:3227
HIGH sh-remote-script-execution root-ubuntu.sh:3228
HIGH sh-remote-script-execution root-ubuntu.sh:4840
HIGH sh-remote-script-execution root-ubuntu.sh:4844
MEDIUM sh-remote-script-execution root-ubuntu.sh:4993
MEDIUM redos-nested-quantifier src/domain-free.ts:56
MEDIUM redos-nested-quantifier src/emoji.ts:167
MEDIUM redos-nested-quantifier src/icon.ts:166
MEDIUM redos-nested-quantifier src/mail.ts:1042
MEDIUM sql-template-interpolation src/users-dump.ts:487
MEDIUM sql-string-concatenation src/users-dump.ts:507
MEDIUM sql-template-interpolation src/users-dump.ts:540
MEDIUM sql-string-concatenation src/users-dump.ts:574
MEDIUM redos-nested-quantifier src/wcag.ts:556
LOW secret-generic-credential src/credentials.ts:36
LOW secret-generic-credential src/user-export.ts:632
LOW secret-generic-credential src/user-export.ts:638
LOW secret-generic-api-key test/credentials.test.ts:208
LOW secret-generic-credential test/mail.test.ts:141
LOW secret-generic-credential test/shorten.test.ts:36
LOW secret-database-url test/users-dump.test.ts:108
LOW secret-database-url test/users-dump.test.ts:119
LOW secret-database-url test/users-dump.test.ts:120

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit c15ee85 into master Sep 25, 2026
5 checks passed
@ralyodio
ralyodio deleted the worktree-prs-merge-skip-closed branch September 25, 2026 05:35
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