rehearsal: an ended drive keeps its guest.qcow2 — retention keeps 3 whole runs per checkout and filled elitebook-03 to 95% (drop the VM disk at drive end, keep the evidence) #1615

Closed
opened 2026-09-18 22:37:35 +00:00 by ben · 3 comments
Owner

Symptom

2026-09-18: elitebook-03's root disk reached 95% (13 GB free of 232 GB) while a local-guest drive was in flight. 77 GB of it was test-results/ across the two idss checkouts on that host, almost all of it state/vm/guest.qcow2 files from drives that had already ended:

Path Size
~/swarm/Matou/idss/test-results/private-path/20260918T193207Z/state/vm/guest.qcow2 (the in-flight drive, brands) 23.3 GB
…/private-path/20260910T134056Z/state/vm/guest.qcow2 10.6 GB
…/private-path/20260918T183207Z/… and …/20260918T191007Z/… 8.6 GB each
~/session-runner/idss/test-results/private-path/ — three runs from 11–14 Sept 8.6 + 5.9 + 5.9 GB
test-results/standing-private/guest.qcow2 (the standing snapshot — legitimate, listed for the total) 8.6 GB

The six ended-run disks were deleted by hand (checked unopened with fuser; each run's report/, artifacts/ and traces were kept — they are a few MB). That alone took the disk from 95% to 75%. Had the in-flight guest kept growing toward its 40 GiB virtual size, the drive — and the host's other services (garage, patroni, etcd, the runner) — would have hit ENOSPC.

Cause

scripts/smoke-private-path.sh retention (--keep, default 3, the block above rehearsal-run-override) prunes whole run dirs and keeps the newest 3 whole, guest disk included. So:

  1. The kept runs keep their VM disks. A run's evidence is MBs; its guest.qcow2 is 6–23 GB and is dead weight the moment the guest is torn down — nothing reads it after the drive ends (the snapshot rail copies its own master into standing-private/). Steady state is therefore 3 old disks + the live one: ~35 GB typical, 90+ GB if long drives (brands reached 23 GB) stack up — per checkout.
  2. Retention only runs when a drive runs in that checkout. ~/session-runner/idss had three disks (20 GB) sitting untouched since 14 Sept because no drive has started there since; nothing else ever reclaims them.
  3. Nothing checks free disk before a drive starts. The preflight parks on stale payloads but not on a host that cannot hold one more 40 GiB-capped guest.

Proposed fix

  • Drop the guest disk when the drive ends. After oc_teardown_guest (and after the snapshot rail has taken its copy, when it is going to), delete $run_dir/state/vm/guest.qcow2, green or red. Keep everything else in the run dir, so --keep 3 goes back to meaning "three runs of evidence" at a few MB each. If a red disk is ever wanted for a post-mortem, make it an explicit opt-in (a REHEARSAL_KEEP_RED_GUEST=1 in the spirit of REHEARSAL_KEEP_RED_DROPLET), bounded to one.
  • Also sweep at retention time: for the runs retention keeps, remove any leftover state/vm/guest.qcow2 that no process holds open — this covers a drive that died before its own cleanup, and clears existing hosts on the first drive after the fix lands.
  • Preflight disk floor: park (the existing preflight-park path, not a red) when the results filesystem has less free space than one guest can grow to.

Acceptance

  • After a local-guest drive ends (green and red both), its run dir holds no guest.qcow2; report/ and artifacts/ are intact and the reporter/healer still read them.
  • The standing snapshot (test-results/standing-private/) is untouched by any of this.
  • A retention pass over a results tree containing old runs with disks removes the disks, never an open one, and never the evidence of a kept run.
  • Offline test beside the existing retention/drive-log tests proving the three cases above, including --keep 0.
  • A GOTCHAS entry (Symptom → Cause → Rule) for "an ended drive's guest disk is not evidence".

Out of scope / notes

  • The stale disks under a checkout that no longer runs drives (the session-runner one) are an operational residue, already cleared on elitebook-03 on 2026-09-18; other pool hosts have not been checked.
  • A host-level free-disk signal in the factory's host-capacity sampling would be a Matou/dev-factory ticket, not this one.
## Symptom 2026-09-18: elitebook-03's root disk reached **95% (13 GB free of 232 GB)** while a local-guest drive was in flight. 77 GB of it was `test-results/` across the two idss checkouts on that host, almost all of it `state/vm/guest.qcow2` files from drives that had already ended: | Path | Size | |---|---| | `~/swarm/Matou/idss/test-results/private-path/20260918T193207Z/state/vm/guest.qcow2` (the in-flight drive, brands) | 23.3 GB | | `…/private-path/20260910T134056Z/state/vm/guest.qcow2` | 10.6 GB | | `…/private-path/20260918T183207Z/…` and `…/20260918T191007Z/…` | 8.6 GB each | | `~/session-runner/idss/test-results/private-path/` — three runs from 11–14 Sept | 8.6 + 5.9 + 5.9 GB | | `test-results/standing-private/guest.qcow2` (the standing snapshot — legitimate, listed for the total) | 8.6 GB | The six ended-run disks were deleted by hand (checked unopened with `fuser`; each run's `report/`, `artifacts/` and traces were kept — they are a few MB). That alone took the disk from 95% to 75%. Had the in-flight guest kept growing toward its 40 GiB virtual size, the drive — and the host's other services (garage, patroni, etcd, the runner) — would have hit ENOSPC. ## Cause `scripts/smoke-private-path.sh` retention (`--keep`, default 3, the block above `rehearsal-run-override`) prunes **whole run dirs** and keeps the newest 3 **whole**, guest disk included. So: 1. **The kept runs keep their VM disks.** A run's evidence is MBs; its `guest.qcow2` is 6–23 GB and is dead weight the moment the guest is torn down — nothing reads it after the drive ends (the snapshot rail copies its own master into `standing-private/`). Steady state is therefore 3 old disks + the live one: ~35 GB typical, 90+ GB if long drives (brands reached 23 GB) stack up — per checkout. 2. **Retention only runs when a drive runs in that checkout.** `~/session-runner/idss` had three disks (20 GB) sitting untouched since 14 Sept because no drive has started there since; nothing else ever reclaims them. 3. **Nothing checks free disk before a drive starts.** The preflight parks on stale payloads but not on a host that cannot hold one more 40 GiB-capped guest. ## Proposed fix - **Drop the guest disk when the drive ends.** After `oc_teardown_guest` (and after the snapshot rail has taken its copy, when it is going to), delete `$run_dir/state/vm/guest.qcow2`, green or red. Keep everything else in the run dir, so `--keep 3` goes back to meaning "three runs of evidence" at a few MB each. If a red disk is ever wanted for a post-mortem, make it an explicit opt-in (a `REHEARSAL_KEEP_RED_GUEST=1` in the spirit of `REHEARSAL_KEEP_RED_DROPLET`), bounded to one. - **Also sweep at retention time:** for the runs retention keeps, remove any leftover `state/vm/guest.qcow2` that no process holds open — this covers a drive that died before its own cleanup, and clears existing hosts on the first drive after the fix lands. - **Preflight disk floor:** park (the existing preflight-park path, not a red) when the results filesystem has less free space than one guest can grow to. ## Acceptance - After a local-guest drive ends (green and red both), its run dir holds no `guest.qcow2`; `report/` and `artifacts/` are intact and the reporter/healer still read them. - The standing snapshot (`test-results/standing-private/`) is untouched by any of this. - A retention pass over a results tree containing old runs with disks removes the disks, never an open one, and never the evidence of a kept run. - Offline test beside the existing retention/drive-log tests proving the three cases above, including `--keep 0`. - A GOTCHAS entry (Symptom → Cause → Rule) for "an ended drive's guest disk is not evidence". ## Out of scope / notes - The stale disks under a checkout that no longer runs drives (the session-runner one) are an operational residue, already cleared on elitebook-03 on 2026-09-18; other pool hosts have not been checked. - A host-level free-disk signal in the factory's host-capacity sampling would be a `Matou/dev-factory` ticket, not this one.

This was generated by AI during triage.

Agent Brief

Category: bug
Summary: An ended local-guest drive keeps its multi-GB guest.qcow2; retention keeps whole run dirs (VM disk included), so 3 dead disks + the live one per checkout can march a host to ENOSPC (elitebook-03 hit 95% mid-drive on 2026-09-18).

Current behavior:
The private-path rehearsal drive script tears the guest down at drive end (via oc_teardown_guest) but leaves that run's state/vm/guest.qcow2 (6–23 GB) on disk. Its --keep N retention (default 3) prunes whole run directories and keeps the newest N intact — VM disk and all — so steady state is 3 old guest disks plus the live one, per checkout (~35 GB typical, 90+ GB when long drives stack). Retention only runs when a drive runs in that checkout, so an idle checkout (e.g. a session-runner tree) keeps its dead disks indefinitely. Nothing checks free disk before a drive starts.

Desired behavior:

  • A guest disk is scratch, not evidence: once the guest is torn down (and after the snapshot rail has taken its own copy, when it takes one), that run's guest.qcow2 is removed — on both green and red drives — while report/, artifacts/, traces and the rest of the run dir stay intact and are still read by the reporter/healer. Provide an explicit, bounded opt-out for a red post-mortem disk, mirroring the existing REHEARSAL_KEEP_RED_DROPLET hatch (e.g. REHEARSAL_KEEP_RED_GUEST=1, one disk).
  • Retention also sweeps: for the runs it keeps, remove any leftover guest.qcow2 that no process holds open — covering a drive that died before its own cleanup, and clearing existing hosts on the first drive after the fix. Never remove an open disk; never touch a kept run's evidence.
  • A preflight disk floor: park via the existing preflight-park path (not a red) when the results filesystem has less free space than one guest's virtual cap can grow to.
  • The standing snapshot tree (test-results/standing-private/) is never touched by any of this.

Key interfaces / patterns:

  • oc_teardown_guest — the teardown seam the disk-drop hangs off, after the snapshot copy.
  • The --keep N whole-run-dir retention pruner (including the --keep 0 "prune everything" arithmetic) — extend to sweep leftover guest disks in kept runs.
  • REHEARSAL_KEEP_RED_DROPLET — the existing red-inspection opt-in to mirror for the guest-disk hatch (see its offline coverage in scripts/tests/live-box-pointer-test.sh).
  • The preflight park path used for stale payloads — add the free-disk floor there.

Acceptance criteria:

  • After a local-guest drive ends (green and red both), its run dir holds no guest.qcow2; report/ and artifacts/ are intact and still consumed by the reporter/healer.
  • REHEARSAL_KEEP_RED_GUEST=1 (or equivalent) keeps exactly one red drive's guest disk for post-mortem; the default keeps none.
  • A retention pass over a results tree with old runs removes their guest disks, never an open one, and never a kept run's evidence — including at --keep 0.
  • Preflight parks (not reds) when free space on the results filesystem is below one guest's virtual cap.
  • The standing snapshot tree is untouched.
  • An offline test beside the existing retention/drive-log tests (scripts/tests/rehearsal-drive-log-test.sh) proves drop-at-end, the retention sweep, and --keep 0.
  • A docs/GOTCHAS.md entry (Symptom → Cause → Rule, severity-marked) for "an ended drive's guest disk is not evidence", appended in the same commit (ADR 0160).

Out of scope:

  • The one-time manual cleanup already done on elitebook-03, and sweeping other pool hosts' idle checkouts by hand.
  • A host-level free-disk signal in the factory's host-capacity sampling (noted in the ticket as a separate follow-up).
  • Any change to what the snapshot rail copies into standing-private/.

Ruled by agent under ADR 0174 — veto anytime. The one destructive-looking element (deleting an ended drive's guest.qcow2) is a two-way door, not the "data destruction" one-way door: the disk is throwaway VM scratch that nothing reads after teardown, evidence is explicitly preserved, a red post-mortem disk is retained behind an opt-in, the whole change is revertible by a later commit, and it is proven by an offline test — so this is ready-for-agent, not ready-for-human. It touches only scripts/**, a scripts/tests/** test, and docs/GOTCHAS.md (no .sandcastle/ protected path, no host credentials, no live-infra step, no design surface), and its acceptance is offline-provable — so a swarm worker can take it. Verified against the codebase: oc_teardown_guest and the --keep retention block exist as described, the REHEARSAL_KEEP_RED_DROPLET pattern is present to mirror, and no guest-disk-drop logic exists yet (not redundant, not already implemented).

> *This was generated by AI during triage.* ## Agent Brief **Category:** bug **Summary:** An ended local-guest drive keeps its multi-GB `guest.qcow2`; retention keeps *whole* run dirs (VM disk included), so 3 dead disks + the live one per checkout can march a host to ENOSPC (elitebook-03 hit 95% mid-drive on 2026-09-18). **Current behavior:** The private-path rehearsal drive script tears the guest down at drive end (via `oc_teardown_guest`) but leaves that run's `state/vm/guest.qcow2` (6–23 GB) on disk. Its `--keep N` retention (default 3) prunes *whole* run directories and keeps the newest N intact — VM disk and all — so steady state is 3 old guest disks plus the live one, per checkout (~35 GB typical, 90+ GB when long drives stack). Retention only runs when a drive runs *in that checkout*, so an idle checkout (e.g. a session-runner tree) keeps its dead disks indefinitely. Nothing checks free disk before a drive starts. **Desired behavior:** - A guest disk is scratch, not evidence: once the guest is torn down (and after the snapshot rail has taken its own copy, when it takes one), that run's `guest.qcow2` is removed — on both green and red drives — while `report/`, `artifacts/`, traces and the rest of the run dir stay intact and are still read by the reporter/healer. Provide an explicit, bounded opt-out for a red post-mortem disk, mirroring the existing `REHEARSAL_KEEP_RED_DROPLET` hatch (e.g. `REHEARSAL_KEEP_RED_GUEST=1`, one disk). - Retention also sweeps: for the runs it keeps, remove any leftover `guest.qcow2` that no process holds open — covering a drive that died before its own cleanup, and clearing existing hosts on the first drive after the fix. Never remove an open disk; never touch a kept run's evidence. - A preflight disk floor: park via the existing preflight-park path (not a red) when the results filesystem has less free space than one guest's virtual cap can grow to. - The standing snapshot tree (`test-results/standing-private/`) is never touched by any of this. **Key interfaces / patterns:** - `oc_teardown_guest` — the teardown seam the disk-drop hangs off, after the snapshot copy. - The `--keep N` whole-run-dir retention pruner (including the `--keep 0` "prune everything" arithmetic) — extend to sweep leftover guest disks in kept runs. - `REHEARSAL_KEEP_RED_DROPLET` — the existing red-inspection opt-in to mirror for the guest-disk hatch (see its offline coverage in `scripts/tests/live-box-pointer-test.sh`). - The preflight park path used for stale payloads — add the free-disk floor there. **Acceptance criteria:** - [ ] After a local-guest drive ends (green and red both), its run dir holds no `guest.qcow2`; `report/` and `artifacts/` are intact and still consumed by the reporter/healer. - [ ] `REHEARSAL_KEEP_RED_GUEST=1` (or equivalent) keeps exactly one red drive's guest disk for post-mortem; the default keeps none. - [ ] A retention pass over a results tree with old runs removes their guest disks, never an open one, and never a kept run's evidence — including at `--keep 0`. - [ ] Preflight parks (not reds) when free space on the results filesystem is below one guest's virtual cap. - [ ] The standing snapshot tree is untouched. - [ ] An offline test beside the existing retention/drive-log tests (`scripts/tests/rehearsal-drive-log-test.sh`) proves drop-at-end, the retention sweep, and `--keep 0`. - [ ] A `docs/GOTCHAS.md` entry (Symptom → Cause → Rule, severity-marked) for "an ended drive's guest disk is not evidence", appended in the same commit (ADR 0160). **Out of scope:** - The one-time manual cleanup already done on elitebook-03, and sweeping other pool hosts' idle checkouts by hand. - A host-level free-disk signal in the factory's host-capacity sampling (noted in the ticket as a separate follow-up). - Any change to what the snapshot rail copies into `standing-private/`. --- **Ruled by agent under ADR 0174 — veto anytime.** The one destructive-looking element (deleting an ended drive's `guest.qcow2`) is a **two-way door**, not the "data destruction" one-way door: the disk is throwaway VM scratch that nothing reads after teardown, evidence is explicitly preserved, a red post-mortem disk is retained behind an opt-in, the whole change is revertible by a later commit, and it is proven by an offline test — so this is `ready-for-agent`, not `ready-for-human`. It touches only `scripts/**`, a `scripts/tests/**` test, and `docs/GOTCHAS.md` (no `.sandcastle/` protected path, no host credentials, no live-infra step, no design surface), and its acceptance is offline-provable — so a swarm worker can take it. Verified against the codebase: `oc_teardown_guest` and the `--keep` retention block exist as described, the `REHEARSAL_KEEP_RED_DROPLET` pattern is present to mirror, and no guest-disk-drop logic exists yet (not redundant, not already implemented).

swarm-claim host=bens-mac-04 run=26699
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=26699 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1615 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1615,
  "status": "success",
  "commits": [
    "f727890c6cf2ea5d5299606d35ca13c53ee2de3e"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "scripts/smoke-private-path.sh",
    "scripts/tests/rehearsal-guest-disk-test.sh"
  ],
  "tests": [
    {
      "command": "bash scripts/tests/rehearsal-guest-disk-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/rehearsal-drive-log-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash -n scripts/smoke-private-path.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "After a local-guest drive ends (green and red both), its run dir holds no guest.qcow2; report/ and artifacts/ are intact and still consumed by the reporter/healer": "smoke-private-path.sh drive-end block (local-guest) tears the guest down then calls oc_drop_guest_disk; oc_drop_guest_disk removes only state/vm/guest.qcow2, leaving report/artifacts/logs — proven by rehearsal-guest-disk-test.sh checks 1 (green) and 2 (red default)",
    "REHEARSAL_KEEP_RED_GUEST=1 (or equivalent) keeps exactly one red drive's guest disk for post-mortem; the default keeps none": "oc_drop_guest_disk honours REHEARSAL_KEEP_RED_GUEST red-only, reclaimed by the next drive's sweep (bounded to one) — proven by check 3 (red kept, green with the flag still dropped)",
    "A retention pass over a results tree with old runs removes their guest disks, never an open one, and never a kept run's evidence -- including at --keep 0": "guest-disk-retention block prunes older-than-keep whole dirs and sweeps kept runs via oc_sweep_guest_disk (fuser-guarded) — proven by checks 4 (open disk left by drop AND sweep), 5 (kept runs lose disk, keep evidence; older pruned), 6 (--keep 0 prunes all), 6b (empty-tree no-op)",
    "Preflight parks (not reds) when free space on the results filesystem is below one guest's virtual cap": "preflight local-guest block calls oc_results_fs_below_floor and die_host (the preflight-park path, exit 3) when below OC_GUEST_DISK_CAP_GIB (40) — predicate proven by check 7 (rc 0 above, 1 below, 2 unknown)",
    "The standing snapshot tree is untouched": "retention find is scoped to test-results/$results_name (private-path); standing-private is a sibling, never a run dir under it — proven by check 5 (standing-private/guest.qcow2 survives the pass)",
    "An offline test beside the existing retention/drive-log tests proves drop-at-end, the retention sweep, and --keep 0": "scripts/tests/rehearsal-guest-disk-test.sh (9 checks), auto-run by scripts/seam-smoke.sh's scripts/tests/*.sh loop",
    "A docs/GOTCHAS.md entry (Symptom -> Cause -> Rule, severity-marked) for an ended drive's guest disk is not evidence, appended in the same commit (ADR 0160)": "docs/GOTCHAS.md entry #259 (severity marked), added in commit f727890c"
  },
  "summary": "An ended local-guest drive now drops its scratch state/vm/guest.qcow2, retention sweeps kept runs' leftover disks, and preflight parks below a one-guest disk floor -- evidence and the standing snapshot untouched.",
  "blockers": []
}
**close-report** for #1615 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1615, "status": "success", "commits": [ "f727890c6cf2ea5d5299606d35ca13c53ee2de3e" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "scripts/smoke-private-path.sh", "scripts/tests/rehearsal-guest-disk-test.sh" ], "tests": [ { "command": "bash scripts/tests/rehearsal-guest-disk-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/rehearsal-drive-log-test.sh", "exit_code": 0 }, { "command": "bash -n scripts/smoke-private-path.sh", "exit_code": 0 } ], "criteria": { "After a local-guest drive ends (green and red both), its run dir holds no guest.qcow2; report/ and artifacts/ are intact and still consumed by the reporter/healer": "smoke-private-path.sh drive-end block (local-guest) tears the guest down then calls oc_drop_guest_disk; oc_drop_guest_disk removes only state/vm/guest.qcow2, leaving report/artifacts/logs — proven by rehearsal-guest-disk-test.sh checks 1 (green) and 2 (red default)", "REHEARSAL_KEEP_RED_GUEST=1 (or equivalent) keeps exactly one red drive's guest disk for post-mortem; the default keeps none": "oc_drop_guest_disk honours REHEARSAL_KEEP_RED_GUEST red-only, reclaimed by the next drive's sweep (bounded to one) — proven by check 3 (red kept, green with the flag still dropped)", "A retention pass over a results tree with old runs removes their guest disks, never an open one, and never a kept run's evidence -- including at --keep 0": "guest-disk-retention block prunes older-than-keep whole dirs and sweeps kept runs via oc_sweep_guest_disk (fuser-guarded) — proven by checks 4 (open disk left by drop AND sweep), 5 (kept runs lose disk, keep evidence; older pruned), 6 (--keep 0 prunes all), 6b (empty-tree no-op)", "Preflight parks (not reds) when free space on the results filesystem is below one guest's virtual cap": "preflight local-guest block calls oc_results_fs_below_floor and die_host (the preflight-park path, exit 3) when below OC_GUEST_DISK_CAP_GIB (40) — predicate proven by check 7 (rc 0 above, 1 below, 2 unknown)", "The standing snapshot tree is untouched": "retention find is scoped to test-results/$results_name (private-path); standing-private is a sibling, never a run dir under it — proven by check 5 (standing-private/guest.qcow2 survives the pass)", "An offline test beside the existing retention/drive-log tests proves drop-at-end, the retention sweep, and --keep 0": "scripts/tests/rehearsal-guest-disk-test.sh (9 checks), auto-run by scripts/seam-smoke.sh's scripts/tests/*.sh loop", "A docs/GOTCHAS.md entry (Symptom -> Cause -> Rule, severity-marked) for an ended drive's guest disk is not evidence, appended in the same commit (ADR 0160)": "docs/GOTCHAS.md entry #259 (severity marked), added in commit f727890c" }, "summary": "An ended local-guest drive now drops its scratch state/vm/guest.qcow2, retention sweeps kept runs' leftover disks, and preflight parks below a one-guest disk floor -- evidence and the standing snapshot untouched.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1615
No description provided.