clan-lab's orphaned-tag sweep asks doctl for a field it doesn't have (ResourceCount vs DropletCount) — 170+ dead clan-lab-expires-* tags on the account #740
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#740
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
cmd_reapin.claude/skills/clan-lab/clan-labfinishes by sweeping expiry tags that no droplet holds any more:ResourceCountis not a field doctl renders. On doctl 1.160.1 it prints<nil>for every row, so awk compares the string"<nil>"against"0", never matches, and the sweep has never deleted a single tag. The real field isDropletCount— verified live on the account just now:Consequence: 170+ orphaned
clan-lab-expires-<epoch>tag objects are sitting on the DigitalOcean account, the oldest dating to ~2026-07-09 when the CLI was first validated. They cost nothing and are not billing — this is clutter, not an outage — but the sweep reads as working and does not.Found while fixing #723 (the reaper cron had never run at all, for an unrelated PATH reason). Confirmed still true after a successful reap: the droplet went, the tag stayed.
Also worth fixing in the same pass —
set_expiry, same file, line 93:Under
set -euo pipefail, when$oldis empty this line evaluates to false and, not being the last command in the function, kills the whole script. Soclan-lab extendon a lab that somehow has noclan-lab-expires-tag dies silently part-way through instead of setting the new expiry. Line 95 already guards itself with|| true; line 93 does not.Why a session, not the swarm
Both fixes are in
.claude/skills/clan-lab/clan-lab. That path is permission-gated for an agent session under the current harness (.claude/**writes need an interactive grant), so #723's session could not make them and filed this instead. A session with the grant, or a human, can do both in one commit;scripts/tests/clan-lab-reap-test.shis the place to guard them, and its comment block already names theResourceCounttrap and explains why it deliberately does not assert the sweep today (a fixture printing0would make a no-op look green).Session report — one bug confirmed and swept, one claim corrected, one grant left
Ruled by agent under ADR 0174 — veto anytime.
1. The
ResourceCountbug: confirmed, and it is worse than a typoVerified live on doctl 1.160.1.
tag listhas exactly two columns:The part worth carrying forward is how doctl fails: an unknown
--formatcolumn is not a non-zero exit and not a message on stderr. It prints the
literal
<nil>in that position and exits 0. Soawk '$2 == 0'compared"<nil>"to0, never matched, the pipeline exited 0, and the sweep read asworking in the code, in the log, and in the exit status. That is #723's
enforcer-that-never-ran one layer down — a filter that never matched — and it is
invisible for the same reason: a cleanup job that correctly finds nothing to do
looks identical to one that cannot see. Written up as GOTCHAS #75.
2. Swept live — 172 gone, and the fixed CLI is what swept them
Not a hand-rolled one-liner: the candidate patch below was applied to a copy and
clan-lab reaprun from it, so the fix is its own proof.Both halves of the filter are exercised by what survived:
clan-lab,idss-707-probeandssh-timing-test-691all have DropletCount 0 and were leftalone by the prefix test, and all five account droplets (
matou-prod,mail.matou.nz,mail.mauke.network,matou-workstation,idss-gateway-rehearsal-c-8bc1) were untouched.Why this was a two-way door: all 172 names were captured before deletion and
each is recreatable with
doctl compute tag create <name>; no droplet held anyof them; nothing else on the account matched the prefix; no spend; no
security-posture change. The full name list is in the next comment for the
record.
3. The
set_expiryclaim does NOT reproduce — correcting the ticketIt is the opposite way round. bash exempts a failing non-final component of
an
&&list fromset -e; what it does not exempt is a function whose lastcommand is a false
&&list, because the function then returns 1 to its caller.Line 93 is not last — line 95 follows it and ends
|| true— so nothingpropagates:
And end to end, against the unpatched CLI with a stub doctl returning no
tags for
droplet get:So
extendon a lab with no expiry tag works today. The line is still worthchanging — it is a landmine one edit away from being real (move it, or delete
line 95, and it returns 1 into a
set -ecaller) — but the fix below isjustified by something that does bite, found while writing the test for it:
two expiry tags on one droplet. Reachable, because it is exactly what a
set_expirythat tagged and then failed to untag leaves behind.$oldis thentwo lines, and
--tag-name "$old"passes both names as a single newline-joinedargument. That untag is the last command of its
&&list, so its failuredoes kill
extendunderset -e— one stuck droplet poisoning every laterextend on it. The patch untags and drops each old tag on its own.
4. The patch — proven, 8/8
scripts/tests/clan-lab-reap-test.shgrows 5 -> 8 cases on branch740-clan-lab-tag-sweep(8fa8da8a). Case 5 (the sweep) and case 7 (thetwo-tag droplet) are red against today's CLI and green against this patch;
case 6 pins the
extendbehaviour from §3 and passes either way.The key move is in the stub, and it answers the question the old comment block
raised: the stub
doctlnow servestag listper requested column, exactlyas the real one does,
<nil>included. A faithful stub dissolves the dilemmainstead of documenting it — ask for
ResourceCountand the test fails the wayproduction failed, so no fixture can make a no-op look green.
Verify with:
Landed on
main(9b3e69b9): GOTCHAS #75 + STATUS.md. The test is deliberatelynot on main — a knowingly-red suite there is an invitation to soften an
assertion rather than fix the code, which is the same lie the original comment
block was avoiding.
5. Why this is not closed
See the
## Why humanbelow. Everything except the two hunks is done.Record: the 172 orphaned tag names deleted 2026-08-24
Captured before the sweep so the action is literally revertible —
doctl compute tag create <name>recreates any of them. Kept here because a two-way-door ruling is only two-way if the way back is written down.172 names
Why human
Ben's hands, for exactly one thing: an interactive permission grant.
Both remaining hunks are in
.claude/skills/clan-lab/clan-lab. The harness gateswrites under
.claude/**behind an interactive grant — that is the interlock onan agent editing its own configuration and skills, and this session is an
unattended one-shot with no one to ask. There is no user-configured deny rule to
route around; the gate is the built-in one, and the honest options were "get the
grant" or "stop that part". Manufacturing the permission for myself — a
sedthrough Bash, or an allow-rule added tosettings.json— would beself-authorizing past a safety control, which is the ratchet ADR 0174 §3 names
even though a shell-script edit is otherwise a textbook two-way door.
So this is not a ruling anyone needs to make, and it carries no proposed
default for a later session to adopt under ADR 0174 §1: the residue is a
mechanical grant, not a judgement.
The ask, ~2 minutes:
git checkout 740-clan-lab-tag-sweep.claude/skills/clan-lab/clan-lab(2 hunks:
set_expiry,cmd_reap).bash scripts/tests/clan-lab-reap-test.sh->8/8 passed.main, and roll STATUS.md's #740 lead from"BLOCKED" to shipped.
Everything else is already done and needs nothing: the 172 orphaned tags are
swept off the account, GOTCHAS #75 and STATUS.md are on
main(9b3e69b9), andthe red-before-green test is pushed (
8fa8da8a). The account is clean today —what is still missing is only the fix that keeps it clean, so the tags will begin
re-accumulating from the next
clan-lab create, one per lab, harmlessly.One note for whoever does step 4: the hourly cron runs from
/home/dev/swarm/Matou/idss/scripts/clan-lab-reap.sh, a separate checkoutsitting on
09ca7197. It needs a pull before the fix is live on the cron path.Close report (Ben, 2026-08-24)
The one-grant residue is done by human hands, exactly per the ask:
git checkout 740-clan-lab-tag-sweep→ test RED on case 5 (sweep), reproduced..claude/skills/clan-lab/clan-lab→bba35ba; test 8/8 on the branch.main→39552ea. One conflict:scripts/tests/clan-lab-reap-test.shhad grown a case 5 on main from #741 (the REAP_* production shape). Kept both — #741's case stays 5, the #740 cases are now 6/7/8 → 9/9 green.dd8aec9)./home/dev/swarm/Matou/idssfast-forwarded to main, soclan-lab-reap.shnow runs the DropletCount sweep.Closing.