app: private-path bootstrap payload — the operator-app install carries agent + QEMU + base image (pre-gateway ADR needed) #196

Closed
opened 2026-07-30 23:17:49 +00:00 by ben · 4 comments
Owner

Parent

Engine-adapters close-out #183. Design question surfaced 2026-07-30 while preparing Phase A of the driver checklist, sharpened by Ben's review of the QEMU/KVM prerequisites.

The question

ADR 0056 rules the agent bundles a pinned QEMU per platform ("nothing for the device owner to install"), and ADR 0054 rules the agent artifact is served from the gateway's own cache, never a metered upstream. Both hold for every join path — except founding's private path (P1 VAR), which runs before any gateway exists. There is no cache to serve from: the operator-app install itself must carry everything the local stand-up needs.

Today's stopgaps make the gap concrete: vm.DefaultConfig() falls back to PATH lookup for qemu-img/qemu-system-x86_64 (the operator must apt install — exactly what ADR 0056 rejected), and the guest base image resolves from OURCLOUD_GUEST_IMAGE or a state-dir default (nixos-guest.qcow2) that nothing yet produces or places. KVM is correctly out of scope — a host kernel capability the app can only probe (hostprobe does) and ask for, never ship.

What to decide / build

  1. Decide the carriage (ADR): the operator-app install (per-platform) bundles the agent binary + pinned QEMU payload + per-arch NixOS guest base image for the private path — or names another honest source that exists pre-gateway. Reconcile with ADR 0054's cache rule (which still governs every post-gateway join) and ADR 0056's nothing-to-install promise.
  2. Carry the base image: the guest artifact's build recipe is split to #216 (armed ready-for-agent — it gates #183 Phase A and needs no ADR); this ticket carries the built artifact in the install and hands its path to the resolution order.
  3. Wire the resolution: the packaged app hands the helper (and the locally-installed agent) the bundled paths, so vm.Config.QemuImg/QemuSystem/BaseImage point at carried artifacts — PATH fallback becomes a dev-only convenience; a missing payload stays a legible fail-loud (ADR 0100).

Acceptance criteria

  • Given the decision recorded as an ADR, When the operator installs the app on a supported Linux machine with no fleet, Then founding's private path stands up the local gateway VM with no separately-installed hypervisor and no hand-placed image
  • Given ADR 0054's cache rule, When a post-gateway join runs, Then it is unchanged — the carriage decision covers only the pre-gateway bootstrap
  • Given a missing or corrupt carried payload, When the private path is driven, Then the failure is legible and honest (ADR 0100)

Task manifest

task: app:private-path-bootstrap-payload
implements_seam: "ADR 0056 (bundled QEMU) + ADR 0054 (gateway-cache serving) + founding P1 VAR; the pre-gateway carve-out needs its own ADR"
interface: "the operator-app install artifact; vm.Config resolution in helper + agent"
seam: "founding's private path driven on a clean machine"
acceptance:
  - given: a clean Linux machine + the installed app; when: the private path is driven; then: local VM standup succeeds from carried payloads alone, or fails legibly
depends_on: []
out_of_scope: [macOS/Windows carriage (their packaging is later work — ADR 0040/0108), KVM/virtualisation enablement (host capability, probed not shipped), post-gateway artifact serving (ADR 0054 stands)]
needs_human_decision: ["the carriage ADR reconciling 0054/0056 for the pre-gateway bootstrap — agent may draft, Ben reviews with the 0102-0108 pile"]

Blocks

#183 — Phase A leg A·1 as a packaged journey (the apt-install + hand-placed-image stopgap can drive a rehearsal, but the close-out's "no fake, nothing hand-rigged" spirit wants the carried payload).

## Parent Engine-adapters close-out #183. Design question surfaced 2026-07-30 while preparing Phase A of the driver checklist, sharpened by Ben's review of the QEMU/KVM prerequisites. ## The question ADR 0056 rules the agent **bundles a pinned QEMU per platform** ("nothing for the device owner to install"), and ADR 0054 rules the agent artifact is **served from the gateway's own cache, never a metered upstream**. Both hold for every join path — except founding's **private path (P1 VAR)**, which runs *before any gateway exists*. There is no cache to serve from: the operator-app install itself must carry everything the local stand-up needs. Today's stopgaps make the gap concrete: `vm.DefaultConfig()` falls back to PATH lookup for `qemu-img`/`qemu-system-x86_64` (the operator must `apt install` — exactly what ADR 0056 rejected), and the guest base image resolves from `OURCLOUD_GUEST_IMAGE` or a state-dir default (`nixos-guest.qcow2`) that nothing yet produces or places. KVM is correctly out of scope — a host kernel capability the app can only probe (hostprobe does) and ask for, never ship. ## What to decide / build 1. **Decide the carriage** (ADR): the operator-app install (per-platform) bundles the agent binary + pinned QEMU payload + per-arch NixOS guest base image for the private path — or names another honest source that exists pre-gateway. Reconcile with ADR 0054's cache rule (which still governs every post-gateway join) and ADR 0056's nothing-to-install promise. 2. **Carry the base image**: the guest artifact's *build recipe* is split to #216 (armed `ready-for-agent` — it gates #183 Phase A and needs no ADR); this ticket carries the built artifact in the install and hands its path to the resolution order. 3. **Wire the resolution**: the packaged app hands the helper (and the locally-installed agent) the bundled paths, so `vm.Config.QemuImg/QemuSystem/BaseImage` point at carried artifacts — PATH fallback becomes a dev-only convenience; a missing payload stays a legible fail-loud (ADR 0100). ## Acceptance criteria - [ ] Given the decision recorded as an ADR, When the operator installs the app on a supported Linux machine with no fleet, Then founding's private path stands up the local gateway VM with no separately-installed hypervisor and no hand-placed image - [ ] Given ADR 0054's cache rule, When a post-gateway join runs, Then it is unchanged — the carriage decision covers only the pre-gateway bootstrap - [ ] Given a missing or corrupt carried payload, When the private path is driven, Then the failure is legible and honest (ADR 0100) ## Task manifest ```yaml task: app:private-path-bootstrap-payload implements_seam: "ADR 0056 (bundled QEMU) + ADR 0054 (gateway-cache serving) + founding P1 VAR; the pre-gateway carve-out needs its own ADR" interface: "the operator-app install artifact; vm.Config resolution in helper + agent" seam: "founding's private path driven on a clean machine" acceptance: - given: a clean Linux machine + the installed app; when: the private path is driven; then: local VM standup succeeds from carried payloads alone, or fails legibly depends_on: [] out_of_scope: [macOS/Windows carriage (their packaging is later work — ADR 0040/0108), KVM/virtualisation enablement (host capability, probed not shipped), post-gateway artifact serving (ADR 0054 stands)] needs_human_decision: ["the carriage ADR reconciling 0054/0056 for the pre-gateway bootstrap — agent may draft, Ben reviews with the 0102-0108 pile"] ``` ## Blocks #183 — Phase A leg A·1 as a *packaged* journey (the apt-install + hand-placed-image stopgap can drive a rehearsal, but the close-out's "no fake, nothing hand-rigged" spirit wants the carried payload).
Author
Owner

This was generated by AI during triage.

Triage

Category: enhancement (already applied)
State: → ready-for-human

Human-decision gate: the issue's own task manifest carries a non-empty needs_human_decision:

"the carriage ADR reconciling 0054/0056 for the pre-gateway bootstrap — agent may draft, Ben reviews with the 0102-0108 pile"

Per the design-to-agent system's human-decision gate, any issue with a non-empty needs_human_decision routes to ready-for-human even when everything else (task manifest, acceptance criteria) is fully specified — because reconciling ADR 0054 (gateway-cache serving) against ADR 0056 (bundled QEMU, nothing to install) for a pre-gateway carve-out is a judgement call on architectural precedent, not something an agent should decide unilaterally.

Redundancy check: confirmed the stopgaps named in the issue are real — vm.DefaultConfig()'s PATH fallback for qemu-img/qemu-system-x86_64 and the unproduced nixos-guest.qcow2 default are both still in place; nothing in the codebase already carries the bundled payload.

Design gate: not applicable in the blocking sense — no missing UX flow/wireframe; the blocker is an ADR decision, not a design artifact.

Suggested next step (non-binding): the issue itself says the agent may draft the ADR for Ben to review — that drafting could proceed under ready-for-human (a human merges/decides), rather than treating this as fully ready-for-agent implementation work.

> *This was generated by AI during triage.* ## Triage **Category:** enhancement (already applied) **State:** → `ready-for-human` **Human-decision gate:** the issue's own task manifest carries a non-empty `needs_human_decision`: > "the carriage ADR reconciling 0054/0056 for the pre-gateway bootstrap — agent may draft, Ben reviews with the 0102-0108 pile" Per the design-to-agent system's human-decision gate, any issue with a non-empty `needs_human_decision` routes to `ready-for-human` even when everything else (task manifest, acceptance criteria) is fully specified — because reconciling ADR 0054 (gateway-cache serving) against ADR 0056 (bundled QEMU, nothing to install) for a pre-gateway carve-out is a judgement call on architectural precedent, not something an agent should decide unilaterally. **Redundancy check:** confirmed the stopgaps named in the issue are real — `vm.DefaultConfig()`'s PATH fallback for `qemu-img`/`qemu-system-x86_64` and the unproduced `nixos-guest.qcow2` default are both still in place; nothing in the codebase already carries the bundled payload. **Design gate:** not applicable in the blocking sense — no missing UX flow/wireframe; the blocker is an ADR decision, not a design artifact. **Suggested next step (non-binding):** the issue itself says the agent may draft the ADR for Ben to review — that drafting could proceed under `ready-for-human` (a human merges/decides), rather than treating this as fully `ready-for-agent` implementation work.
Author
Owner

Ben confirmed a split (driven session 2026-07-30): the guest base-image build recipe moves to #216 (ready-for-agent) — buildable now, gates #183 Phase A, needs no carriage decision. This ticket keeps the carriage ADR (0054/0056 pre-gateway reconciliation) and the packaged-app bundling of agent + QEMU + the built image.

**Ben confirmed a split** (driven session 2026-07-30): the guest base-image build recipe moves to #216 (`ready-for-agent`) — buildable now, gates #183 Phase A, needs no carriage decision. This ticket keeps the carriage ADR (0054/0056 pre-gateway reconciliation) and the packaged-app bundling of agent + QEMU + the built image.
Author
Owner

Ruling taken (Ben, 2026-07-30): carriage confirmed — the operator-app installer bundles, per platform, the agent binary + pinned QEMU payload + per-arch NixOS guest base image for founding's private path. Recorded as ADR 0110 (docs/adr/0110-operator-app-install-carries-private-path-payload.md, commit fcb3ccc).

Reconciliation as proposed: the app is the one artifact that legitimately comes from Matou's release channel (ADR 0054/0033), so the payload rides the single download the operator already makes. Scope is the pre-gateway bootstrap only — every post-gateway join keeps ADR 0054's cache rule. vm.Config resolution: bundled paths first; env/PATH demote to dev-only; missing or corrupt payload fails loud (ADR 0100).

The pre-gateway ADR this ticket needed now exists — re-labelled ready-for-agent. Note #216 (the guest image build recipe) has since landed, so the artifact to carry is real.

**Ruling taken (Ben, 2026-07-30): carriage confirmed** — the operator-app installer bundles, per platform, the **agent binary + pinned QEMU payload + per-arch NixOS guest base image** for founding's private path. Recorded as **ADR 0110** (`docs/adr/0110-operator-app-install-carries-private-path-payload.md`, commit `fcb3ccc`). Reconciliation as proposed: the app is the one artifact that legitimately comes from Matou's release channel (ADR 0054/0033), so the payload rides the single download the operator already makes. Scope is the pre-gateway bootstrap only — every post-gateway join keeps ADR 0054's cache rule. `vm.Config` resolution: bundled paths first; env/PATH demote to dev-only; missing or corrupt payload fails loud (ADR 0100). The pre-gateway ADR this ticket needed now exists — re-labelled `ready-for-agent`. Note #216 (the guest image build recipe) has since landed, so the artifact to carry is real.
Author
Owner

Shipped in 8d73e07 (on origin/main). Followed Ben's recorded ruling (ADR 0110) — no new decision needed.

Carriage wired (ADR 0110):

  • internal/vm/resolve.go — new vm.ResolveConfig implements the resolution order: bundled paths first from OURCLOUD_PAYLOAD_DIR (QemuImg/QemuSystem/BaseImage → carried absolute paths, arch-aware qemu-system); OURCLOUD_GUEST_IMAGE/_QEMU_IMG/_QEMU_SYSTEM and bare PATH names demote to dev-only conveniences. vm.NewResolved() builds the production manager from it.
  • internal/vm/manager.go — missingPayload() names every absent carried artifact so Create fails loud legibly (AC #3, ADR 0100); a bare PATH qemu (dev) is not existence-checked.
  • Helper (app/helper/.../wiring_prod.go) and the locally-installed agent (agent/.../wiring_prod.go) both drop the ad-hoc guestImagePath() and resolve via vm.NewResolved().
  • App carriage: the Electron shell resolves resourcesPath/payload and hands it to the helper as OURCLOUD_PAYLOAD_DIR over the boot bridge + stdio bridge (electron-main.ts, boot-info.ts, stdioBridge.ts, production.ts); dev carries none. app/PACKAGING.md documents it.

Acceptance: AC1 — a clean-machine private path resolves QEMU + guest image from the carried install alone (no apt install, no hand-placed image). AC2 — post-gateway joins untouched (ADR 0054 stands; the install/gateway path is not modified). AC3 — a missing/corrupt payload is a legible fail-loud naming each absent artifact.

Seams (all green): internal/vm/resolve_test.go, internal/vm/manager_test.go (fail-loud on a missing carried qemu; bare PATH allowed in dev), app/tests/unit/stdioBridge.test.ts (payload+state dir injected; unset when none). The boot seam test proves the real helper composes over vm.NewResolved.

Incidental gate-unblock (this was the first Go slice to push through the #198 fail-closed pre-push gate; three latent problems blocked a full go build/vet/test/golangci-lint of main): #203's backupengine/targets.go compared fleetstate.DeviceID to clan.NodeID (a file that never compiled) — fixed by comparing string forms; #202's founding/seat.go had two revive comment-form nits — fixed; and the gate ran its stages inside git's pre-push hook env, so GIT_DIR/GIT_INDEX_FILE leaked into go test and broke the member/rescue tests that shell out to git -C <tmp> — gate_scrub_git_env in .sandcastle/gate-lib.sh now unsets git's hook env before the language stages (+1 offline check).

Still open downstream: #183 Phase A leg A·1 as a packaged journey now has a carried payload path (the physical per-platform payload bundling is packaging/installer work, ADR 0040/0108).

Shipped in `8d73e07` (on `origin/main`). Followed Ben's recorded ruling (**ADR 0110**) — no new decision needed. **Carriage wired (ADR 0110):** - `internal/vm/resolve.go` — new `vm.ResolveConfig` implements the resolution order: **bundled paths first** from `OURCLOUD_PAYLOAD_DIR` (`QemuImg`/`QemuSystem`/`BaseImage` → carried absolute paths, arch-aware `qemu-system`); `OURCLOUD_GUEST_IMAGE`/`_QEMU_IMG`/`_QEMU_SYSTEM` and bare PATH names demote to dev-only conveniences. `vm.NewResolved()` builds the production manager from it. - `internal/vm/manager.go` — `missingPayload()` names every absent **carried** artifact so `Create` fails loud legibly (AC #3, ADR 0100); a bare PATH qemu (dev) is not existence-checked. - Helper (`app/helper/.../wiring_prod.go`) and the locally-installed agent (`agent/.../wiring_prod.go`) both drop the ad-hoc `guestImagePath()` and resolve via `vm.NewResolved()`. - App carriage: the Electron shell resolves `resourcesPath/payload` and hands it to the helper as `OURCLOUD_PAYLOAD_DIR` over the boot bridge + stdio bridge (`electron-main.ts`, `boot-info.ts`, `stdioBridge.ts`, `production.ts`); dev carries none. `app/PACKAGING.md` documents it. **Acceptance:** AC1 — a clean-machine private path resolves QEMU + guest image from the carried install alone (no `apt install`, no hand-placed image). AC2 — post-gateway joins untouched (ADR 0054 stands; the `install`/gateway path is not modified). AC3 — a missing/corrupt payload is a legible fail-loud naming each absent artifact. **Seams (all green):** `internal/vm/resolve_test.go`, `internal/vm/manager_test.go` (fail-loud on a missing carried qemu; bare PATH allowed in dev), `app/tests/unit/stdioBridge.test.ts` (payload+state dir injected; unset when none). The boot seam test proves the real helper composes over `vm.NewResolved`. **Incidental gate-unblock** (this was the first Go slice to push through the #198 fail-closed pre-push gate; three latent problems blocked a full `go build`/`vet`/`test`/`golangci-lint` of main): #203's `backupengine/targets.go` compared `fleetstate.DeviceID` to `clan.NodeID` (a file that never compiled) — fixed by comparing string forms; #202's `founding/seat.go` had two revive comment-form nits — fixed; and the gate ran its stages inside git's pre-push hook env, so `GIT_DIR`/`GIT_INDEX_FILE` leaked into `go test` and broke the `member`/`rescue` tests that shell out to `git -C <tmp>` — `gate_scrub_git_env` in `.sandcastle/gate-lib.sh` now unsets git's hook env before the language stages (+1 offline check). Still open downstream: #183 Phase A leg A·1 as a *packaged* journey now has a carried payload path (the physical per-platform payload bundling is packaging/installer work, ADR 0040/0108).
ben closed this issue 2026-07-31 09:08:07 +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.

Reference
Matou/idss#196
No description provided.