The rehearsal harness's rented-gateway SSH dials carry no identity — #744's authorized_keys scrub took away the ambient trust they were silently riding #885

Closed
opened 2026-08-27 03:49:55 +00:00 by matou-build-agent · 2 comments

Failure

Drive test-results/drive-device/20260827T033903Z (commit f979d57c) reds at leg standing, and again at image-boot — the SAME error, because runRentedPrefix runs inside the standing leg. One fault, recorded twice; there is no second defect here.

idss-agent is not active on the rented box: systemctl is-active reported ""
(Warning: Permanently added '168.144.170.129' (ED25519) to the list of known hosts.
 root@168.144.170.129: Permission denied (publickey,keyboard-interactive).)

The message blames the agent; the parenthetical is the real answer. systemctl never ran — SSH was refused. artifacts/legs.json shows wizard-rent/claim/create all green, so the box was genuinely rented and reachable; only authentication failed.

Evidence

  • Thrown at app/tests/e2e/fixtures/rentedPrefix.ts:363, after waitForSSHCommand at app/tests/e2e/fixtures/rentedPrefix.ts:354 spent its full 2-minute budget being refused (ms: 120373 for image-boot in artifacts/legs.json).
  • app/tests/e2e/fixtures/droplet.ts:28-41 builds the dial: StrictHostKeyChecking=accept-new, UserKnownHostsFile=<knownHostsFile()>, BatchMode=yes, root@${ip} — and no -i. With no identity named, ssh offers the executor's ambient ~/.ssh/id_ed25519 (swarm@elitebook-03 rehearsal executor). sshDropletInteractive (droplet.ts:120-140) has the same gap.
  • The rented box trusts exactly one key: broker/internal/broker/provider_do.go:144-155 — Create registers req.SSHPubKey and passes its single fingerprint as "ssh_keys": []string{fp}.
  • That key is the app's own rent-operator identity, minted into the app's state dir: app/helper/cmd/helper/wiring_prod.go:134-142 (rentOperatorKeyDir), contract in internal/founding/access.go:110-137 (RentPubKey.IdentityFile). For this drive it is app/test-results/standing-rented/state/rent-operator/id_ed25519, minted 03:40Z this run — verifiably NOT the ambient key.

Why this drive and not the last one

d49ece2b — "session: #744 — the generic gateway image stops shipping the build box's authorized_keys" (2026-08-25 22:06Z) — scrubbed /root/.ssh/authorized_keys from the golden snapshot. Its own commit message: the build droplet is created with EVERY key on the DO account and nixos-anywhere copied that file into the installed system, so "every rented community gateway root-trusted Matou's entire account key set for the life of the machine". The executor's ambient key was in that set. The harness's identity-less dial had been passing on it.

Last green image-boot: test-results/drive-rented/20260825T011451Z/artifacts/legs.json, 11.7 s, at 2026-08-25 01:14Z — before d49ece2b. This drive is the first to rent from a post-#744 snapshot. #744 did exactly what it set out to do; it uncovered a latent bug in the harness rather than causing one.

The shell half of the harness already knows the right identity and has for some time — scripts/lib/rehearsal-droplet.sh:932-936, 958-960: "It prefers the app's rent-operator identity ... falling back to the ambient key". Only the TypeScript half was left on the fallback. (Note that helper reads $run_dir/state/rent-operator/id_ed25519, which is ALSO wrong for the device drive — its app state dir is standingDir()/state, not $run_dir/state; state/ in this run dir is empty. Worth fixing in the same pass.)

Suspected layer

The drive harness only (app/tests/e2e/). No product code is implicated: the app's own rented carrier connects over the correct explicit identity (internal/founding/rentedpath.go:299-309, Identity: o.rentPubKey.IdentityFile(), deliberately NOT AmbientSSH — #692).

What plugging it needs

Which dials. Exactly five target the rented gateway and need the rent-operator identity:

  • app/tests/e2e/fixtures/rentedPrefix.ts:354 (waitForSSHCommand, image-boot agent check)
  • app/tests/e2e/fixtures/rentedPrefix.ts:368 (no-install-log check)
  • app/tests/e2e/fixtures/rentedPrefix.ts:379 (disko labels)
  • app/tests/e2e/fixtures/rentedPrefix.ts:448 (deploy leg, no-takeover journal check)
  • app/tests/e2e/journey.rented.spec.ts:314 (heartbeat renew line)

Every sshDroplet/sshDropletInteractive call in journey.device.spec.ts (:381, :409, :416, :438, :454, :461, :494, :577, :587, :636, :825) targets deviceIp() — the member droplet the bash carrier stands up with the account's own keys — and journey.selfhosted.spec.ts / journey.droplet.spec.ts dial ambiently by design (ADR 0152/0154). Those must KEEP the ambient identity. A blanket env-wide -i would break them; the identity has to be per-dial.

Shape. Add an optional identityFile to sshDroplet / waitForSSHCommand / sshDropletInteractive in app/tests/e2e/fixtures/droplet.ts, pushing -i <path> into the argv only when set — mirroring the existing knownHostsFile() seam at droplet.ts:12-20. Pass join(live.stateDir, 'rent-operator', 'id_ed25519') at the five sites above. live.stateDir is already on LaunchedApp (app/tests/e2e/fixtures/launch.ts:11), and rentedPrefix.ts already reads from it (:240).

The identity is valid for the post-deploy dials too. internal/founding/rentedpath.go:309 lands AuthorizedKeys: appendGuestTrust(facts.RootAuthorizedKeys, guestTrust) — the carrier scrapes the box's OWN /root/.ssh/authorized_keys (post-#744, exactly the rent-operator key cloud-init landed) and re-lands it declaratively, so the same -i works before and after the clan update. Dials at rentedPrefix.ts:448 and journey.rented.spec.ts:314 do not need a different key.

Fail loud rather than fall back. If the rent-operator key is absent at a gateway dial, red with that reason. A silent fallback to the ambient key is what let this hide for two days and cost a paid drive.

Seam test. app/tests/e2e/fixtures/droplet.test.ts already asserts argv shape for the known-hosts thread (:50, :130); add the mirror cases — -i present with the given path, absent when unset — for all three dial functions.

Also worth landing: a docs/GOTCHAS.md entry. The generalisable rule is that a harness dial with no explicit identity is riding trust nobody declared, and it goes green until the day someone correctly removes that trust — the same family as GOTCHAS #100 (a keypair's two halves are one artifact) and #707.

Why this was not self-healed

Four files (droplet.ts, droplet.test.ts, rentedPrefix.ts, journey.rented.spec.ts), and the only check runnable on this machine is the vitest argv seam — it proves -i reaches the command line, not that the box accepts the key. Real proof costs another droplet.

drive 20260827T033903Z red at standing: idss-agent is not active on the rented box: systemctl is-active reported "" (Warning: Permanently added '168.144.170.129' (ED25519) to the list of known hosts. root@168.144.170.129: Permission denied
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260827T033903Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure Drive `test-results/drive-device/20260827T033903Z` (commit `f979d57c`) reds at leg `standing`, and again at `image-boot` — the SAME error, because `runRentedPrefix` runs inside the `standing` leg. One fault, recorded twice; there is no second defect here. ``` idss-agent is not active on the rented box: systemctl is-active reported "" (Warning: Permanently added '168.144.170.129' (ED25519) to the list of known hosts. root@168.144.170.129: Permission denied (publickey,keyboard-interactive).) ``` The message blames the agent; the parenthetical is the real answer. `systemctl` never ran — SSH was refused. `artifacts/legs.json` shows `wizard-rent`/`claim`/`create` all green, so the box was genuinely rented and reachable; only authentication failed. ## Evidence - Thrown at `app/tests/e2e/fixtures/rentedPrefix.ts:363`, after `waitForSSHCommand` at `app/tests/e2e/fixtures/rentedPrefix.ts:354` spent its full 2-minute budget being refused (`ms: 120373` for `image-boot` in `artifacts/legs.json`). - `app/tests/e2e/fixtures/droplet.ts:28-41` builds the dial: `StrictHostKeyChecking=accept-new`, `UserKnownHostsFile=<knownHostsFile()>`, `BatchMode=yes`, `root@${ip}` — and **no `-i`**. With no identity named, ssh offers the executor's ambient `~/.ssh/id_ed25519` (`swarm@elitebook-03 rehearsal executor`). `sshDropletInteractive` (`droplet.ts:120-140`) has the same gap. - The rented box trusts exactly one key: `broker/internal/broker/provider_do.go:144-155` — `Create` registers `req.SSHPubKey` and passes its single fingerprint as `"ssh_keys": []string{fp}`. - That key is the app's own rent-operator identity, minted into the app's state dir: `app/helper/cmd/helper/wiring_prod.go:134-142` (`rentOperatorKeyDir`), contract in `internal/founding/access.go:110-137` (`RentPubKey.IdentityFile`). For this drive it is `app/test-results/standing-rented/state/rent-operator/id_ed25519`, minted 03:40Z this run — verifiably NOT the ambient key. ## Why this drive and not the last one `d49ece2b` — "session: #744 — the generic gateway image stops shipping the build box's authorized_keys" (2026-08-25 22:06Z) — scrubbed `/root/.ssh/authorized_keys` from the golden snapshot. Its own commit message: the build droplet is created with EVERY key on the DO account and nixos-anywhere copied that file into the installed system, so "every rented community gateway root-trusted Matou's entire account key set for the life of the machine". The executor's ambient key was in that set. The harness's identity-less dial had been passing on it. Last green `image-boot`: `test-results/drive-rented/20260825T011451Z/artifacts/legs.json`, 11.7 s, at 2026-08-25 01:14Z — before `d49ece2b`. This drive is the first to rent from a post-#744 snapshot. #744 did exactly what it set out to do; it uncovered a latent bug in the harness rather than causing one. The shell half of the harness already knows the right identity and has for some time — `scripts/lib/rehearsal-droplet.sh:932-936, 958-960`: "It prefers the app's rent-operator identity ... falling back to the ambient key". Only the TypeScript half was left on the fallback. (Note that helper reads `$run_dir/state/rent-operator/id_ed25519`, which is ALSO wrong for the device drive — its app state dir is `standingDir()/state`, not `$run_dir/state`; `state/` in this run dir is empty. Worth fixing in the same pass.) ## Suspected layer The drive harness only (`app/tests/e2e/`). No product code is implicated: the app's own rented carrier connects over the correct explicit identity (`internal/founding/rentedpath.go:299-309`, `Identity: o.rentPubKey.IdentityFile()`, deliberately NOT `AmbientSSH` — #692). ## What plugging it needs **Which dials.** Exactly five target the rented gateway and need the rent-operator identity: - `app/tests/e2e/fixtures/rentedPrefix.ts:354` (`waitForSSHCommand`, image-boot agent check) - `app/tests/e2e/fixtures/rentedPrefix.ts:368` (no-install-log check) - `app/tests/e2e/fixtures/rentedPrefix.ts:379` (disko labels) - `app/tests/e2e/fixtures/rentedPrefix.ts:448` (deploy leg, no-takeover journal check) - `app/tests/e2e/journey.rented.spec.ts:314` (heartbeat renew line) Every `sshDroplet`/`sshDropletInteractive` call in `journey.device.spec.ts` (`:381, :409, :416, :438, :454, :461, :494, :577, :587, :636, :825`) targets `deviceIp()` — the member droplet the bash carrier stands up with the account's own keys — and `journey.selfhosted.spec.ts` / `journey.droplet.spec.ts` dial ambiently by design (ADR 0152/0154). Those must KEEP the ambient identity. A blanket env-wide `-i` would break them; the identity has to be per-dial. **Shape.** Add an optional `identityFile` to `sshDroplet` / `waitForSSHCommand` / `sshDropletInteractive` in `app/tests/e2e/fixtures/droplet.ts`, pushing `-i <path>` into the argv only when set — mirroring the existing `knownHostsFile()` seam at `droplet.ts:12-20`. Pass `join(live.stateDir, 'rent-operator', 'id_ed25519')` at the five sites above. `live.stateDir` is already on `LaunchedApp` (`app/tests/e2e/fixtures/launch.ts:11`), and `rentedPrefix.ts` already reads from it (`:240`). **The identity is valid for the post-deploy dials too.** `internal/founding/rentedpath.go:309` lands `AuthorizedKeys: appendGuestTrust(facts.RootAuthorizedKeys, guestTrust)` — the carrier scrapes the box's OWN `/root/.ssh/authorized_keys` (post-#744, exactly the rent-operator key cloud-init landed) and re-lands it declaratively, so the same `-i` works before and after the `clan update`. Dials at `rentedPrefix.ts:448` and `journey.rented.spec.ts:314` do not need a different key. **Fail loud rather than fall back.** If the rent-operator key is absent at a gateway dial, red with that reason. A silent fallback to the ambient key is what let this hide for two days and cost a paid drive. **Seam test.** `app/tests/e2e/fixtures/droplet.test.ts` already asserts argv shape for the known-hosts thread (`:50`, `:130`); add the mirror cases — `-i` present with the given path, absent when unset — for all three dial functions. **Also worth landing:** a `docs/GOTCHAS.md` entry. The generalisable rule is that a harness dial with no explicit identity is riding trust nobody declared, and it goes green until the day someone correctly removes that trust — the same family as GOTCHAS #100 (a keypair's two halves are one artifact) and #707. ## Why this was not self-healed Four files (`droplet.ts`, `droplet.test.ts`, `rentedPrefix.ts`, `journey.rented.spec.ts`), and the only check runnable on this machine is the vitest argv seam — it proves `-i` reaches the command line, not that the box accepts the key. Real proof costs another droplet. drive `20260827T033903Z` red at `standing`: `idss-agent is not active on the rented box: systemctl is-active reported "" (Warning: Permanently added '168.144.170.129' (ED25519) to the list of known hosts. root@168.144.170.129: Permission denied ` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260827T033903Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 25304f657c24 -->
Author
Member

swarm-claim host=matou-dev-server-01 run=12537
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=12537 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #885 — status success

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

envelope
{
  "issue": 885,
  "status": "success",
  "commits": [
    "747ab179"
  ],
  "changed_files": [
    "STATUS.md",
    "app/tests/e2e/fixtures/droplet.test.ts",
    "app/tests/e2e/fixtures/droplet.ts",
    "app/tests/e2e/fixtures/rentedPrefix.ts",
    "app/tests/e2e/journey.rented.spec.ts",
    "docs/GOTCHAS.md"
  ],
  "tests": [
    {
      "command": "node_modules/.bin/vitest run tests/e2e/fixtures/droplet.test.ts",
      "exit_code": 0
    }
  ],
  "criteria": {
    "identityFile threads -i <path> into argv only when set (mirrors knownHostsFile seam)": "droplet.ts identityArgs() adds ['-i', path, '-o', 'IdentitiesOnly=yes'] only when identityFile defined; seam test 'adds -i <identity>...' + 'names no -i when unset' (droplet.test.ts, green)",
    "the five rented-gateway dials pass join(live.stateDir,'rent-operator','id_ed25519')": "rentedPrefix.ts sites 354/368/379/448 pass rentOperatorKey = join(live.stateDir,'rent-operator','id_ed25519'); journey.rented.spec.ts:314 passes the same",
    "device/selfhosted/droplet ambient dials unchanged": "no identityFile arg added to journey.device.spec.ts / selfhosted / droplet call sites; param is optional so they keep ambient behaviour",
    "fail loud rather than fall back when the rent-operator key is absent": "identityArgs throws 'does not exist — refusing to fall back'; seam tests 'rejects loud when the named identityFile does not exist' for sshDroplet and sshDropletInteractive (green)",
    "seam test asserts -i present/absent for all three dial functions": "droplet.test.ts adds cases for sshDroplet, waitForSSHCommand, sshDropletInteractive (14 tests green)",
    "docs/GOTCHAS.md entry landed": "GOTCHAS #101 appended in the same commit"
  },
  "summary": "Rented-gateway drive dials now name the app's rent-operator identity via optional -i, failing loud instead of silently riding the ambient key #744 removed.",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #885 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 885, "status": "success", "commits": [ "747ab179" ], "changed_files": [ "STATUS.md", "app/tests/e2e/fixtures/droplet.test.ts", "app/tests/e2e/fixtures/droplet.ts", "app/tests/e2e/fixtures/rentedPrefix.ts", "app/tests/e2e/journey.rented.spec.ts", "docs/GOTCHAS.md" ], "tests": [ { "command": "node_modules/.bin/vitest run tests/e2e/fixtures/droplet.test.ts", "exit_code": 0 } ], "criteria": { "identityFile threads -i <path> into argv only when set (mirrors knownHostsFile seam)": "droplet.ts identityArgs() adds ['-i', path, '-o', 'IdentitiesOnly=yes'] only when identityFile defined; seam test 'adds -i <identity>...' + 'names no -i when unset' (droplet.test.ts, green)", "the five rented-gateway dials pass join(live.stateDir,'rent-operator','id_ed25519')": "rentedPrefix.ts sites 354/368/379/448 pass rentOperatorKey = join(live.stateDir,'rent-operator','id_ed25519'); journey.rented.spec.ts:314 passes the same", "device/selfhosted/droplet ambient dials unchanged": "no identityFile arg added to journey.device.spec.ts / selfhosted / droplet call sites; param is optional so they keep ambient behaviour", "fail loud rather than fall back when the rent-operator key is absent": "identityArgs throws 'does not exist — refusing to fall back'; seam tests 'rejects loud when the named identityFile does not exist' for sshDroplet and sshDropletInteractive (green)", "seam test asserts -i present/absent for all three dial functions": "droplet.test.ts adds cases for sshDroplet, waitForSSHCommand, sshDropletInteractive (14 tests green)", "docs/GOTCHAS.md entry landed": "GOTCHAS #101 appended in the same commit" }, "summary": "Rented-gateway drive dials now name the app's rent-operator identity via optional -i, failing loud instead of silently riding the ambient key #744 removed.", "blockers": [], "no_code_change": "" } ``` </details>
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#885
No description provided.