Skip to content

fix(branch_sweep): keep the error when a delete fails, and stop early - #282

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/repo-cleanup-82k6kh
Aug 25, 2026
Merged

fix(branch_sweep): keep the error when a delete fails, and stop early#282
Jammy2211 merged 1 commit into
mainfrom
claude/repo-cleanup-82k6kh

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

What happened

The first org-wide delete run (run 32866256086) failed 99 times across five repos and the log recorded nothing but the word FAILED, 99 times:

  FAILED   chore/agents-md-standardization
  FAILED   chore/committed-tool-discovery
  ... 97 more
→ 0 deleted, 99 failed

Nothing was deleted, which is the right outcome. But the run could not say why, because the push was written as:

git push origin --delete "$b" >/dev/null 2>&1

That is the same defect this tool exists to avoid, one level up: a result with no information in it, presented as though it were a finding. The error text is the only thing a failed push carries.

Changes

  • Keep the error. The push's stderr is captured and the salient line printed beside the branch — FAILED <branch> — <reason>.
  • Stop after three. Delete permission is a property of the credential, not of the branch, so the first few failures already answer the question for all of them. Continuing buries the reason under 96 more identical lines and spends API budget proving something already known.

Checks

pytest tests/510 passed · check_skill_line_counts.sh → OK · repos_sync.py --checkall 12 green.

Both changes are pinned by tests against an origin configured receive.denyDeletes — the closest local stand-in for a credential that may read but not delete. One asserts the reason survives; the other that the run stops at three, exits non-zero, and leaves every branch in place.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KwqicJpMqmcT5RVbyNwdKq


Generated by Claude Code

The first org-wide delete run failed 99 times across five repos and the log
recorded nothing but the word FAILED, 99 times. Nothing was deleted, which is
the right outcome — but the run could not say why, because the push was
written as `git push origin --delete "$b" >/dev/null 2>&1`.

That is the same defect this tool was built to avoid, one level up: a result
with no information in it, rendered as though it were a finding. The error
text is the only thing a failed push carries. Keep it.

Two changes:

- The push's stderr is captured and the salient line printed beside the
  branch, so `FAILED <branch> — <reason>` says what actually happened.
- After three consecutive failures the repo is abandoned with an explicit
  note. Delete permission is a property of the credential, not of the branch,
  so the first few already answer the question for all of them; continuing
  only buries the reason under 96 more identical lines and spends API budget
  proving something already known.

Both are pinned by tests against an origin configured `receive.denyDeletes`,
the closest local stand-in for a credential that may read but not delete: one
asserts the reason survives, the other that the run stops at three, exits
non-zero, and leaves every branch in place.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KwqicJpMqmcT5RVbyNwdKq
@Jammy2211
Jammy2211 merged commit 0e7c1e4 into main Aug 25, 2026
2 checks passed
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