Symptom
For pantry/pkgx-style dependency updates (curl.se, gnu.org/gcc/libstdcxx, gnu.org/gmp, gnu.org/mpc, gnu.org/mpfr, etc.), every buddy-bot run cycles through:
- Detects branch already exists with no open PR
- Deletes the branch (cleanup path)
- Re-creates the branch from main
- File-update generator returns "no file changes"
- Skips PR creation
- Branch stays → next run finds it as orphan → loop
Example from stacksjs/bun-query-builder (run):
Creating PR for group: Major Update - curl.se (1 updates)
🔄 Branch buddy-bot/update-major-update-curlse already exists, checking for associated PR...
🧹 Branch buddy-bot/update-major-update-curlse exists but has no open PR, cleaning up...
✅ Created branch buddy-bot/update-major-update-curlse from main (this is in a later log, after deletion)
ℹ️ No file changes generated for group Major Update - curl.se, skipping PR creationNet result: a stale branch with an empty commit, deleted and re-created on every scheduled run. No PR is ever opened. Cleanup eventually deletes it but the cycle repeats.
Root cause
The order of operations in createPullRequests (src/buddy.ts around line 478) is:
deleteBranch(branchName)← happens unconditionally when no open PRgenerateAllFileUpdates(group.updates)- If empty: skip PR creation
- (Branch already deleted, but next run re-creates it on a fresh attempt)
For pantry/pkgx deps, the file-update generator legitimately produces no JS file changes (the dep is satisfied by deps.yaml or pantry.lock, which buddy-bot may not be writing for these dep types). So the "skip" path triggers every time.
Fix suggestions
In rough priority:
- Generate file updates BEFORE deleting the existing branch. If the generator returns empty, don't touch the branch — leave it alone. Saves the create/delete churn.
- For groups that can never produce file changes (pantry dep updates with no corresponding lock/yaml writer), don't put them through the PR pipeline at all. Surface them on the dashboard instead.
- At minimum, log it clearly so the orphan/recreate loop is visible.
Blast radius
Every stacksjs repo with pantry/pkgx deps in its dependency graph accumulates these orphan branches. We've now seen 5–8 such orphans accumulate per repo per week.