A filing pull request closed without merging still orphans its td-record/<id> branch and td/<id> reservation, and no sweep looks at either
Id: TD-PPagop-26082310 · Status: resolved · Filed: 2026-08-23 · Resolved: 2026-08-28 · Ref: https://github.com/Poetic-Poems/agent-ops/pull/907
techdebt_file_debt (lib/tech-debt-file.sh) now cleans up after itself on
every failure past the reservation (TD-PPagop-26082203, PR #709): the
td-record/<id> branch is deleted and the td/<id> reservation released
before it returns. That closes the code path. It does not close the second
route the same record describes, which involves no code defect at all.
Once the filing pull request has opened successfully, the function has returned 0 and is out of the picture. If a human — or another automated pass — then closes that pull request without merging it, because the record is a duplicate, is unwanted, or was simply superseded, both branches stay exactly where they were:
td-record/<id>, still carrying the record commit.td/<id>, the reservation lock..github/workflows/release-td-branch.ymlreleases a reservation only in response to a push tomainthat adds a newtech-debt/<id>.md. The record never reachesmainthis way, so that trigger never fires.
Neither is swept. scripts/sweep-orphan-branches.sh’s matching-refs pass
(scripts/sweep-orphan-branches.sh:373) lists exactly two prefixes — td/
and $branch_prefix — so td-record/ is never listed at all; and a bare
td/<id> whose sole commit ahead is the reservation commit is one that pass
deliberately leaves alone (scripts/sweep-orphan-branches.sh:225, issue
#545), because the commit’s shape cannot say whether <id> was since filed
from some other branch. So both refs accumulate silently, and the id is
retired without ever having been used.
TECH-DEBT.md does not cover this either. Its “Filing an item” step 2 says
that abandoning a filing — “closing the PR without merging and deleting the
branch” — releases the reservation the same way abandoning a claim does, but
that sentence is written for the human workflow, where the filing commit
lands on td/<id> itself and there is only one branch to delete. A pipeline
filing puts the record on td-record/<id> instead, so a human following that
instruction to the letter deletes one branch and leaves the other. The
td-record/ branch is not mentioned anywhere in TECH-DEBT.md.
Suggested fix: either teach scripts/sweep-orphan-branches.sh to sweep
the td-record/ prefix as well — recovering or deleting a td-record/<id>
whose pull request is closed, and, for the td/<id> behind it, checking
whether <id> was ever actually filed rather than exempting every
reservation unconditionally — or, more cheaply, document the two-branch
cleanup in TECH-DEBT.md so whoever closes a pipeline-filed pull request
deletes both. The sweep is the more durable of the two, since it does not
depend on anyone remembering.
Noticed while reviewing PR #709, which resolved TD-PPagop-26082203’s code path and explicitly scoped this route out.