Skip to content

Backlog capture: milestone close sweeps only its own tasks' branches — stale branches from earlier closes are never swept #167

Closed

Description

@radiusred-cody

Backlog capture (deliberately unlabeled — not protocol traffic until adopted via task new). Operator question, 2026-08-30: "there are still some stale branches in the repo, should they not have been closed by the tasks and swept up by the milestone closing?"

What was found. radiusred/numberguess still carries task/8-cycle-1-milestone-record-m1-r6-merge-doc and task/14-cycle-2-milestone-record-docs-merge-docs — both empty (0 ahead of main), both from milestones closed on 2026-08-28 (#3, #9). Their closes ran on v1.0.1 in the crew's container with the distribution gh 2.46, where gh pr checks --json fails inside gh and the sweep bailed with no refusal — #119 findings 21 and 30, fixed in 1.0.3 as GH_TOO_OLD. The M4 close (#15, on 1.0.3, 2026-08-29) swept its own branches correctly and left those two standing, because sweepBranches (internal/cli/branches.go) visits only the closing milestone's tasks. Nothing in the protocol ever comes back for a stale branch from an earlier close: a task whose issue is closed and whose branch is empty or merged is invisible to every later verb.

The scaffold branches (codecrew-init on numberguess, bootstrap-codecrew on snake) are the separate case already on the record — #164 finding 68, folded into M7-R4 (the bootstrap as a protocol act, so its branch becomes a task's).

Proposed shape

  • milestone close sweeps every task/<n>-* branch in the milestone's repos whose task issue is closed — not only the closing milestone's — under the same two delete conditions (PR merged and the tip at the merged commit, or no open PR and nothing beyond the default branch), reporting the rest. The sweep already lists candidates by name; the change is the candidate set.
  • status reports stale task branches (a closed task's branch still on the remote) the way it reports contract drift and the delete-on-merge setting — so a skipped sweep is visible before the next close, not after.
  • The delete conditions do not change: never a branch with commits beyond the default branch, never a fork's head, never the default branch.

Not in scope: local checkouts (git branch -vv shows [gone]; the CLI cannot reach a working copy), and the scaffold branch (finding 68 / M7-R4).

Source: radiusred/numberguess branches as of 2026-08-30; CHANGELOG.md 1.0.3 ("The floor is a refusal, not a stack trace") and 1.0.0 ("A close leaves the repo clean", #129).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions