device target harvests no droplet-journal.txt — a stand-up red on a rented gateway is diagnosable only by luck #894

Closed
opened 2026-08-27 07:20:41 +00:00 by matou-build-agent · 3 comments

Symptom

The device-target drive harvests no logs/droplet-journal.txt, even though the target writes artifacts/droplet-ip.txt and leaves the droplet standing. When a rented gateway reds inside stand-up (e.g. #893, enroll-activate cloud-init crash), the one machine that could say which unit failed and why — the droplet — is never asked. Instead the run dir carries the VM-target harvest, every file of which reports there was no VM (guest-journal.log = -- No entries --, qemu.log empty, host.json qemu: ENOENT). This whole class of red is then diagnosable only by luck (the box happening to outlive the drive).

Proposed fix

The rented target already gathers droplet evidence before cleanup; the device teardown skips that step. Make the device target harvest the droplet journal (over the same identity-disciplined SSH dial the rented path uses, ADR 0126) into logs/droplet-journal.txt before teardown, keyed off the artifacts/droplet-ip.txt it already writes. Harvest lives in scripts/lib/rehearsal-droplet.sh / app/tests/e2e/fixtures/ — not a protected .sandcastle/ path, so this is an ordinary agent-doable slice. Guard with a seam test asserting the device teardown calls the droplet-evidence harvest (cf. scripts/tests/droplet-evidence-order-test.sh).

Origin

Found while fixing #893 (cloud-init restage red at enroll-activate). The product fix landed; this harness gap was item 3 of that ticket, filed separately to keep scope tight.

## Symptom The `device`-target drive harvests **no** `logs/droplet-journal.txt`, even though the target writes `artifacts/droplet-ip.txt` and leaves the droplet standing. When a rented gateway reds inside stand-up (e.g. #893, `enroll-activate` cloud-init crash), the one machine that could say which unit failed and why — the droplet — is never asked. Instead the run dir carries the *VM*-target harvest, every file of which reports there was no VM (`guest-journal.log` = `-- No entries --`, `qemu.log` empty, `host.json` `qemu: ENOENT`). This whole class of red is then diagnosable only by luck (the box happening to outlive the drive). ## Proposed fix The **rented** target already gathers droplet evidence before cleanup; the **device** teardown skips that step. Make the `device` target harvest the droplet journal (over the same identity-disciplined SSH dial the rented path uses, ADR 0126) into `logs/droplet-journal.txt` before teardown, keyed off the `artifacts/droplet-ip.txt` it already writes. Harvest lives in `scripts/lib/rehearsal-droplet.sh` / `app/tests/e2e/fixtures/` — **not** a protected `.sandcastle/` path, so this is an ordinary agent-doable slice. Guard with a seam test asserting the device teardown calls the droplet-evidence harvest (cf. `scripts/tests/droplet-evidence-order-test.sh`). ## Origin Found while fixing #893 (cloud-init restage red at `enroll-activate`). The product fix landed; this harness gap was item 3 of that ticket, filed separately to keep scope tight.
Owner

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

The claim holds. Verified against the harness: oc_droplet_evidence (the droplet-journal / caddy / stall-forensics harvest) is called on both the create-trap path (oc_droplet_cleanup) and the rented path (oc_rented_cleanup, keyed off artifacts/droplet-ip.txt), but oc_device_teardown destroys the member device and does nothing else — no droplet-evidence harvest before teardown. So a device-target drive keeps only the VM-target harvest, which on a droplet drive reports "no VM" for every file. The class of red is real and currently diagnosable only by luck. The referenced guard pattern (scripts/tests/droplet-evidence-order-test.sh) and the fixture home both exist and are outside .sandcastle/.

Two-way-door ruling — one correction to the ticket's premise, so it can go straight to an agent:

The ticket says harvest "keyed off the artifacts/droplet-ip.txt it already writes." That artifact belongs to the rented path; the device drive does not write it. In scripts/smoke-private-path.sh, the device drive stands up against a standing gateway (its IP is artifacts/standing-founded.json .ip — this is the box that reds in stand-up / enroll-activate, the #893 class) and joins a member device (OC_E2E_DEVICE_IP, the box oc_device_teardown destroys). So the ruling is: harvest both off the same identity-disciplined SSH dial the rented path uses (ADR 0126), each into its own clearly-named log, before oc_device_teardown runs — the gateway journal is what closes the #893-class gap; the device journal is cheap and its box is the one being destroyed.

  • Category: ruled bug — the device drive emits actively-misleading evidence (a "no VM" VM-harvest) for a whole class of droplet red, not merely a missing nice-to-have.
  • Why this is a two-way door: it is a harness-only change in agent-owned paths (scripts/lib/rehearsal-droplet.sh, scripts/smoke-private-path.sh, scripts/tests/), reverts with a single commit, adds no live-infra surface, touches no credentials or member-facing trust surface, and is provable offline.
  • What proves it: an offline seam test in the shape of scripts/tests/droplet-evidence-order-test.sh / scripts/tests/rehearsal-device-target-test.sh (test 7 already exercises oc_device_teardown offline against a fake clan-lab), asserting the device teardown/cleanup branch invokes the droplet-evidence harvest before destroy. No live drive required to land the code + guard.

Routing to ready-for-agent.


Agent Brief

Category: bug
Summary: The device-target drive harvests no droplet journal before teardown, so a stand-up red on a device drive (e.g. a gateway enroll-activate crash) leaves only a misleading VM-target harvest.

Current behavior:
On a device-target drive, post-drive cleanup runs only the member-device teardown verb, which destroys the device and gathers no off-box evidence. The droplet-evidence harvest (journal + caddy + stall-forensics, gathered over an identity-disciplined SSH dial per ADR 0126) that the rented and create-trap paths run before teardown is never reached. The run dir is left with the VM-target evidence set, every file of which reports "no VM" (guest-journal.log = -- No entries --, empty qemu.log, qemu: ENOENT). When the standing gateway or the member device reds during stand-up, nothing captured which unit failed or why.

Desired behavior:
Before the device-target cleanup tears the member device down, harvest the droplet journal (and the same caddy / forensics captures the shared harvest already gathers) off both relevant boxes, over the identity-disciplined SSH dial the rented path uses (ADR 0126), into clearly-named per-box logs under the run dir's logs/:

  • the standing gateway — the box that reds in stand-up / enroll-activate (the #893 class); its address is the .ip field of the drive's artifacts/standing-founded.json;
  • the member device — the box being destroyed; its address is the device IP the device-create verb exports (OC_E2E_DEVICE_IP).
    Each harvest must be best-effort: an unreachable box leaves a "note: … unreachable" marker in its log and never blocks teardown, and a device drive that never stood up a gateway (no standing-founded.json) is a quiet skip. The harvest must run before the device is destroyed — once oc_device_teardown fires, the device is gone.

Key interfaces:

  • The droplet-evidence harvest already exists as a reusable verb (oc_droplet_evidence, taking a run dir and reading OC_E2E_DROPLET_IP). Reuse it — set the target IP from each box's source before invoking, exactly as the rented path exports OC_E2E_DROPLET_IP from droplet-ip.txt. Do not fork a second harvest implementation.
  • The device cleanup branch (the one that calls the member-device teardown verb in the drive script) is where the new harvest calls belong, ahead of the teardown call.
  • Per-box log filenames must not collide with the rented/create-trap path's logs/droplet-journal.txt, or with each other — name them so a reader can tell gateway evidence from device evidence.

Acceptance criteria:

  • On a device-target drive, the run dir's logs/ contains a droplet-journal harvest for the standing gateway (keyed off standing-founded.json .ip) when that file is present.
  • On a device-target drive, the run dir's logs/ contains a droplet-journal harvest for the member device (keyed off OC_E2E_DEVICE_IP) when the device was created.
  • The harvest(s) run before the member device is torn down.
  • An unreachable box writes a "note: … unreachable" marker to its log and does not fail the teardown; a device drive with no standing-founded.json skips the gateway harvest quietly.
  • An offline seam test (in the shape of scripts/tests/droplet-evidence-order-test.sh / the existing scripts/tests/rehearsal-device-target-test.sh, using a fake clan-lab/ssh) asserts the device cleanup branch invokes the droplet-evidence harvest before the teardown verb. It passes with no network and no DO token.
  • The rented and create-trap harvest paths are behaviourally unchanged.

Out of scope:

  • Any change to the member-device teardown's destroy semantics or its structural guarantee that it cannot reach the broker-made standing gateway.
  • Changing what the shared droplet-evidence harvest captures (journal/caddy/forensics content); this ticket only wires it into the device path.
  • The product-side fix for the gateway enroll-activate crash itself (that is #893 and its siblings) — this is purely the harness evidence gap.
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **The claim holds.** Verified against the harness: `oc_droplet_evidence` (the droplet-journal / caddy / stall-forensics harvest) is called on both the create-trap path (`oc_droplet_cleanup`) and the rented path (`oc_rented_cleanup`, keyed off `artifacts/droplet-ip.txt`), but **`oc_device_teardown` destroys the member device and does nothing else** — no droplet-evidence harvest before teardown. So a device-target drive keeps only the VM-target harvest, which on a droplet drive reports "no VM" for every file. The class of red is real and currently diagnosable only by luck. The referenced guard pattern (`scripts/tests/droplet-evidence-order-test.sh`) and the fixture home both exist and are outside `.sandcastle/`. **Two-way-door ruling — one correction to the ticket's premise, so it can go straight to an agent:** The ticket says harvest "keyed off the `artifacts/droplet-ip.txt` it already writes." That artifact belongs to the **rented** path; the **device** drive does not write it. In `scripts/smoke-private-path.sh`, the device drive stands up against a **standing gateway** (its IP is `artifacts/standing-founded.json` `.ip` — this is the box that reds in stand-up / `enroll-activate`, the #893 class) and joins a **member device** (`OC_E2E_DEVICE_IP`, the box `oc_device_teardown` destroys). So the ruling is: **harvest both** off the same identity-disciplined SSH dial the rented path uses (ADR 0126), each into its own clearly-named log, **before** `oc_device_teardown` runs — the gateway journal is what closes the #893-class gap; the device journal is cheap and its box is the one being destroyed. - **Category:** ruled `bug` — the device drive emits actively-misleading evidence (a "no VM" VM-harvest) for a whole class of droplet red, not merely a missing nice-to-have. - **Why this is a two-way door:** it is a harness-only change in agent-owned paths (`scripts/lib/rehearsal-droplet.sh`, `scripts/smoke-private-path.sh`, `scripts/tests/`), reverts with a single commit, adds no live-infra surface, touches no credentials or member-facing trust surface, and is provable offline. - **What proves it:** an offline seam test in the shape of `scripts/tests/droplet-evidence-order-test.sh` / `scripts/tests/rehearsal-device-target-test.sh` (test 7 already exercises `oc_device_teardown` offline against a fake `clan-lab`), asserting the device teardown/cleanup branch invokes the droplet-evidence harvest **before** destroy. No live drive required to land the code + guard. Routing to `ready-for-agent`. --- ## Agent Brief **Category:** bug **Summary:** The device-target drive harvests no droplet journal before teardown, so a stand-up red on a device drive (e.g. a gateway `enroll-activate` crash) leaves only a misleading VM-target harvest. **Current behavior:** On a device-target drive, post-drive cleanup runs only the member-device teardown verb, which destroys the device and gathers no off-box evidence. The droplet-evidence harvest (journal + caddy + stall-forensics, gathered over an identity-disciplined SSH dial per ADR 0126) that the rented and create-trap paths run before teardown is never reached. The run dir is left with the VM-target evidence set, every file of which reports "no VM" (`guest-journal.log` = `-- No entries --`, empty `qemu.log`, `qemu: ENOENT`). When the standing gateway or the member device reds during stand-up, nothing captured which unit failed or why. **Desired behavior:** Before the device-target cleanup tears the member device down, harvest the droplet journal (and the same caddy / forensics captures the shared harvest already gathers) off **both** relevant boxes, over the identity-disciplined SSH dial the rented path uses (ADR 0126), into clearly-named per-box logs under the run dir's `logs/`: - the **standing gateway** — the box that reds in stand-up / `enroll-activate` (the #893 class); its address is the `.ip` field of the drive's `artifacts/standing-founded.json`; - the **member device** — the box being destroyed; its address is the device IP the device-create verb exports (`OC_E2E_DEVICE_IP`). Each harvest must be best-effort: an unreachable box leaves a "note: … unreachable" marker in its log and never blocks teardown, and a device drive that never stood up a gateway (no `standing-founded.json`) is a quiet skip. The harvest must run before the device is destroyed — once `oc_device_teardown` fires, the device is gone. **Key interfaces:** - The droplet-evidence harvest already exists as a reusable verb (`oc_droplet_evidence`, taking a run dir and reading `OC_E2E_DROPLET_IP`). Reuse it — set the target IP from each box's source before invoking, exactly as the rented path exports `OC_E2E_DROPLET_IP` from `droplet-ip.txt`. Do not fork a second harvest implementation. - The device cleanup branch (the one that calls the member-device teardown verb in the drive script) is where the new harvest calls belong, ahead of the teardown call. - Per-box log filenames must not collide with the rented/create-trap path's `logs/droplet-journal.txt`, or with each other — name them so a reader can tell gateway evidence from device evidence. **Acceptance criteria:** - [ ] On a device-target drive, the run dir's `logs/` contains a droplet-journal harvest for the standing gateway (keyed off `standing-founded.json` `.ip`) when that file is present. - [ ] On a device-target drive, the run dir's `logs/` contains a droplet-journal harvest for the member device (keyed off `OC_E2E_DEVICE_IP`) when the device was created. - [ ] The harvest(s) run before the member device is torn down. - [ ] An unreachable box writes a "note: … unreachable" marker to its log and does not fail the teardown; a device drive with no `standing-founded.json` skips the gateway harvest quietly. - [ ] An offline seam test (in the shape of `scripts/tests/droplet-evidence-order-test.sh` / the existing `scripts/tests/rehearsal-device-target-test.sh`, using a fake `clan-lab`/`ssh`) asserts the device cleanup branch invokes the droplet-evidence harvest before the teardown verb. It passes with no network and no DO token. - [ ] The rented and create-trap harvest paths are behaviourally unchanged. **Out of scope:** - Any change to the member-device teardown's destroy semantics or its structural guarantee that it cannot reach the broker-made standing gateway. - Changing what the shared droplet-evidence harvest captures (journal/caddy/forensics content); this ticket only wires it into the device path. - The product-side fix for the gateway `enroll-activate` crash itself (that is #893 and its siblings) — this is purely the harness evidence gap.
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=12647
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=12647 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #894 — status success

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

envelope
{
  "issue": 894,
  "status": "success",
  "commits": [
    "d993806"
  ],
  "changed_files": [
    "STATUS.md",
    "scripts/lib/rehearsal-droplet.sh",
    "scripts/smoke-private-path.sh",
    "scripts/tests/device-evidence-order-test.sh"
  ],
  "tests": [
    {
      "command": "bash scripts/tests/device-evidence-order-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/droplet-evidence-order-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/rehearsal-device-target-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/rented-cert-evidence-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "On a device-target drive, logs/ contains a droplet-journal harvest for the standing gateway (keyed off standing-founded.json .ip) when present": "oc_device_evidence reads artifacts/standing-founded.json .ip and calls oc_droplet_evidence with the `gateway` label → logs/gateway-journal.txt (rehearsal-droplet.sh; device-evidence-order-test.sh check 1)",
    "On a device-target drive, logs/ contains a droplet-journal harvest for the member device (keyed off OC_E2E_DEVICE_IP) when the device was created": "oc_device_evidence calls oc_droplet_evidence with the `device` label off OC_E2E_DEVICE_IP → logs/device-journal.txt (device-evidence-order-test.sh check 1)",
    "The harvest(s) run before the member device is torn down": "smoke-private-path.sh device branch calls oc_device_evidence before oc_device_teardown; asserted source-level in device-evidence-order-test.sh check 6",
    "An unreachable box writes a note: … unreachable marker and does not fail teardown; a device drive with no standing-founded.json skips the gateway harvest quietly": "device-evidence-order-test.sh checks 2 (unreachable→note, rc 0) and 3 (absent facts→quiet skip)",
    "An offline seam test (fake clan-lab/ssh) asserts the device cleanup branch invokes the droplet-evidence harvest before the teardown verb; passes with no network and no DO token": "scripts/tests/device-evidence-order-test.sh, 6 checks, exit 0, no network/token",
    "The rented and create-trap harvest paths are behaviourally unchanged": "oc_droplet_evidence label defaults to `droplet` → logs/droplet-*.txt unchanged (device-evidence-order-test.sh check 5; droplet-evidence-order-test.sh + rented-cert-evidence-test.sh still green)"
  },
  "summary": "The device-target drive now harvests a per-box droplet journal off both the standing gateway and the member device before oc_device_teardown, closing the #893 evidence-gap residue.",
  "blockers": []
}
**close-report** for #894 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 894, "status": "success", "commits": [ "d993806" ], "changed_files": [ "STATUS.md", "scripts/lib/rehearsal-droplet.sh", "scripts/smoke-private-path.sh", "scripts/tests/device-evidence-order-test.sh" ], "tests": [ { "command": "bash scripts/tests/device-evidence-order-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/droplet-evidence-order-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/rehearsal-device-target-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/rented-cert-evidence-test.sh", "exit_code": 0 } ], "criteria": { "On a device-target drive, logs/ contains a droplet-journal harvest for the standing gateway (keyed off standing-founded.json .ip) when present": "oc_device_evidence reads artifacts/standing-founded.json .ip and calls oc_droplet_evidence with the `gateway` label → logs/gateway-journal.txt (rehearsal-droplet.sh; device-evidence-order-test.sh check 1)", "On a device-target drive, logs/ contains a droplet-journal harvest for the member device (keyed off OC_E2E_DEVICE_IP) when the device was created": "oc_device_evidence calls oc_droplet_evidence with the `device` label off OC_E2E_DEVICE_IP → logs/device-journal.txt (device-evidence-order-test.sh check 1)", "The harvest(s) run before the member device is torn down": "smoke-private-path.sh device branch calls oc_device_evidence before oc_device_teardown; asserted source-level in device-evidence-order-test.sh check 6", "An unreachable box writes a note: … unreachable marker and does not fail teardown; a device drive with no standing-founded.json skips the gateway harvest quietly": "device-evidence-order-test.sh checks 2 (unreachable→note, rc 0) and 3 (absent facts→quiet skip)", "An offline seam test (fake clan-lab/ssh) asserts the device cleanup branch invokes the droplet-evidence harvest before the teardown verb; passes with no network and no DO token": "scripts/tests/device-evidence-order-test.sh, 6 checks, exit 0, no network/token", "The rented and create-trap harvest paths are behaviourally unchanged": "oc_droplet_evidence label defaults to `droplet` → logs/droplet-*.txt unchanged (device-evidence-order-test.sh check 5; droplet-evidence-order-test.sh + rented-cert-evidence-test.sh still green)" }, "summary": "The device-target drive now harvests a per-box droplet journal off both the standing gateway and the member device before oc_device_teardown, closing the #893 evidence-gap residue.", "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#894
No description provided.