Abort the run when a git/gh command fails unexpectedly#52
Draft
Phlogistique wants to merge 1 commit into
Draft
Conversation
set -e is suppressed inside if/&&/|| conditions and everything they call, including the whole body of update_direct_target, which both entry points invoke as a condition. So most failures there fell through silently: a failed git checkout let the merges and the final git reset --hard run on the previously checked-out branch (corrupting it, in main's loop over several child PRs), and a failed git commit-tree let the function return success, after which main retargeted the PR onto a base its head does not contain. A failed conflict comment still added the label, leaving a resume with no state marker. Every log_cmd call site now states its failure policy: run (log, execute, die on failure; die's explicit exit aborts from any context) or try (log, execute, hand the status to the caller) for the merges whose failure is an expected outcome. set -e stays as a backstop only. https://claude.ai/code/session_01STkeSJ7cLrmrNn4aTDYkwH
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.
set -eis suppressed insideif/&&/||conditions and everything they call, including the whole body ofupdate_direct_target, which both entry points invoke as a condition. So most failures there fell through silently: a failedgit checkoutlet the merges and the finalgit reset --hardrun on the previously checked-out branch (corrupting it, in main's loop over several child PRs), and a failedgit commit-treelet the function return success, after which main retargeted the PR onto a base its head does not contain. A failed conflict comment still added the label, leaving a resume with no state marker.Every
log_cmdcall site now states its failure policy:run(log, execute, die on failure; die's explicitexitaborts from any context) ortry(log, execute, hand the status to the caller) for the merges whose failure is an expected outcome.set -estays as a backstop only.Stacked on
claude/git-merge-abort-crash-sc64z6.https://claude.ai/code/session_01STkeSJ7cLrmrNn4aTDYkwH
Generated by Claude Code