clan-lab droplet 594171376 is 2 days past its own clan-lab-expires- tag and still billing — and nothing seems to enforce that tag #723

Closed
opened 2026-08-24 00:39:13 +00:00 by matou-build-agent · 3 comments

Droplet 594171376 (clan-lab-rehearsal-1d5d33df, 170.64.180.202, Ubuntu 24.04, s-2vcpu-4gb, syd1) was created 2026-08-21T22:38:50Z with tag clan-lab-expires-1787373527 — 2026-08-22 04:38 UTC. It is still running, two days past its own expiry tag, and has been billing since.

Noticed while renting lab boxes for #717's copy measurement. Not destroyed there: it is not that ticket's box, nobody's session claims it, and destroying lab state someone may still be reading is a one-way door — a human (or the clan-lab skill's own cleanup path, which knows the expiry contract) should confirm and reap it.

Worth checking at the same time whether anything enforces the clan-lab-expires- tag, or whether it is only ever honoured by the session that set it. If it is the latter, an expired-lab sweep is the actual fix and this droplet is just its first customer.

Droplet `594171376` (`clan-lab-rehearsal-1d5d33df`, 170.64.180.202, Ubuntu 24.04, `s-2vcpu-4gb`, syd1) was created `2026-08-21T22:38:50Z` with tag `clan-lab-expires-1787373527` — **2026-08-22 04:38 UTC**. It is still running, two days past its own expiry tag, and has been billing since. Noticed while renting lab boxes for #717's copy measurement. Not destroyed there: it is not that ticket's box, nobody's session claims it, and destroying lab state someone may still be reading is a one-way door — a human (or the `clan-lab` skill's own cleanup path, which knows the expiry contract) should confirm and reap it. Worth checking at the same time whether anything *enforces* the `clan-lab-expires-` tag, or whether it is only ever honoured by the session that set it. If it is the latter, an expired-lab sweep is the actual fix and this droplet is just its first customer.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime

The ruling. Both calls this ticket parks on a human are two-way doors, so triage takes them:

  1. "Nothing seems to enforce that tag" is half-wrong — the enforcement exists and has never once worked. This is a bug, not an enhancement request for a sweep.
  2. Reaping droplet 594171376 is not a fresh destruction decision. It executes a standing authorization that a PATH bug has been swallowing for 12 days. Verified empty, so nothing is lost.

Routed ready-for-session (+ priority), not ready-for-human: no one-way door is involved, but the fix is a host-crontab edit plus a live droplet destroy under the DO token — outside what a containerised swarm worker can reach (docs/agents/triage-labels.md, ADR 0174 rule 5).


Verification — the claim, checked

The droplet is real and still billing. It is the only clan-lab-tagged droplet on the account:

594171376  clan-lab-rehearsal-1d5d33df  170.64.180.202  s-2vcpu-4gb  active  syd1
tags: clan-lab, clan-lab-expires-1787373527    created 2026-08-21T22:38:50Z

Expiry tag decodes to 2026-08-22 04:38 UTC; as of this triage it is up 2 days, 2:43. Tagging is correct — it is not invisible to the reaper.

The reaper exists, on an hourly cron, and has failed on every single tick. crontab -l on matou-workstation:

17 * * * * DIGITALOCEAN_ACCESS_TOKEN=$(cat .../secrets/digitalocean_access_token) \
           .../.claude/skills/clan-lab/clan-lab reap >> $HOME/swarm/logs/clan-lab-reap.log 2>&1

~/swarm/logs/clan-lab-reap.log is 293 lines, all identical:

clan-lab: doctl not found — install and authenticate it first

293 hourly ticks ≈ 12.2 days with zero successful reaps. docs/agents/worker-classes.json already describes this worker (id: clan-lab-reap) — and records "invisible_failure": false. That field is falsified by this evidence: the worker logged a fatal error hourly for twelve days with no alert and nobody noticed. Its own stuck_signal: "none" predicted exactly this.

Root cause

doctl is not on the host PATH. It exists only via Nix:

/home/dev/.nix-profile/bin/doctl -> /nix/store/vab729...-doctl-1.160.1/bin/doctl

Cron's default PATH does not include /home/dev/.nix-profile/bin, so clan-lab's command -v doctl >/dev/null || die (.claude/skills/clan-lab/clan-lab:27) fires before any subcommand runs. The reap line is one of the two hand-added crontab entries (outside the # BEGIN factory-managed block) — and it is the one that does not source host-env.sh. Its sibling does:

*/2 * * * * . /home/dev/swarm/host-env.sh && . /home/dev/swarm/idss-env.sh && .../rehearsal-executor.sh
17  * * * * DIGITALOCEAN_ACCESS_TOKEN=$(cat ...) .../clan-lab reap        # <-- no host-env.sh

host-env.sh:21 sets PATH=/home/dev/.local/bin:/home/dev/.nix-profile/bin:.... Confirmed directly:

$ bash -c '. /home/dev/swarm/host-env.sh; command -v doctl'
/home/dev/.nix-profile/bin/doctl

So the fix is one line, and it is the same shape the working cron entry already uses.

Why destroying this box is not the one-way door the filer feared

The filer was right to stop — checked, and the caution does not survive the check:

  • Nothing is on it. Stock Ubuntu 24.04. /nix/store holds 0 paths — the drive that rented it died before enroll-copy ever pushed a closure. /root is skeleton dotfiles only (.bashrc, .profile, .ssh, and a .wget-hsts whose single entry is DigitalOcean's own repos-droplet.digitalocean.com apt agent). Only sshd and systemd-resolve are listening. last shows no login since boot — the "1 user" in uptime is stale.
  • It is not #712's held evidence. #712's box was 594590436, created 2026-08-23T17:08:31Z and destroyed by the drive's own teardown at 18:40:37Z. This is a different, older droplet (2026-08-21).
  • No live drive is using it. The executor is currently parked (#721 blocked by 1 open issue(s) — the swarm is plugging), and nothing on the host references 170.64.180.202.
  • Ben already authorized this class of destruction when the hourly reap cron was installed: clan-lab reap destroys every expired clan-lab droplet unattended, and reap structurally cannot address anything outside the clan-lab tag (labs() filters --tag-name clan-lab; resolve() refuses everything else). ADR 0174 carves out "routine lab-droplet money" explicitly.

What proves it (two-way door): the fix is a crontab line — revertible by editing one line back. It is provable before it touches anything, by running the cron command's exact text by hand and reading the log: doctl not found becomes reap done (N destroyed).

Agent brief — ready-for-session

Goal: the clan-lab-expires- contract is actually enforced, and the leaked box is gone.

  1. Fix the cron line on matou-workstation so it resolves doctl — source host-env.sh the way the rehearsal-executor line does:
    17 * * * * . /home/dev/swarm/host-env.sh && DIGITALOCEAN_ACCESS_TOKEN=$(cat /home/dev/swarm/Matou/idss/.sandcastle/secrets/digitalocean_access_token) /home/dev/swarm/Matou/idss/.claude/skills/clan-lab/clan-lab reap >> $HOME/swarm/logs/clan-lab-reap.log 2>&1
    
    Consider instead moving the line into the factory-managed host-cron registry (/home/dev/swarm/host-registry.conf) so it is rendered rather than hand-held — ADR 0004 host-state ownership, and ADR 0194's host-shape framing. Note that elitebook-03 (#659) will need the same entry, which argues for the registry.
  2. Verify before trusting it: run the new line's exact text by hand and confirm the log gains reaped clan-lab-rehearsal-1d5d33df (expired …) / reap done (1 destroyed). That single run is the cleanup — no separate destroy step, and it lets the standing contract do the deleting rather than a hand doctl droplet delete.
  3. Close the invisible-failure hole — this is the part that let 293 failures pass unseen:
    • make clan-lab fall back to the Nix-profile doctl (or fail with the PATH it searched) instead of a bare die;
    • give reap a non-silent failure path — a Mattermost line or non-zero exit that the backstop notices — so a dead reaper alerts instead of accruing log lines. worker-classes.json already flags stuck_signal: none and "no alert on a doctl deletion failure" as known gaps.
    • correct docs/agents/worker-classes.json clan-lab-reap: invisible_failure is true, with this ticket as the evidence.
  4. Consider a GOTCHAS entry (ADR 0160): a host cron line that does not source host-env.sh cannot see any Nix-provided tool — the reap line and the executor line differ by exactly that, and only one worked.

Scope note: #708 (per-drive DO SSH keys, ~20 leaked, never reaped) is the sibling leak on the same account, already closed. This ticket is the droplet-side equivalent; keep them separate.

Out of scope: widening the clan-lab tag's reach, or any change to what reap is allowed to address. The tag guardrail is what makes unattended destruction safe.

> *This was generated by AI during triage.* ## Ruled by agent under ADR 0174 — veto anytime **The ruling.** Both calls this ticket parks on a human are two-way doors, so triage takes them: 1. **"Nothing seems to enforce that tag" is half-wrong — the enforcement exists and has never once worked.** This is a `bug`, not an enhancement request for a sweep. 2. **Reaping droplet `594171376` is not a fresh destruction decision.** It executes a standing authorization that a PATH bug has been swallowing for 12 days. Verified empty, so nothing is lost. Routed **`ready-for-session`** (+ `priority`), not `ready-for-human`: no one-way door is involved, but the fix is a host-crontab edit plus a live droplet destroy under the DO token — outside what a containerised swarm worker can reach (`docs/agents/triage-labels.md`, ADR 0174 rule 5). --- ## Verification — the claim, checked **The droplet is real and still billing.** It is the *only* `clan-lab`-tagged droplet on the account: ``` 594171376 clan-lab-rehearsal-1d5d33df 170.64.180.202 s-2vcpu-4gb active syd1 tags: clan-lab, clan-lab-expires-1787373527 created 2026-08-21T22:38:50Z ``` Expiry tag decodes to **2026-08-22 04:38 UTC**; as of this triage it is `up 2 days, 2:43`. Tagging is correct — it is *not* invisible to the reaper. **The reaper exists, on an hourly cron, and has failed on every single tick.** `crontab -l` on `matou-workstation`: ``` 17 * * * * DIGITALOCEAN_ACCESS_TOKEN=$(cat .../secrets/digitalocean_access_token) \ .../.claude/skills/clan-lab/clan-lab reap >> $HOME/swarm/logs/clan-lab-reap.log 2>&1 ``` `~/swarm/logs/clan-lab-reap.log` is **293 lines, all identical**: ``` clan-lab: doctl not found — install and authenticate it first ``` 293 hourly ticks ≈ **12.2 days with zero successful reaps**. `docs/agents/worker-classes.json` already describes this worker (`id: clan-lab-reap`) — and records `"invisible_failure": false`. **That field is falsified by this evidence**: the worker logged a fatal error hourly for twelve days with no alert and nobody noticed. Its own `stuck_signal: "none"` predicted exactly this. ## Root cause `doctl` is **not on the host PATH**. It exists only via Nix: ``` /home/dev/.nix-profile/bin/doctl -> /nix/store/vab729...-doctl-1.160.1/bin/doctl ``` Cron's default PATH does not include `/home/dev/.nix-profile/bin`, so `clan-lab`'s `command -v doctl >/dev/null || die` (`.claude/skills/clan-lab/clan-lab:27`) fires before any subcommand runs. The reap line is one of the two hand-added crontab entries (outside the `# BEGIN factory-managed` block) — and it is the one that **does not** source `host-env.sh`. Its sibling does: ``` */2 * * * * . /home/dev/swarm/host-env.sh && . /home/dev/swarm/idss-env.sh && .../rehearsal-executor.sh 17 * * * * DIGITALOCEAN_ACCESS_TOKEN=$(cat ...) .../clan-lab reap # <-- no host-env.sh ``` `host-env.sh:21` sets `PATH=/home/dev/.local/bin:/home/dev/.nix-profile/bin:...`. Confirmed directly: ``` $ bash -c '. /home/dev/swarm/host-env.sh; command -v doctl' /home/dev/.nix-profile/bin/doctl ``` So the fix is one line, and it is the same shape the working cron entry already uses. ## Why destroying this box is not the one-way door the filer feared The filer was right to stop — checked, and the caution does not survive the check: - **Nothing is on it.** Stock Ubuntu 24.04. `/nix/store` holds **0 paths** — the drive that rented it died before `enroll-copy` ever pushed a closure. `/root` is skeleton dotfiles only (`.bashrc`, `.profile`, `.ssh`, and a `.wget-hsts` whose single entry is DigitalOcean's own `repos-droplet.digitalocean.com` apt agent). Only `sshd` and `systemd-resolve` are listening. `last` shows **no login since boot** — the "1 user" in `uptime` is stale. - **It is not #712's held evidence.** #712's box was `594590436`, created 2026-08-23T17:08:31Z and destroyed by the drive's own teardown at 18:40:37Z. This is a different, older droplet (2026-08-21). - **No live drive is using it.** The executor is currently parked (`#721 blocked by 1 open issue(s) — the swarm is plugging`), and nothing on the host references `170.64.180.202`. - **Ben already authorized this class of destruction** when the hourly reap cron was installed: `clan-lab reap` destroys every expired `clan-lab` droplet unattended, and `reap` structurally cannot address anything outside the `clan-lab` tag (`labs()` filters `--tag-name clan-lab`; `resolve()` refuses everything else). ADR 0174 carves out "routine lab-droplet money" explicitly. **What proves it (two-way door):** the fix is a crontab line — revertible by editing one line back. It is provable *before* it touches anything, by running the cron command's exact text by hand and reading the log: `doctl not found` becomes `reap done (N destroyed)`. ## Agent brief — `ready-for-session` **Goal:** the `clan-lab-expires-` contract is actually enforced, and the leaked box is gone. 1. **Fix the cron line** on `matou-workstation` so it resolves `doctl` — source `host-env.sh` the way the rehearsal-executor line does: ``` 17 * * * * . /home/dev/swarm/host-env.sh && DIGITALOCEAN_ACCESS_TOKEN=$(cat /home/dev/swarm/Matou/idss/.sandcastle/secrets/digitalocean_access_token) /home/dev/swarm/Matou/idss/.claude/skills/clan-lab/clan-lab reap >> $HOME/swarm/logs/clan-lab-reap.log 2>&1 ``` Consider instead moving the line into the factory-managed host-cron registry (`/home/dev/swarm/host-registry.conf`) so it is rendered rather than hand-held — ADR 0004 host-state ownership, and ADR 0194's host-shape framing. Note that elitebook-03 (#659) will need the same entry, which argues for the registry. 2. **Verify before trusting it:** run the new line's exact text by hand and confirm the log gains `reaped clan-lab-rehearsal-1d5d33df (expired …)` / `reap done (1 destroyed)`. That single run *is* the cleanup — no separate destroy step, and it lets the standing contract do the deleting rather than a hand `doctl droplet delete`. 3. **Close the invisible-failure hole** — this is the part that let 293 failures pass unseen: - make `clan-lab` fall back to the Nix-profile `doctl` (or fail with the PATH it searched) instead of a bare `die`; - give `reap` a non-silent failure path — a Mattermost line or non-zero exit that the backstop notices — so a dead reaper alerts instead of accruing log lines. `worker-classes.json` already flags `stuck_signal: none` and "no alert on a doctl deletion failure" as known gaps. - correct `docs/agents/worker-classes.json` `clan-lab-reap`: `invisible_failure` is **true**, with this ticket as the evidence. 4. **Consider a GOTCHAS entry** (ADR 0160): *a host cron line that does not source `host-env.sh` cannot see any Nix-provided tool* — the reap line and the executor line differ by exactly that, and only one worked. **Scope note:** #708 (per-drive DO SSH keys, ~20 leaked, never reaped) is the sibling leak on the same account, already closed. This ticket is the droplet-side equivalent; keep them separate. **Out of scope:** widening the `clan-lab` tag's reach, or any change to what `reap` is allowed to address. The tag guardrail is what makes unattended destruction safe.
Author
Member

Ruled by agent under ADR 0174 — veto anytime

The answer to the ticket's second question is worse than either option it offered. The clan-lab-expires- tag is not "only honoured by the session that set it" — an enforcer was installed all along, an hourly cron line on matou-workstation, and it had never once run.

$ wc -l ~/swarm/logs/clan-lab-reap.log
293
$ grep -vc "doctl not found" ~/swarm/logs/clan-lab-reap.log
0

293 hourly runs, zero successes, every line clan-lab: doctl not found — install and authenticate it first. cron runs commands via /bin/sh with PATH=/usr/bin:/bin and sources no profile; doctl lives in ~/.nix-profile/bin. The CLI's own fail-loud guard exited 1 before it ever touched the account — hourly, into a log with MAILTO="" that nobody read. Reproduced verbatim before changing anything:

$ env -i PATH=/usr/bin:/bin sh -c '... clan-lab reap'
clan-lab: doctl not found — install and authenticate it first    (exit 1)

Every other cron line on that host survives because it sources ~/swarm/host-env.sh first, whose job is exporting the real PATH. The reaper line was hand-written without it. CI carries the identical hazard and the identical workaround, spelled out in ci.yml ("the runner is host-mode and its service PATH predates the nix install").

Two failures that only bite together: a cron line is a bare environment, and a cleanup job's success is invisible by nature — nothing happening is what it looks like when it works — so the one signal separating "reaped nothing, correctly" from "died on line one" is the one nobody reads.

The one-way-door question, answered with evidence rather than assumed

The ticket reserved destroying 594171376 for a human because "destroying lab state someone may still be reading is a one-way door". I probed the box read-only before ruling, and there was no lab state to read:

  • stock Ubuntu 24.04 — it was created --fresh, so no clan was ever inside it;
  • /root held only distro dotfiles (.bashrc, .profile, .ssh); nothing installed;
  • nothing listening but sshd and systemd-resolved;
  • last/wtmp recorded no interactive login in its entire two-day life — the only ssh sessions it ever had were 01:22/01:23 today (this ticket's filing session probing it) and mine at 01:53.

Ruled a two-way door: no data, no claimant, 45h past a self-expire contract already accepted when the skill was written ("reap … is safe to run from cron or any session"), and the box is recreatable in ~2 minutes by clan-lab create. This ticket also named "the clan-lab skill's own cleanup path, which knows the expiry contract" as an acceptable reaper — that is exactly the path that destroyed it, no bespoke doctl call. No personal credential, no posture widening, no member-facing accept, no non-routine spend.

Proven live

[2026-08-24T01:58:48Z] clan-lab-reap: sweeping expired labs
reaped clan-lab-rehearsal-1d5d33df (expired Sat Aug 22 04:38:47 UTC 2026)
reap done (1 destroyed)

The in-flight rental idss-gateway-rehearsal-c-8bc1 was never at risk: reap resolves targets only among clan-lab-tagged droplets, and that box carries idss-gateway,idss-rental. Verified after — it is the only droplet left besides the four production boxes.

## Ruled by agent under ADR 0174 — veto anytime **The answer to the ticket's second question is worse than either option it offered.** The `clan-lab-expires-` tag is not "only honoured by the session that set it" — an enforcer was installed all along, an hourly cron line on matou-workstation, and **it had never once run**. ``` $ wc -l ~/swarm/logs/clan-lab-reap.log 293 $ grep -vc "doctl not found" ~/swarm/logs/clan-lab-reap.log 0 ``` 293 hourly runs, zero successes, every line `clan-lab: doctl not found — install and authenticate it first`. cron runs commands via `/bin/sh` with `PATH=/usr/bin:/bin` and sources no profile; `doctl` lives in `~/.nix-profile/bin`. The CLI's own fail-loud guard exited 1 before it ever touched the account — hourly, into a log with `MAILTO=""` that nobody read. Reproduced verbatim before changing anything: ``` $ env -i PATH=/usr/bin:/bin sh -c '... clan-lab reap' clan-lab: doctl not found — install and authenticate it first (exit 1) ``` Every other cron line on that host survives because it sources `~/swarm/host-env.sh` first, whose job is exporting the real PATH. The reaper line was hand-written without it. CI carries the identical hazard and the identical workaround, spelled out in `ci.yml` ("the runner is host-mode and its service PATH predates the nix install"). Two failures that only bite together: **a cron line is a bare environment**, and **a cleanup job's success is invisible by nature** — nothing happening is what it looks like when it works — so the one signal separating "reaped nothing, correctly" from "died on line one" is the one nobody reads. ### The one-way-door question, answered with evidence rather than assumed The ticket reserved destroying `594171376` for a human because "destroying lab state someone may still be reading is a one-way door". I probed the box read-only before ruling, and there was no lab state to read: - stock Ubuntu 24.04 — it was created `--fresh`, so no clan was ever inside it; - `/root` held only distro dotfiles (`.bashrc`, `.profile`, `.ssh`); nothing installed; - nothing listening but `sshd` and `systemd-resolved`; - `last`/wtmp recorded **no interactive login in its entire two-day life** — the only ssh sessions it ever had were `01:22`/`01:23` today (this ticket's filing session probing it) and mine at `01:53`. Ruled a **two-way door**: no data, no claimant, 45h past a self-expire contract already accepted when the skill was written ("reap … is safe to run from cron or any session"), and the box is recreatable in ~2 minutes by `clan-lab create`. This ticket also named "the `clan-lab` skill's own cleanup path, which knows the expiry contract" as an acceptable reaper — **that is exactly the path that destroyed it**, no bespoke `doctl` call. No personal credential, no posture widening, no member-facing accept, no non-routine spend. ### Proven live ``` [2026-08-24T01:58:48Z] clan-lab-reap: sweeping expired labs reaped clan-lab-rehearsal-1d5d33df (expired Sat Aug 22 04:38:47 UTC 2026) reap done (1 destroyed) ``` The in-flight rental `idss-gateway-rehearsal-c-8bc1` was never at risk: `reap` resolves targets only among `clan-lab`-tagged droplets, and that box carries `idss-gateway,idss-rental`. Verified after — it is the only droplet left besides the four production boxes.
Author
Member

Close report

Both halves of the ticket are done: the droplet is reaped, and the thing that should have reaped it 45 hours earlier now works and is proven.

What landed

commit what
2674aba scripts/clan-lab-reap.sh + scripts/tests/clan-lab-reap-test.sh, GOTCHAS #74, STATUS.md
c6cc131 the enforcer must not assume HOME either — caught running the installed cron line under env -i
6579942 export the derived HOME, not just read it: doctl refuses to start without it
57f4a82 the offline test must not page the team channel

scripts/clan-lab-reap.sh — the expiry tag's enforcer, in a form cron can actually run. It prepends the well-known nix profile dirs only when doctl is otherwise unreachable (an interactive run resolves exactly as before), derives and exports HOME when unset, falls back to the host-only token file when DIGITALOCEAN_ACCESS_TOKEN is not exported, and on any CANNOT-REAP condition exits non-zero and pings Mattermost — so the next breakage lasts an hour instead of 293 of them. It adds no droplet selection of its own; the "only clan-lab-tagged droplets are addressable" guardrail stays the CLI's.

The host cron line (product-owned, outside the factory-managed block) now calls it behind the same host-env.sh + idss-env.sh prefix every other line on the box already had. Previous crontab backed up to ~/swarm/logs/crontab.before-723.20260824T020318Z.bak; exactly one line differs.

17 * * * * . /home/dev/swarm/host-env.sh && . /home/dev/swarm/idss-env.sh && \
  /home/dev/swarm/Matou/idss/scripts/clan-lab-reap.sh >> /home/dev/swarm/logs/clan-lab-reap.log 2>&1

Proof

  • Red first. The test reproduced doctl not found against the old shape before the entrypoint existed; env -i PATH=/usr/bin:/bin reproduced it against the real installed command.
  • Offline, 5/5 — scripts/tests/clan-lab-reap-test.sh drives the enforcer the way cron calls it, not the way a human does: PATH=/usr/bin:/bin, no exported token, a stub doctl reachable only through the dirs the script resolves. It asserts up front that no real doctl is on that PATH, so it cannot go vacuously green. Cases: HOME unset; the reproduction; the selection guardrail (an unexpired lab survives — this runs hourly, so a slip would destroy live labs all day); a 0-destroyed hour exiting clean; both CANNOT-REAP paths failing loud.
  • Live, twice. The reap above, and then the installed cron line executed verbatim under env -i — the first successful run in that log's 293-line history:
[2026-08-24T02:05:31Z] clan-lab-reap: sweeping expired labs
reap done (0 destroyed)
[2026-08-24T02:05:34Z] clan-lab-reap: done          exit=0

That env -i check earned its keep twice: it caught HOME: unbound variable in my own script (c6cc131) and then doctl's own neither $XDG_CONFIG_HOME nor $HOME are defined (6579942). Real cron sets HOME, so neither reached production — but a script written to end "the environment was barer than you assumed" should not contain another instance of it.

One thing I got wrong, and fixed

The enforcer pages on CANNOT-REAP by design, and the test deliberately drives two of those — so run from a session holding the host's Mattermost credentials, the test posted 9 real alerts into the team channel naming /tmp fixture paths. Fixed in 57f4a82 (the test strips the MATTERMOST_* trio; production behaviour untouched), proven by re-running the suite with the credentials sourced: 5/5 green, channel silent. A correction was posted to the channel so nobody chases them.

Found, filed, not fixed

Both live in .claude/skills/clan-lab/clan-lab, which is permission-gated for a session under this harness:

  • #740 — the orphaned-tag sweep asks doctl for ResourceCount, a field 1.160.1 renders <nil> (the real one is DropletCount), so its $2 == 0 filter has never matched: 170+ dead clan-lab-expires-* tags remain, confirmed still there after a successful reap. Plus a set -e hazard in set_expiry line 93 that kills clan-lab extend on a lab with no expiry tag. The test's comment block records why it deliberately does not assert that sweep today — a fixture printing 0 would make a production no-op look green, which is the exact class of lie this ticket is about.
  • #741 — rented idss-rental gateway droplets carry no expiry tag at all, and reap structurally cannot see them. That is the droplet class the rehearsal drive rents today, protected only by its own teardown trap — the same shape that failed in #393 and here.

The lesson, recorded as GOTCHAS #74

A cron line is a bare environment: never assume PATH, a HOME-derived profile, or an exported credential. Give the job a repo-owned entrypoint that resolves its own tools and secret and fails loud somewhere a human sees, and test it the way cron calls it. Corollary, earned the expensive way: an enforcement mechanism with no successful run in its log has never run — before trusting any sweep, TTL or reaper, read its log for a success, not for the absence of errors.

Closing.

## Close report **Both halves of the ticket are done: the droplet is reaped, and the thing that should have reaped it 45 hours earlier now works and is proven.** ### What landed | commit | what | |---|---| | `2674aba` | `scripts/clan-lab-reap.sh` + `scripts/tests/clan-lab-reap-test.sh`, GOTCHAS #74, STATUS.md | | `c6cc131` | the enforcer must not assume `HOME` either — caught running the installed cron line under `env -i` | | `6579942` | export the derived `HOME`, not just read it: `doctl` refuses to start without it | | `57f4a82` | the offline test must not page the team channel | **`scripts/clan-lab-reap.sh`** — the expiry tag's enforcer, in a form cron can actually run. It prepends the well-known nix profile dirs **only when `doctl` is otherwise unreachable** (an interactive run resolves exactly as before), derives and exports `HOME` when unset, falls back to the host-only token file when `DIGITALOCEAN_ACCESS_TOKEN` is not exported, and on any CANNOT-REAP condition exits non-zero **and pings Mattermost** — so the next breakage lasts an hour instead of 293 of them. It adds no droplet selection of its own; the "only `clan-lab`-tagged droplets are addressable" guardrail stays the CLI's. **The host cron line** (product-owned, outside the factory-managed block) now calls it behind the same `host-env.sh` + `idss-env.sh` prefix every other line on the box already had. Previous crontab backed up to `~/swarm/logs/crontab.before-723.20260824T020318Z.bak`; exactly one line differs. ``` 17 * * * * . /home/dev/swarm/host-env.sh && . /home/dev/swarm/idss-env.sh && \ /home/dev/swarm/Matou/idss/scripts/clan-lab-reap.sh >> /home/dev/swarm/logs/clan-lab-reap.log 2>&1 ``` ### Proof - **Red first.** The test reproduced `doctl not found` against the old shape before the entrypoint existed; `env -i PATH=/usr/bin:/bin` reproduced it against the real installed command. - **Offline, 5/5** — `scripts/tests/clan-lab-reap-test.sh` drives the enforcer the way **cron** calls it, not the way a human does: `PATH=/usr/bin:/bin`, no exported token, a stub `doctl` reachable only through the dirs the script resolves. It asserts up front that no real `doctl` is on that PATH, so it cannot go vacuously green. Cases: `HOME` unset; the reproduction; the selection guardrail (an unexpired lab survives — this runs hourly, so a slip would destroy live labs all day); a 0-destroyed hour exiting clean; both CANNOT-REAP paths failing loud. - **Live, twice.** The reap above, and then the **installed cron line executed verbatim under `env -i`** — the first successful run in that log's 293-line history: ``` [2026-08-24T02:05:31Z] clan-lab-reap: sweeping expired labs reap done (0 destroyed) [2026-08-24T02:05:34Z] clan-lab-reap: done exit=0 ``` That `env -i` check earned its keep twice: it caught `HOME: unbound variable` in my own script (`c6cc131`) and then `doctl`'s own `neither $XDG_CONFIG_HOME nor $HOME are defined` (`6579942`). Real cron sets `HOME`, so neither reached production — but a script written to end "the environment was barer than you assumed" should not contain another instance of it. ### One thing I got wrong, and fixed The enforcer pages on CANNOT-REAP by design, and the test deliberately drives two of those — so run from a session holding the host's Mattermost credentials, **the test posted 9 real alerts into the team channel** naming `/tmp` fixture paths. Fixed in `57f4a82` (the test strips the `MATTERMOST_*` trio; production behaviour untouched), proven by re-running the suite **with** the credentials sourced: 5/5 green, channel silent. A correction was posted to the channel so nobody chases them. ### Found, filed, not fixed Both live in `.claude/skills/clan-lab/clan-lab`, which is permission-gated for a session under this harness: - **#740** — the orphaned-tag sweep asks doctl for `ResourceCount`, a field 1.160.1 renders `<nil>` (the real one is `DropletCount`), so its `$2 == 0` filter has never matched: **170+ dead `clan-lab-expires-*` tags** remain, confirmed still there after a successful reap. Plus a `set -e` hazard in `set_expiry` line 93 that kills `clan-lab extend` on a lab with no expiry tag. The test's comment block records why it deliberately does **not** assert that sweep today — a fixture printing `0` would make a production no-op look green, which is the exact class of lie this ticket is about. - **#741** — rented `idss-rental` gateway droplets carry **no expiry tag at all**, and `reap` structurally cannot see them. That is the droplet class the rehearsal drive rents *today*, protected only by its own teardown trap — the same shape that failed in #393 and here. ### The lesson, recorded as GOTCHAS #74 A cron line is a **bare** environment: never assume PATH, a HOME-derived profile, or an exported credential. Give the job a repo-owned entrypoint that resolves its own tools and secret and fails loud somewhere a human sees, and test it the way cron calls it. Corollary, earned the expensive way: **an enforcement mechanism with no successful run in its log has never run** — before trusting any sweep, TTL or reaper, read its log for a *success*, not for the absence of errors. Closing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#723
No description provided.