Skip to content

Abort the run when a git/gh command fails unexpectedly#52

Draft
Phlogistique wants to merge 1 commit into
claude/git-merge-abort-crash-sc64z6from
claude/run-try-die-wrappers
Draft

Abort the run when a git/gh command fails unexpectedly#52
Phlogistique wants to merge 1 commit into
claude/git-merge-abort-crash-sc64z6from
claude/run-try-die-wrappers

Conversation

@Phlogistique

Copy link
Copy Markdown
Collaborator

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.

Stacked on claude/git-merge-abort-crash-sc64z6.

https://claude.ai/code/session_01STkeSJ7cLrmrNn4aTDYkwH


Generated by Claude Code

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
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.

2 participants