Repository navigation
Description
Goal
Adopts backlog capture #128. Fifty stale task branches sat on the hub at M6 (one on www): every task start cuts a linked branch and nothing ever removes it — task finish merges with gh pr merge --rebase and no --delete-branch, and delete_branch_on_merge is off on both repos (a per-repo setting the framework cannot set for adopters and does not mention). Three layers, all Free-tier: (1) task finish deletes the head branch after a successful merge, the counterpart of task start creating it; (2) milestone close sweeps the linked branches of the milestone's closed tasks before the document gate — deleting only where the branch's PR merged or the branch is zero commits ahead of the default branch (rebase-merge rewrites commits, so "tip is an ancestor of main" is the wrong test: 43 of the 50 merged tips were not ancestors), reporting and never deleting anything else, and printing what it removed as part of the close's record; (3) status notes when delete_branch_on_merge is off, the way it notes contract drift, so adopters learn the setting exists. The decision function (merged / zero-ahead / keep) is pure and tested; the sweep is exercised against a fake tracker; milestone close 6 is the first live proof. The one-off backlog was swept by the operator on 2026-08-26 under the same two criteria (log on #128).
Requirements
M6-R8
Plan
- The decision, pure:
branchAction(merged, openPR bool, ahead int) (delete bool, reason string)— delete when the branch's PR merged, or when no PR is open and the branch is zero commits ahead of the default branch; keep (and say why) otherwise. Rebase-merge rewrites commits, so ancestry of the tip is never the test. Table-tested. - Tracker seams (
internal/tracker):PRgainsHeadRefandMerged;LinkedBranches(ref)(GitHub's linked-branch relation, whichtask startcreates throughgh issue develop— so the sweep sees exactly the branches the protocol made, whatever they were named);BranchAhead(repo, branch)via the compare API against the repo's default branch;DeleteBranch(repo, branch);RepoInfo(repo)for the default branch anddelete_branch_on_merge.gh apithroughout, Free-tier. task finishdeletes the head branch after a successful merge on both paths (ordinary and--bypass), printsdeleted branch task/…; a deletion failure is a note, never an error — the merge has happened and the record must say so first.milestone closesweeps after the verdict gates and before the record is gathered: for every task, every linked branch → PR merged? delete; no PR and zero ahead? delete; else keep and report. Prints one line per branch either way, so the close output is the record of what was removed and what was left and why; the closing comment carries the count. Idempotent: a refused close that already swept prints nothing the next time.milestone close 6is the first live proof (the branch of Decide the protocol-version story before 1.0 #114 is waiting for it).statusnotes when the repo'sdelete_branch_on_mergeis off, beside the contract-drift note — advisory, and an API failure is silently skipped as routing is.- Docs: SPEC §6's
task finishandmilestone closerows; the quickstart's step 5 ("the branch is gone") and step 8; the introduction's "What exists" sentence forstatus. The adopter's own setting is described as what it is — GitHub's, per repo, optional once the verbs clean up. - Tests ride (feat: request review from the reviewer-role holder #46):
branchAction; the sweep against a fake tracker (an embedded-interface fake with the four methods the sweep uses — the cli package has none today, this task adds the minimal one);PRInfoparsing for the new fields.go test ./...before the PR; the reviewer seat by dispatch;task finish 129— its own first live use of step 3.
Ask-the-human points
None identified yet — the implementer adds any before starting.
Activity
radiusred-cody commentedon Aug 26, 2026
Started by @radiusred-cody[bot].
feat: tracker seams for linked branches, branch deletion, and repo se…
feat: delete the merged head at task finish and sweep task branches a…
docs: state branch cleanup at finish and close, and the status note (#…
radiusred-cody commentedon Aug 26, 2026
Deviation: plan step 7 named a parsing test for
PRInfo's new fields (HeadRef,Merged); none rides. Why:PRInfoshells togh pr view --jsonand decodes in place — there is no seam to feed it JSON without restructuringinternal/tracker/github.go, which no task has done and this one should not do on the side. The fields were verified live instead (PR #127:head=task/114-…, merged=true, open=false), and the sweep's use of them is tested against the fake. A tracker-level fake or a decode seam is captured for the backlog.radiusred-cody commentedon Aug 26, 2026
Deviation: plan step 2 assumed GitHub's linked-branch relation would let the sweep "see exactly the branches the protocol made". It does not: the relation is dropped when the issue closes — live,
LinkedBranches(#114)(closed, branch still present) is empty while(#129)(open) lists its branch — and closed tasks are the whole target of the sweep. Why: verified by execution before the PR was reviewed, not after. The sweep now derives candidates from three sources — the relation (open tasks), the head refs of the task's PRs, and the conventionaltask/<n>-<slug>nametask startused (tasks that never had a PR) — and skips silently any candidate that no longer exists. Dry-run live over #114, #72, #129:task/114-…: deleted (PR merged); #72's branch silent (swept by hand earlier);task/129-…: kept (open PR). The first PR description overstated the relation's coverage; corrected in the same minute.fix: find closed tasks' branches by PR head and convention, not the d…
radiusred-cody commentedon Aug 26, 2026
Deviation (superseding the previous Deviation's premise): the linked-branch relation is dropped once a PR attaches to the issue, not when the issue closes —
LinkedBranches(#129)listed its branch before PR #130 existed and is empty after (checky's reproduction on #130; my earlier observation was taken minutes before the PR opened). Why: the relation therefore contributes only for PR-less tasks; the candidate set stays the three-source union with the PR heads carrying every task that had a PR. Also from the review, three deletion paths closed: a merged PR's head is deleted only while its tip still equals the PR's frozenheadRefOid(commits pushed after the merge are kept, with the reason); when several PRs share a head the one that forbids deletion wins (open over merged over closed) instead of the last one the API listed; a fork's head and the repository's default branch are never candidates. The sweep now runs after the last gate, so it is the successful close that records what was removed — and its failures are notes, never an abort of a close that passed every gate.fix: sweep after the last gate, guard merged heads by SHA, forks and …
fix: never read an unknown merge SHA as untouched; pin the default-br…
feat: tracker seams for linked branches, branch deletion, and repo se…
feat: delete the merged head at task finish and sweep task branches a…
docs: state branch cleanup at finish and close, and the status note (#…
fix: find closed tasks' branches by PR head and convention, not the d…
fix: sweep after the last gate, guard merged heads by SHA, forks and …
fix: never read an unknown merge SHA as untouched; pin the default-br…