clan-lab reap destroys a droplet that is still being CREATED — a newborn's clan-lab-expires tag is not yet visible, labs() reads expiry 0, and the hourly :17 sweep kills it mid-create --wait (drive 20260831T231010Z parked at preflight, nothing filed) #1092

Closed
opened 2026-09-01 00:58:09 +00:00 by ben · 0 comments
Owner

Failure

Drive 20260831T231010Z (target device, the first drive carrying the #1088 fix) never ran a leg. After eval gate: GREEN the preflight's oc_device_create ran clan-lab create --purpose rehearsal --fresh --ttl 6 and died:

creating clan-lab-rehearsal-84ebd887  (region=syd1 size=s-2vcpu-4gb ttl=6h image=ubuntu-24-04-x64)
Error: GET https://api.digitalocean.com/v2/droplets/596747206: 404 (request "d589b845-…") The resource you were accessing could not be found.
PREFLIGHT: clan-lab create failed for the member device
==> PARKED (exit 3) at preflight (host-local refusal) — see the executor log; nothing filed, #854 blocked on nothing
    #1035: backoff armed (/tmp/matou-rehearsal-preflight-backoff, TTL 1800s)

The 404 came from doctl compute droplet create --wait's own readiness poll — the POST had succeeded and DO had issued id 596747206.

Diagnosis — it was destroyed, from outside, 18 seconds after it was born

DO's action log (doctl compute action list, resource 596747206):

3380153541  completed  create   2026-09-01 00:16:46 UTC → 00:17:16 UTC  596747206 droplet
3380154493  completed  destroy  2026-09-01 00:17:04 UTC → 00:17:32 UTC  596747206 droplet

The destroy STARTED before the create COMPLETED. The only thing that destroys clan-lab-tagged droplets out of band is the hourly reaper on matou-workstation: 17 * * * * … scripts/clan-lab-reap.sh — i.e. a tick at 00:17:0x, squarely inside the ~30 s create window.

Why the reaper thought a 6-hour-TTL newborn was expired — .claude/skills/clan-lab/clan-lab:

labs() {
  doctl compute droplet list --tag-name "$TAG" --format ID,Name,PublicIPv4,SizeSlug,Tags --no-header |
  awk '{ e = 0; for (i = 5; i <= NF; i++) if (match($i, /clan-lab-expires-[0-9]+/)) e = …; print $1 "	" … "	" e + 0 }'
}
cmd_reap() {
  …
    if [ "$all" = 1 ] || [ "$exp" -lt "$t" ]; then
      doctl compute droplet delete "$id" --force

DO attaches --tag-names to a droplet AFTER the resource exists; during the create window droplet list --tag-name clan-lab can already return the droplet (the clan-lab tag lands first) while clan-lab-expires-<epoch> is not yet on it. labs() then prints expiry 0, and 0 -lt now is always true → destroyed. cmd_reap's own comment already names this hole for the tag-DELETION case ("labs() then reads expiry 0, and the next hourly reap destroys a running lab … Unknown must mean 'leave it', never 'orphan'") — the newborn case is the same hole from the other side, and the reap loop never applied the rule it states.

Two second-order effects:

  1. The executor filed nothing. A PARKED (exit 3) host-local refusal is by design silent (#1035) — correct for a genuinely local refusal, but here it masked an external destroy and cost a full prep cycle (~40 min rebuild + gate) plus the 30-min backoff with zero record on the tracker. Session found it only by reading the executor log.
  2. The race is ~30 s per create against a 60-min period → ~1% per device create — rare, but every device drive creates exactly one, and today it hit the first drive carrying #1088.

Fix (two-way door, ADR 0174 — strictly LESS destructive)

cmd_reap: a lab with no parsable expiry (exp = 0) is never reaped — log it loud (skipping <name>: no clan-lab-expires tag (still being created, or its tag object was deleted) — refusing to treat unknown as expired) and count it in the summary, so the next hourly tick gets it once the tag is visible or a human sees the anomaly. --all keeps its explicit semantics. Guard with a red-before-green case in scripts/tests/clan-lab-reap-test.sh (the stub doctl returns a clan-lab-tagged droplet whose Tags column carries no clan-lab-expires-*; assert no droplet delete is issued and the skip line is printed). GOTCHAS entry in the same commit.

Evidence: elitebook rehearsal-executor.log (the 84ebd887 create + 404), DO action ids 3380153541 / 3380154493, workstation crontab line 17 * * * *.

Blocks nothing structurally (#854 is already re-driving: the 00:50 cycle's device clan-lab-rehearsal-957f2755 survived because no reaper tick fell in its create window) — filed as rehearsal-183 because it can eat any future device drive at random.

## Failure Drive `20260831T231010Z` (target `device`, the first drive carrying the #1088 fix) never ran a leg. After `eval gate: GREEN` the preflight's `oc_device_create` ran `clan-lab create --purpose rehearsal --fresh --ttl 6` and died: ``` creating clan-lab-rehearsal-84ebd887 (region=syd1 size=s-2vcpu-4gb ttl=6h image=ubuntu-24-04-x64) Error: GET https://api.digitalocean.com/v2/droplets/596747206: 404 (request "d589b845-…") The resource you were accessing could not be found. PREFLIGHT: clan-lab create failed for the member device ==> PARKED (exit 3) at preflight (host-local refusal) — see the executor log; nothing filed, #854 blocked on nothing #1035: backoff armed (/tmp/matou-rehearsal-preflight-backoff, TTL 1800s) ``` The 404 came from `doctl compute droplet create --wait`'s own readiness poll — the POST had succeeded and DO had issued id 596747206. ## Diagnosis — it was destroyed, from outside, 18 seconds after it was born DO's action log (`doctl compute action list`, resource 596747206): ``` 3380153541 completed create 2026-09-01 00:16:46 UTC → 00:17:16 UTC 596747206 droplet 3380154493 completed destroy 2026-09-01 00:17:04 UTC → 00:17:32 UTC 596747206 droplet ``` The destroy STARTED before the create COMPLETED. The only thing that destroys `clan-lab`-tagged droplets out of band is the hourly reaper on matou-workstation: `17 * * * * … scripts/clan-lab-reap.sh` — i.e. a tick at 00:17:0x, squarely inside the ~30 s create window. Why the reaper thought a 6-hour-TTL newborn was expired — `.claude/skills/clan-lab/clan-lab`: ```sh labs() { doctl compute droplet list --tag-name "$TAG" --format ID,Name,PublicIPv4,SizeSlug,Tags --no-header | awk '{ e = 0; for (i = 5; i <= NF; i++) if (match($i, /clan-lab-expires-[0-9]+/)) e = …; print $1 " " … " " e + 0 }' } cmd_reap() { … if [ "$all" = 1 ] || [ "$exp" -lt "$t" ]; then doctl compute droplet delete "$id" --force ``` DO attaches `--tag-names` to a droplet AFTER the resource exists; during the create window `droplet list --tag-name clan-lab` can already return the droplet (the `clan-lab` tag lands first) while `clan-lab-expires-<epoch>` is not yet on it. `labs()` then prints expiry **0**, and `0 -lt now` is always true → destroyed. `cmd_reap`'s own comment already names this hole for the tag-DELETION case ("labs() then reads expiry 0, and the next hourly reap destroys a running lab … Unknown must mean 'leave it', never 'orphan'") — the newborn case is the same hole from the other side, and the reap loop never applied the rule it states. Two second-order effects: 1. **The executor filed nothing.** A `PARKED (exit 3) host-local refusal` is by design silent (#1035) — correct for a genuinely local refusal, but here it masked an external destroy and cost a full prep cycle (~40 min rebuild + gate) plus the 30-min backoff with zero record on the tracker. Session found it only by reading the executor log. 2. The race is ~30 s per create against a 60-min period → ~1% per device create — rare, but every device drive creates exactly one, and today it hit the first drive carrying #1088. ## Fix (two-way door, ADR 0174 — strictly LESS destructive) `cmd_reap`: a lab with **no parsable expiry** (`exp` = 0) is never reaped — log it loud (`skipping <name>: no clan-lab-expires tag (still being created, or its tag object was deleted) — refusing to treat unknown as expired`) and count it in the summary, so the next hourly tick gets it once the tag is visible or a human sees the anomaly. `--all` keeps its explicit semantics. Guard with a red-before-green case in `scripts/tests/clan-lab-reap-test.sh` (the stub `doctl` returns a `clan-lab`-tagged droplet whose Tags column carries no `clan-lab-expires-*`; assert no `droplet delete` is issued and the skip line is printed). GOTCHAS entry in the same commit. Evidence: elitebook `rehearsal-executor.log` (the `84ebd887` create + 404), DO action ids 3380153541 / 3380154493, workstation crontab line `17 * * * *`. Blocks nothing structurally (#854 is already re-driving: the 00:50 cycle's device `clan-lab-rehearsal-957f2755` survived because no reaper tick fell in its create window) — filed as `rehearsal-183` because it can eat any future device drive at random.
ben closed this issue 2026-09-01 01:00:56 +00:00
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#1092
No description provided.