Skip to content

docs(worktrees): triage a PR that won't merge, and how to resolve safely - #102

Merged
wshallwshall merged 1 commit into
mainfrom
worktrees-merge-triage
Jul 31, 2026
Merged

docs(worktrees): triage a PR that won't merge, and how to resolve safely#102
wshallwshall merged 1 commit into
mainfrom
worktrees-merge-triage

Conversation

@wshallwshall

Copy link
Copy Markdown
Collaborator

Written from what actually cost time today across several parallel sessions. Docs-only, one file, +45/−0.

Why

Four mergeStateStatus values all read as "can't merge" and three need different fixes:

state fix
BEHIND rebase + --force-with-lease — mechanical
DIRTY resolve hunks by hand — not a rebase
BLOCKED usually wait
UNKNOWN re-query; not a state to act on

BLOCKED is the trap. Right after a push every required check is pending and the PR reads BLOCKED — indistinguishable from genuinely failing. The rule added here is to count failures in statusCheckRollup first: zero failures + pending checks means wait, not investigate.

Also records something not visible in the UI: armed auto-merge does not update a BEHIND branch in this repo. Landing PR A puts PR B behind, and B then sits armed and stalled until somebody rebases it, while the UI still shows auto-merge enabled. Observed repeatedly today — every stacked pair needed a manual rebase after the first landed.

The half with teeth

docs/BACKLOG.md and CHANGELOG.md are single large append-target files, so they conflict most — and --ours / --theirs both produce a file that passes every check while silently dropping someone's work. No gate catches it, because the result is well-formed.

The worked example is real, from today: two PRs each added a ### Changed block under [Unreleased]. The union was correct; --ours would have dropped two already-published breaking-change notices, --theirs would have dropped the incoming one. Both would have merged green.

Closes with a find-and-replace warning contributed by the session that hit that conflict: re-verify a sweep after resolving, not just after the original edit — conflict fixup is exactly when a sweep gets re-run carelessly. Renumbering 252316 across CHANGELOG.md turns cp1252 into cp1316, in a file nobody re-reads. Scope replacements to anchored forms (BACKLOG #252, ## 252.), never the bare number.

Verification

ledger_check.py     → no blocks
scan_forbidden.py   → clean

No code, no ledger number, no behaviour change. Does not touch docs/BACKLOG.md — deliberately, since another session is mid-resolution in that file.

🤖 Generated with Claude Code

…safely

Four mergeStateStatus values read as "can't merge" and three need
different fixes, which cost several sessions real time today.

BLOCKED is the trap: right after a push every required check is pending
and the PR reads BLOCKED, identical to genuinely failing. The fix is to
count failures in statusCheckRollup before diagnosing -- zero failures
plus pending checks means wait, not investigate.

Also records that armed auto-merge does NOT update a BEHIND branch in
this repo. Landing PR A puts PR B behind, and B then sits armed and
stalled until somebody rebases it. That is not obvious from the UI, which
shows auto-merge as enabled.

The conflict-resolution half is the part with teeth. BACKLOG.md and
CHANGELOG.md are single large append-target files, so they conflict most,
and --ours/--theirs both yield a file that passes every check while
silently dropping someone's work. No gate catches it because the result
is well-formed. The worked example is real: two PRs each adding a
"### Changed" block under [Unreleased], where the union was correct and
either wholesale resolution would have dropped published entries.

Closes with a find-and-replace warning found by the session that hit that
conflict: re-verify a sweep AFTER resolving, not just after the original
edit. Renumbering 252 to 316 across CHANGELOG.md turns cp1252 into
cp1316, in a file nobody re-reads.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wshallwshall
wshallwshall enabled auto-merge (squash) July 31, 2026 13:35
@wshallwshall
wshallwshall merged commit 8ba692d into main Jul 31, 2026
31 checks passed
@wshallwshall
wshallwshall deleted the worktrees-merge-triage branch July 31, 2026 13: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