wrap_up.py --remove crashes on branch cleanup: Gh.pr_list() has no head= argument, and two call sites pass one nf-jymv ← Beads

closed priority 2 task unassigned

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

Filed unclaimed by nf-dev-probe-gate on wrap-up — the first session to reach this path since the call was introduced, as far as I can tell.

What happened

./tools/pr/wrap_up.py --remove did the removals, then crashed on the branch-cleanup step and exited 1:

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

The mismatch

nflib/sessions.py calls pr_list(..., head=...) at two sites — :979 and :1438 — and nflib/gh.py:171 has no such parameter:

```python def pr_list(self, fields, *, state="open", base=None, author=None, limit=100) ```

The comment at sessions.py:975 explains why head= is wanted, and it is right: *"head= rather than filtering a page of recent PRs: a merged branch's PR can be arbitrarily far back"*. So the intent is sound and the argument was simply never added to Gh.pr_listgh pr list --head <branch> is the flag it wants.

Why it matters more than a kept branch
Fix

Add head: str | None = None to Gh.pr_list and append --head <branch> when set. Two lines, plus a test — ⚠️ and the test matters here, because both call sites are on paths that only run at wrap-up, which is exactly why this shipped: nothing exercises wrap_up.py --remove end-to-end, and a TypeError in a rarely-run arm is invisible until someone wraps.

Related: #635/#638 (board vs reality), #684 (the wrap-up predicate).

Dependencies

None.

Comments

No comments.

Add a comment