Repository navigation
fix(pr): recover failed async direct merges - #168378
Conversation
Allow explicitly confirmed recovery of an accepted, terminally failed direct REST merge only after an authoritative result reread and fresh ordinary admission. Retain the exact async failure and prior outcome through existing CAS ancestry; keep pending, expired, SHA-bearing, and changed-head outcomes fenced.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR allows explicit recovery of terminally failed async direct merges while preserving fresh admission checks and retained outcome history. Example: GitHub request 630b9d5e-3f2a-4f7e-8b0c-2d5f9a8c1e42 reports failed with no commit after main advances.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a source-confirmed merge-recovery dead end and remains useful; no actionable correctness or security findings were identified. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe maintainer merge tooling consumes prepared PR evidence and GitHub observations, dispatches head-pinned merges, and retains outcomes and captures in private Git history. flowchart TD
A[Operator recovery command] --> B[Retained outcome validation]
B --> C[Authoritative async result]
C --> D[Fresh merge admission]
D --> E[Successor outcome CAS]
E --> F[Pinned merge dispatch]
F --> G[Receipt reconciliation]
Technical reviewBest possible solution: Keep the focused recovery exception in the existing merge owner, preserving explicit operator confirmation, fresh admission, and exact outcome ancestry. Do we have a high-confidence way to reproduce the issue? Pinned main source establishes the dead end, and the author reports the new regression failing before the fix and passing afterward; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs the existing recovery owner with a narrowly qualified terminal-failure exception rather than clearing uncertainty records or adding automatic retries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0aee279a71af. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +70, Docs +1, Other +25. Total +96 across 5 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 10, 2026, 6:09 AM ET / 10:09 UTC. |
|
Landed at the exact reviewed head The only red shard on run 38043527834 was
The test fails the same way on clean main 0aee279, and this PR doesn't touch either file. The fixture fix is now on main as a5b1703. Proof for this change:
|
Allow explicitly confirmed recovery of an accepted, terminally failed direct REST merge only after an authoritative result reread and fresh ordinary admission. Retain the exact async failure and prior outcome through existing CAS ancestry; keep pending, expired, SHA-bearing, and changed-head outcomes fenced.
Allow explicitly confirmed recovery of an accepted, terminally failed direct REST merge only after an authoritative result reread and fresh ordinary admission. Retain the exact async failure and prior outcome through existing CAS ancestry; keep pending, expired, SHA-bearing, and changed-head outcomes fenced. Backport note: #178170 carried this change's async-failure admission check and tests (through #169595/#169739 conflict context) without the async_failure declaration, recovery selection, intent recording, and outcome validation, so every merge-run under set -u exited with "async_failure: unbound variable". The merge.sh conflict keeps the release form without the retired ClawSweeper review gate; the test file keeps the post-#169595 expectations already on the branch. (cherry picked from commit 1a6709e)
What Problem This Solves
A PR could become permanently unlandable through
scripts/prafter a routine race on a busymain. In that case, the immediate REST squash goes through the async merge endpoint and GitHub accepts it, returning a request UUID. The status poll then reports a terminalfailedresult, "Base branch was modified. Review and try the merge again.", with no merge commit. The retained outcome recordsaccepted: true.From that state:
merge-runreconciliation stops with "async direct merge did not complete; no resubmission".merge-recover --confirmed-operator-recoveryrefuses because ordinary recovery requires an unaccepted intent.The PR stays OPEN, CLEAN and green, with no sanctioned path to land it. This happened live on #168232. The synchronous form of the same provider rejection (HTTP 405 base-modified) already has a qualified recovery route (
recovery.providerRejection). The async form introduced in 38ed3ed never got one.Why This Change Was Made
merge-recover <PR> <OUTCOME_OID> --confirmed-operator-recoverynow also admits one specific accepted intent: an immediate REST intent with a retained UUID,asyncMerge.status: "failed"and a null SHA, on the unchanged head and method. Before admission it re-reads the async result authoritatively for that UUID and requires it to be byte-identical. It then runs fresh ordinary OPEN-head admission with every existing gate.The successor intent records
recovery.asyncFailurethrough the existing CAS ancestry, mirroringproviderRejection/staleHeadRetirement. The load-time validator also checks that the predecessor matches.Everything else stays refused: pending, enqueued, missing or expired, SHA-bearing, changed-head and replacement-head results. Outcome refs are never cleared, and there is no automatic resubmission.
merge-rest.mjsadditionally rejects an unmerged async result that carries a commit SHA.Production +30/−5. It covers the admission predicate, the authoritative re-read, provenance, and ancestry validation.
User Impact
Maintainers can recover a merge that GitHub definitively failed with one explicit, audited command, instead of leaving a green PR stranded or bypassing the tooling.
Evidence
test/scripts/pr-merge-rest.test.tsfails on main at recovery admission and passes with the fix.asyncFailureancestry, plus eight refusal cases: pending, enqueued, expired, SHA-bearing, changed result, changed head, replacement head, and failed checks.node scripts/check-changed.mjspasses formatting, typecheck and the selected guards. Its global dead-export scan flags three unchanged symbols on main (isPollVoteEchoText,PUBLIC_SESSION_ENTRY_SCRIPT,isClaudeLikeLiveAgent), which are unrelated to this diff.scripts/AGENTS.mdmerge-outcome doctrine is updated with the new route.