remove-device: the VM offboard mirror never runs live — provision.GuestTeardown is an unwired seam, so a LOSES removal leaves the guest running on the host (ADR 0223 ruling 5; advances #1153) #1219

Closed
opened 2026-09-04 17:31:10 +00:00 by matou-build-agent · 1 comment

The failure

Drive 20260904T165415Z (--target device, vm axis), run dir /home/swarm/swarm/Matou/idss/test-results/drive-device/20260904T165415Z. 13 legs green, remove-device red at 155.6 s (artifacts/legs.json, artifacts/verdict.json — firstRedLeg: remove-device, commit 8bd61183):

the guest is not gone from the host after the LOSES removal (the offboard mirror of the decline teardown): the unit is still loaded (is-active active); /var/lib/idss/vm/guest.qcow2 is still on disk

The gateway-side removal held: the leg got past waitForRemovalSettled and assertFleetGatewayOnly (app/tests/e2e/journey.device.spec.ts:1152-1155) and only then threw in the VM-only guest probe (app/tests/e2e/fixtures/deviceAdd.ts:535, called at journey.device.spec.ts:1166). This is not a removal that failed — it is a removal that reported success with the guest still up.

The guest was still RUNNING, not just leftover files. logs/device-guest-unit.log shows the whole idss-guest.service unit still on the host at harvest (17:24), and logs/device-units.txt's ss -tlnp still lists all four of that unit's hostfwd loopback ports — 127.0.0.1:35943 / 46493 / 40431 / 45947 — held by pid 9812 (ld-linux-x86-64, the carried relocatable QEMU). Those are byte-for-byte the ports in the unit's ExecStart.

Root cause: the seam has no production adapter

Orchestrator.RemoveDevice tears the guest down through a producer-side seam:

  • internal/provision/provision.go:249 — GuestTeardown interface; :264 — WithGuestTeardown
  • internal/provision/deploy.go:292 — if o.guestTeardown != nil && d.Install != nil && d.Install.Mode == enroll.ModeVM { … RemoveGuest … }

WithGuestTeardown is called from three places, all tests: internal/provision/deploy_test.go:1658,1703,1724. The composition's pvOpts (control-plane/cmd/control-plane/whole_composition.go:389-507) never appends it. Live, o.guestTeardown is nil, the gate at deploy.go:292 is false, and:

  1. RemoveGuest never runs — the unit and qcow2 survive;
  2. noteGuestNotTornDown (deploy.go:337) never runs either, so the run carries no DeviceUnreachable note. The operator sees a clean removal over a host still running the guest — the masked success ADR 0100 forbids, and exactly what ADR 0223 ruling 5 (docs/adr/0223-vm-guest-joins-the-mesh.md:104-111) calls "a failed removal, not a partial one".

Landed unwired on purpose: commit 390b92b8 (#1162, task 6 of #1153) — "nil for the resting composition, the seam tests". This drive is the first live exercise of that path and it caught precisely the gap.

Why this is not a one-line wiring commit — there is no gateway→HOST channel at all

vm.Manager.Remove (internal/vm/manager.go:569) is local systemd+file work over vm.RealSystem() (internal/vm/system.go:19,29 — bare exec.CommandContext on the local box). Every construction site owns its own guest: the device agent (agent/cmd/agent/wiring_prod.go:100), the operator app helper (app/helper/cmd/helper/wiring_prod.go:339,467,710), a smoke binary (control-plane/cmd/smoke-vm/main.go:53). The control-plane binary never builds one.

The gateway's only remote-exec channel is the clan SSH adapter (internal/clan/adapter.go:365 execSSH, :100 sshStream), aimed at the target captured per operation in internal/provision/deploy.go:458-460 — root@+d.MeshAddress. For a VM node that address is the guest's wt0, not the host's: internal/join/land.go:96-98 states it outright ("the guest joins the mesh ITSELF. The host's own meshup is SKIPPED — the host is a supervisor, never a mesh peer"), :102 reads the guest's address, and commit e86e9f00 moved the gateway's deploy keys into the guest (land.go:120 GuestAuthorizeDeployKeys) with the reason "a box the gateway never dials in VM mode". The drive asserts that same posture and it passed (assertHostNotMeshPeer, app/tests/e2e/fixtures/deviceAdd.ts:581).

So the gateway holds none of the three things a teardown needs:

  • No host address. enroll.RequestView carries only MeshAddress (internal/enroll/enroll.go:248-254); NetworkFacts.Address is populated only on a full-install consent (internal/join/app.go:187); fleetstate.Device projects the same guest wt0 and no host address (internal/fleetstate/projection.go:311, internal/fleetstate/fleetstate.go:137-141).
  • No credential on the host. Deploy keys go to the guest, per e86e9f00.
  • No door. The agent's only listener is a Unix socket (agent/cmd/agent/main.go:268-276 → internal/join/socket.go:86), the helper↔agent contract of ADR 0053; no HTTP/TCP server exists in agent/, and the host firewall opens only 22 (nix/gateway-image/configuration.nix:70).

The teardown that DOES work is device-local and pull-driven: the agent long-polls the request view and runs the teardown itself when it goes terminal (internal/join/join.go:358,391 → tearDown :411 → VM.Remove :425; same shape on restart at internal/join/resume.go:75). That loop ends at StatusApproved (join.go:388-392), so an already-enrolled device has no standing poll to piggyback on.

Closing ruling 5 therefore means choosing one of: (a) put the host's door — address and credential — on the wire and into the fleet, against ADR 0223 ruling 1's mesh-invisible host; (b) make it a pull, mirroring the decline path: removal marks the node's enrol request terminal with a closure and the host agent keeps or resumes a watch past approval, so the existing tearDown fires unchanged over the enroll poll that already exists (cheapest, fits the architecture, but changes the agent's post-approval lifecycle); or (c) amend ADR 0223 ruling 5. That is a design decision, not a wiring commit.

Adjacent finding from the same commit family (no leg asserts it)

provision.GrantRevoker has no production implementation either — RevokeGrant appears only at its declaration (internal/provision/provision.go:231) and its single call site (internal/provision/deploy.go:279); WithGrantRevoker is never called outside tests, and whole_composition.go's pvOpts omits it. A live removal therefore does not revoke the removed device's identity grant, contrary to ADR 0210 ruling 5 and RemoveDevice's own doc-comment. The drive does not check this, so it is silently green. Worth folding into whatever ruling closes the offboard.

Refusal

Rule 3 (product-behaviour surface) fired. Wiring the offboard changes what a removal deploy DOES on a member's box — it would reach into the device host and delete the operator's guest and its qcow2 — and what the community sees (the "could not be reached … not erased" note becomes a reachable surface). It needs the channel ruling above before any code. Rule 2 would fire too: a new host-door fact on the wire (or an agent-lifecycle change), an adapter, the composition wiring and red-first tests is more than 3 files.

No heal was attempted; the checkout is clean.

drive 20260904T165415Z red at remove-device: the guest is not gone from the host after the LOSES removal (the offboard mirror of the decline teardown): the unit is still loaded (is-active active); /var/lib/idss/vm/guest.qcow2 is still on disk (s
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260904T165415Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## The failure Drive `20260904T165415Z` (`--target device`, vm axis), run dir `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260904T165415Z`. 13 legs green, `remove-device` red at 155.6 s (`artifacts/legs.json`, `artifacts/verdict.json` — `firstRedLeg: remove-device`, commit `8bd61183`): > the guest is not gone from the host after the LOSES removal (the offboard mirror of the decline teardown): the unit is still loaded (is-active active); /var/lib/idss/vm/guest.qcow2 is still on disk The **gateway-side** removal held: the leg got past `waitForRemovalSettled` and `assertFleetGatewayOnly` (`app/tests/e2e/journey.device.spec.ts:1152-1155`) and only then threw in the VM-only guest probe (`app/tests/e2e/fixtures/deviceAdd.ts:535`, called at `journey.device.spec.ts:1166`). This is not a removal that failed — it is a removal that reported success with the guest still up. **The guest was still RUNNING, not just leftover files.** `logs/device-guest-unit.log` shows the whole `idss-guest.service` unit still on the host at harvest (17:24), and `logs/device-units.txt`'s `ss -tlnp` still lists all four of that unit's `hostfwd` loopback ports — `127.0.0.1:35943 / 46493 / 40431 / 45947` — held by pid 9812 (`ld-linux-x86-64`, the carried relocatable QEMU). Those are byte-for-byte the ports in the unit's `ExecStart`. ## Root cause: the seam has no production adapter `Orchestrator.RemoveDevice` tears the guest down through a producer-side seam: - `internal/provision/provision.go:249` — `GuestTeardown` interface; `:264` — `WithGuestTeardown` - `internal/provision/deploy.go:292` — `if o.guestTeardown != nil && d.Install != nil && d.Install.Mode == enroll.ModeVM { … RemoveGuest … }` `WithGuestTeardown` is called from **three places, all tests**: `internal/provision/deploy_test.go:1658,1703,1724`. The composition's `pvOpts` (`control-plane/cmd/control-plane/whole_composition.go:389-507`) never appends it. Live, `o.guestTeardown` is nil, the gate at `deploy.go:292` is false, and: 1. `RemoveGuest` never runs — the unit and qcow2 survive; 2. `noteGuestNotTornDown` (`deploy.go:337`) never runs either, so the run carries **no** `DeviceUnreachable` note. The operator sees a clean removal over a host still running the guest — the masked success ADR 0100 forbids, and exactly what ADR 0223 ruling 5 (`docs/adr/0223-vm-guest-joins-the-mesh.md:104-111`) calls "a failed removal, not a partial one". Landed unwired on purpose: commit `390b92b8` (#1162, task 6 of #1153) — "nil for the resting composition, the seam tests". This drive is the first live exercise of that path and it caught precisely the gap. ## Why this is not a one-line wiring commit — there is no gateway→HOST channel at all `vm.Manager.Remove` (`internal/vm/manager.go:569`) is local systemd+file work over `vm.RealSystem()` (`internal/vm/system.go:19,29` — bare `exec.CommandContext` on the local box). Every construction site owns its own guest: the device agent (`agent/cmd/agent/wiring_prod.go:100`), the operator app helper (`app/helper/cmd/helper/wiring_prod.go:339,467,710`), a smoke binary (`control-plane/cmd/smoke-vm/main.go:53`). The `control-plane` binary never builds one. The gateway's only remote-exec channel is the clan SSH adapter (`internal/clan/adapter.go:365` `execSSH`, `:100` `sshStream`), aimed at the target captured per operation in `internal/provision/deploy.go:458-460` — `root@`+`d.MeshAddress`. For a VM node that address **is the guest's wt0, not the host's**: `internal/join/land.go:96-98` states it outright ("the guest joins the mesh ITSELF. The host's own meshup is SKIPPED — the host is a supervisor, never a mesh peer"), `:102` reads the guest's address, and commit `e86e9f00` moved the gateway's deploy keys **into the guest** (`land.go:120` `GuestAuthorizeDeployKeys`) with the reason "a box the gateway never dials in VM mode". The drive asserts that same posture and it passed (`assertHostNotMeshPeer`, `app/tests/e2e/fixtures/deviceAdd.ts:581`). So the gateway holds none of the three things a teardown needs: - **No host address.** `enroll.RequestView` carries only `MeshAddress` (`internal/enroll/enroll.go:248-254`); `NetworkFacts.Address` is populated only on a full-install consent (`internal/join/app.go:187`); `fleetstate.Device` projects the same guest wt0 and no host address (`internal/fleetstate/projection.go:311`, `internal/fleetstate/fleetstate.go:137-141`). - **No credential on the host.** Deploy keys go to the guest, per `e86e9f00`. - **No door.** The agent's only listener is a Unix socket (`agent/cmd/agent/main.go:268-276` → `internal/join/socket.go:86`), the helper↔agent contract of ADR 0053; no HTTP/TCP server exists in `agent/`, and the host firewall opens only 22 (`nix/gateway-image/configuration.nix:70`). The teardown that DOES work is device-local and pull-driven: the agent long-polls the request view and runs the teardown itself when it goes terminal (`internal/join/join.go:358,391` → `tearDown` `:411` → `VM.Remove` `:425`; same shape on restart at `internal/join/resume.go:75`). That loop ends at `StatusApproved` (`join.go:388-392`), so an already-enrolled device has no standing poll to piggyback on. Closing ruling 5 therefore means choosing one of: **(a)** put the host's door — address *and* credential — on the wire and into the fleet, against ADR 0223 ruling 1's mesh-invisible host; **(b)** make it a pull, mirroring the decline path: removal marks the node's enrol request terminal with a closure and the host agent keeps or resumes a watch past approval, so the existing `tearDown` fires unchanged over the enroll poll that already exists (cheapest, fits the architecture, but changes the agent's post-approval lifecycle); or **(c)** amend ADR 0223 ruling 5. That is a design decision, not a wiring commit. ## Adjacent finding from the same commit family (no leg asserts it) `provision.GrantRevoker` has **no production implementation either** — `RevokeGrant` appears only at its declaration (`internal/provision/provision.go:231`) and its single call site (`internal/provision/deploy.go:279`); `WithGrantRevoker` is never called outside tests, and `whole_composition.go`'s `pvOpts` omits it. A live removal therefore does not revoke the removed device's identity grant, contrary to ADR 0210 ruling 5 and `RemoveDevice`'s own doc-comment. The drive does not check this, so it is silently green. Worth folding into whatever ruling closes the offboard. ## Refusal **Rule 3 (product-behaviour surface) fired.** Wiring the offboard changes what a removal deploy DOES on a member's box — it would reach into the device host and delete the operator's guest and its qcow2 — and what the community sees (the "could not be reached … not erased" note becomes a reachable surface). It needs the channel ruling above before any code. Rule 2 would fire too: a new host-door fact on the wire (or an agent-lifecycle change), an adapter, the composition wiring and red-first tests is more than 3 files. No heal was attempted; the checkout is clean. drive `20260904T165415Z` red at `remove-device`: `the guest is not gone from the host after the LOSES removal (the offboard mirror of the decline teardown): the unit is still loaded (is-active active); /var/lib/idss/vm/guest.qcow2 is still on disk (s` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260904T165415Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 0be66b4eb38d -->
Owner

Ruled by session under ADR 0174 — veto anytime: shape (b), landed b0b0ba65. The offboard is a pull mirroring the decline path — the filing's own "cheapest, fits the architecture" read was right, and (a) was rejected for exactly the reason it names: a host door on the wire contradicts ruling 1's mesh-invisible host, whose deploy keys deliberately live in the guest.

What landed:

  • The grant revoke is real (the filing's adjacent finding, folded in): new enroll.Ledger.RevokeGrant(node) closes the node's request terminal with Closure{Revoked} (SelfRemove false in VM mode) and removes its mesh peer (ADR 0214 d.4) — idempotent on a closed request, loud on an unknown node. provision.WithGrantRevoker is now actually wired in the whole composition, unconditionally.
  • The host fetches its own fate: the resume anchor persists past Enrolled in a guard form (enrolled: true; the resume watch skips it), and the standing agent's existing 30 s tick also runs join.GuardEnrolledOnce — poll the request by id, and on a terminal closure run the SAME directed tearDown a decline always has: guest unit + qcow2 gone, host agent stays. A poll fault is logged and retried, never a teardown on a guess (ADR 0100).
  • Ruling 5 is bounded-eventual (ADR 0223 amended): gone within one guard tick + teardown time; the drive's remove-device leg now polls with a 180 s deadline instead of the one-shot probe (which would red on any pull latency).
  • WithGuestTeardown stays as a seam for a composition that genuinely holds a host door; its doc-comment no longer claims a wiring that never existed. GOTCHAS #164 records the class: a With* option's "wired in the composition" comment is a claim to verify with a non-test grep.

Pins: TestRevokeGrant_ClosesEnrolledRequestAndRevokesMesh, TestGuard_EnrolledAnchorStandsQuiet, TestGuard_RemovalRevocationTearsDownGuest; the three anchor tests that pinned clear-at-Enrolled now pin the guard form. go test ./... green, gofmt/vet clean, the spec edit typechecks.

Delivery: all agent-tree (Go) — ruling 3a's re-supply carries it; no snapshot rail involved (GOTCHAS #163). Closing — the drive re-fires and the remove-device leg is the live proof.

**Ruled by session under ADR 0174 — veto anytime: shape (b), landed `b0b0ba65`.** The offboard is a pull mirroring the decline path — the filing's own "cheapest, fits the architecture" read was right, and (a) was rejected for exactly the reason it names: a host door on the wire contradicts ruling 1's mesh-invisible host, whose deploy keys deliberately live in the guest. What landed: - **The grant revoke is real** (the filing's adjacent finding, folded in): new `enroll.Ledger.RevokeGrant(node)` closes the node's request terminal with `Closure{Revoked}` (`SelfRemove` false in VM mode) and removes its mesh peer (ADR 0214 d.4) — idempotent on a closed request, loud on an unknown node. `provision.WithGrantRevoker` is now actually wired in the whole composition, unconditionally. - **The host fetches its own fate**: the resume anchor persists past Enrolled in a guard form (`enrolled: true`; the resume watch skips it), and the standing agent's existing 30 s tick also runs `join.GuardEnrolledOnce` — poll the request by id, and on a terminal closure run the SAME directed `tearDown` a decline always has: guest unit + qcow2 gone, host agent stays. A poll fault is logged and retried, never a teardown on a guess (ADR 0100). - **Ruling 5 is bounded-eventual** (ADR 0223 amended): gone within one guard tick + teardown time; the drive's remove-device leg now polls with a 180 s deadline instead of the one-shot probe (which would red on any pull latency). - `WithGuestTeardown` stays as a seam for a composition that genuinely holds a host door; its doc-comment no longer claims a wiring that never existed. GOTCHAS #164 records the class: a `With*` option's "wired in the composition" comment is a claim to verify with a non-test grep. Pins: `TestRevokeGrant_ClosesEnrolledRequestAndRevokesMesh`, `TestGuard_EnrolledAnchorStandsQuiet`, `TestGuard_RemovalRevocationTearsDownGuest`; the three anchor tests that pinned clear-at-Enrolled now pin the guard form. `go test ./...` green, gofmt/vet clean, the spec edit typechecks. Delivery: all agent-tree (Go) — ruling 3a's re-supply carries it; no snapshot rail involved (GOTCHAS #163). Closing — the drive re-fires and the remove-device leg is the live proof.
ben closed this issue 2026-09-04 17:45:17 +00:00
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.

Reference
Matou/idss#1219
No description provided.