Problem
/cleanup-feature relies on gh pr merge --delete-branch to remove the feature branch from the remote after merge. gh can succeed at the merge while silently failing at the branch deletion (e.g. branch protection rules, missing permission, race with another tool). The skill currently treats overall success of the gh command as proof that the remote branch is gone.
Proposed fix
After gh pr merge --delete-branch returns success, explicitly verify the remote branch is actually deleted:
```bash
gh api -X GET repos/{owner}/{repo}/branches/{branch} 2>&1 | grep -q "Not Found" \
|| git ls-remote --exit-code --heads origin > /dev/null 2>&1 \
&& echo "WARN: remote branch still exists after merge"
```
(Use whichever check is more reliable in practice — git ls-remote is cheaper.)
If the branch still exists, attempt one explicit git push origin --delete <branch>. If that also fails, surface a clear warning with the manual remediation command.
Acceptance
- Cleanup logs include a "verified remote branch deleted" line on the happy path.
- If deletion silently fails, cleanup emits a WARN and the manual
git push origin --delete command.
- Unit/integration test that simulates a branch-still-present-after-merge condition.
Source
Follow-up from wire-autopilot-phase-subagents change run (2026-05-10).
Problem
/cleanup-featurerelies ongh pr merge --delete-branchto remove the feature branch from the remote after merge.ghcan succeed at the merge while silently failing at the branch deletion (e.g. branch protection rules, missing permission, race with another tool). The skill currently treats overall success of theghcommand as proof that the remote branch is gone.Proposed fix
After
gh pr merge --delete-branchreturns success, explicitly verify the remote branch is actually deleted:```bash
gh api -X GET repos/{owner}/{repo}/branches/{branch} 2>&1 | grep -q "Not Found" \
|| git ls-remote --exit-code --heads origin > /dev/null 2>&1 \
&& echo "WARN: remote branch still exists after merge"
```
(Use whichever check is more reliable in practice —
git ls-remoteis cheaper.)If the branch still exists, attempt one explicit
git push origin --delete <branch>. If that also fails, surface a clear warning with the manual remediation command.Acceptance
git push origin --deletecommand.Source
Follow-up from
wire-autopilot-phase-subagentschange run (2026-05-10).