Skip to content

Keep finish cleanup alive when the source branch disappears first#342

Merged
NagyVikt merged 1 commit intomainfrom
agent/codex/tolerate-already-deleted-local-branch-in-2026-04-22-20-43
Apr 22, 2026
Merged

Keep finish cleanup alive when the source branch disappears first#342
NagyVikt merged 1 commit intomainfrom
agent/codex/tolerate-already-deleted-local-branch-in-2026-04-22-20-43

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Automated by gx branch finish (PR flow).

GitHub can delete the local source branch during PR merge while the Guardex
cleanup phase is still about to run its own branch delete step. That race was
failing finish even though the branch was already gone and the remaining cleanup
work could succeed.

This change makes the local cleanup step re-check branch existence before and
after `git branch -d`, treat an already-missing ref as informational, mirror the
behavior into the template script, and lock the path with a focused finish
regression plus metadata parity coverage.

Constraint: Finish cleanup must still fail on real local branch deletion errors
Rejected: Ignore all `git branch -d` failures | would hide genuine cleanup problems
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep the branch-exists recheck paired with the concrete already-missing log line in both runtime and template scripts
Tested: node --test test/finish.test.js
Tested: node --check bin/multiagent-safety.js
Tested: node --test test/metadata.test.js
Tested: openspec validate agent-codex-tolerate-already-deleted-local-branch-in-2026-04-22-20-43 --type change --strict
Tested: openspec validate --specs
Not-tested: live GitHub PR merge against the real repository before finish flow
@NagyVikt NagyVikt merged commit dc615ac into main Apr 22, 2026
@NagyVikt NagyVikt deleted the agent/codex/tolerate-already-deleted-local-branch-in-2026-04-22-20-43 branch April 22, 2026 19:42
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