You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stop corrupting PRs whose base changed during conflict resolution (#39)
When a PR sat in autorestack-needs-conflict-resolution and a human
changed its base instead of resolving the conflict, the resume run
rebuilt its state with `gh pr list --head <base> | .[0]`. On a
long-lived base like `spark` that returns an unrelated ancient merge: in
[run
26764629741](https://github.com/scortexio/sensei/actions/runs/26764629741/job/78887430408)
it picked a 2022 release merge into the deleted branch
`spark-v1.13.0-rc-dev`, pushed a merge commit built against it onto the
PR, removed the conflict label, then crashed setting the base to the
missing branch.
The resume now recovers base/target/squash from a marker the
squash-merge run embeds in the conflict comment, and bails before any
mutation when the marker is missing or the PR's current base no longer
matches the one we left it on (the manual-retarget case). Target
existence is checked as a backstop, and the base retarget runs before
the label is dropped so a failure leaves the PR resumable.
New unit test `tests/test_conflict_resolution_resume.sh` covers the
three dead-end paths (missing marker, manual retarget, missing target)
and the happy-path ordering: push the cleaned-up head, retarget the
base, then remove the label.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
echo"⚠️ '$PR_BRANCH' still conflicts; re-posted the conflict comment, will retry on next push"
224
-
return 1
225
-
fi
226
-
log_cmd git push origin "$PR_BRANCH"
236
+
#Recover them from the marker the squash-merge run left in the conflict
237
+
#comment.
238
+
local MARKER
239
+
MARKER=$(read_state_marker "$PR_BRANCH")
240
+
if [[ -z"$MARKER" ]];then
241
+
echo"⚠️ No autorestack state marker on $PR_BRANCH; cannot resume safely. Removing the label."
242
+
abandon_resume "$PR_BRANCH""ℹ️ autorestack could not find its state marker on this PR, so it will not update the stack automatically. If this PR still needs its base updated, update its base manually."
echo"⚠️ Recorded target branch '$NEW_TARGET' no longer exists; abandoning resume of $PR_BRANCH."
270
+
abandon_resume "$PR_BRANCH""ℹ️ The branch this PR was being retargeted onto (\`$NEW_TARGET\`) no longer exists, so autorestack stepped back. If this PR still needs its base updated, update its base manually."
0 commit comments