wrap_up.py --remove: a TypeError in the branch-cleanup probe leaves a merged local branch behind nf-sf69 ← Beads

closed priority 2 task unassigned

Twinned from https://github.com/cfsh/ninefold/issues/721 by tools/beads/import_github.py's reconcile pass.

Unclaimed and unlabelled — inert backlog, per CLAUDE.md.

Observed

Wrapping nf-dev-f5-owner just now. Both worktrees removed cleanly; the last step did not:

``` ✓ removed worktree /root/nf/devs/f5-owner-f5 ✓ removed worktree /root/nf/devs/f5-owner ✓ pruned stale worktree registrations ⚠ kept local branch feat/f5-liveness — could not ask GitHub whether a PR merged it (TypeError: Gh.pr_list() got an unexpected keyword argument 'head') ```

The branch was merged — #701 at c026f26 — so it should have been deleted. I removed it by hand after checking, which is the recovery, but it is a manual step in the one command whose job is to leave nothing behind.

Why it is worth fixing rather than shrugging at

⚠️ The failure is silent in the direction that accumulates. Keeping the branch is the safe side and the tool says so, which is right. But every wrapped session now leaves one dead local branch in the shared clone, and nobody is looking at git branch in a repo where the worktrees are the visible unit. Ten resets from now that is ten branches, and the one that matters — a branch whose PR was *closed unmerged* — looks exactly like the other nine.

⚠️ A TypeError is not the failure this path is written to survive. It reads as "could not ask GitHub", which is what you would expect from a network or auth failure; it is actually a signature mismatch, i.e. a bug that fires 100% of the time rather than intermittently. The message sends the reader to the wrong cause.

Not diagnosed

Gh.pr_list on the checkout I looked at does take head (tools/nflib/gh.py:170, added by #645), so this smells like version skew between the nflib the tool imports and the one it was written against — plausible because wrap_up.py runs from the session's own worktree, and every worktree carries its own copy of tools/. I did not chase it further; the session was mid-wrap and the branch was already verified merged.

Whoever takes it: reproducing needs a session worktree whose branch predates the parameter, or a sys.path that resolves nflib somewhere unexpected.

Suggested shape
  1. Fix the call (or the signature) so the probe runs.
  2. Make a TypeError here loud rather than folded into the network-failure branch. Catching Exception around an API-shape question turns a deterministic bug into what looks like flakiness — the same class as #632's "the gate cannot tell *could not run* from *everything regressed*".
  3. Consider reporting kept branches in the *bare* run too, so a session sees the residue before it removes its tree and loses the ability to act on it.

Found while wrapping the design-004 chunk (#689).

Dependencies

None.

Comments

No comments.

Add a comment