rent-fails-clean can't reach its fault path: nothing ever mints the rent ssh_pubkey (own-vps/operator_ed25519.pub) #665

Closed
opened 2026-08-22 13:00:50 +00:00 by matou-build-agent · 2 comments

Failure

The rent-fails-clean honesty leg (tests/e2e/journey.rented.spec.ts, helper s4aRentExpectFail in the wizard fixtures) expects the S4a rent card to show a retriable [data-status="rent-error"] naming the broker's injected provision stage. Instead it shows a real broker validation error:

brokerclient: /v1/gateways/rent: 400 Bad Request: ssh_pubkey is required

Run: test-results/drive-rented/20260822T125436Z, signature dcd9de7c3e06. state/founding-state.json confirms the draft never left S4 (draft.step == "access"), consistent with the request being rejected before any provisioning happened.

Root cause

The app's rent POST always carries an empty ssh_pubkey, so the broker's own input-validation 400s the request before the rehearsal fault-injection path is ever reached:

  • internal/brokerclient/client.go:101 — body := map[string]string{"host": host, "ssh_pubkey": req.PubKey} puts whatever req.PubKey is (including "") on the wire.
  • app/src/components/founding/FoundingAccess.vue:288 — the Vue rent call deliberately sends props.client.rentServer({}); the pubkey is meant to be filled in server-side.
  • internal/founding/access.go:351-360 (Orchestrator.RentServer) is the only place that fills it in when the request arrives empty:
    if req.PubKey == "" && o.rentPubKeyPath != "" {
        if b, readErr := os.ReadFile(o.rentPubKeyPath); readErr == nil {
            req.PubKey = strings.TrimSpace(string(b))
        }
    }
    
    readErr is swallowed by design ("best-effort"), so a missing file just leaves PubKey "".
  • app/helper/cmd/helper/wiring_prod.go:140-142 wires rentPubKeyPath() to stateBaseDir()/own-vps/operator_ed25519.pub. Nothing in the codebase ever writes this file. There's no Ensure-style mint call for it anywhere (checked internal/sshkey, internal/founding/{ownvpspath,privatepath}.go, every ed25519.GenerateKey call site). So on every fresh state dir — rehearsal or real — os.ReadFile fails, PubKey stays "", and every rent call (success or fault-injected) hits the broker's hard requirement:
    • broker/internal/broker/http.go:190-193: if strings.TrimSpace(in.SSHPubKey) == "" { writeErr(w, log, http.StatusBadRequest, "ssh_pubkey is required"); return } — this runs before authorizeGateway and before rentals.Rent(...), i.e. before the rehearsal-rentfail claim-name fault injection the leg is trying to exercise.

The wiring_prod.go:138 comment ("a missing file leaves the rent's PubKey empty — the broker's while-alpha default stands in") describes broker behaviour that does not exist; the broker has no such default.

Compounding design conflict (why this isn't a mechanical fix)

ADR 0189 ruling 4 (docs/adr/0189-...md:24-32) says the rent should reuse "ADR 0152's keypair — not a new one minted per rent," implying an app-held operator SSH identity. But ADR 0152/0154 ("own-VPS founds by the app driving out", shape A) rule the opposite: the own-VPS carrier uses the operator's ambient SSH agent/key, explicitly "no identity" (internal/fleetwire/carrier.go:30-31: "Identity is deliberately absent: shape A uses the operator's ambient key/agent (ADR 0152)"), and internal/founding/rentedpath.go reuses that same ambient-only carrier for the rented path too. So even if rentPubKeyPath()'s file existed, nothing wires its private half into the carrier's SSH connection — the rent-pubkey file and the carrier's actual connect identity are two disconnected concepts today.

What plugging it needs

Two things, and the second is a design call, not a patch:

  1. A real Ensure-style mint/persist for own-vps/operator_ed25519.pub (+ private half), analogous to internal/sshkey.Ensure, run once before/at RentServer so req.PubKey is non-empty on a fresh state dir.
  2. A ruling reconciling ADR 0189 ruling 4 against ADR 0152/0154's ambient-key decision: either the rented path gets its own real identity wired into the carrier's Connect (a deliberate exception to shape A, since a freshly-provisioned rented box has no pre-existing ambient trust to reuse), or ADR 0189's text needs correcting to describe what's actually buildable. This determines whether the fix touches internal/fleetwire/carrier.go's CarrierConfig/Connect as well as the keygen.

Suspected layer: internal/founding (RentServer / rentedpath.go) + app/helper/cmd/helper/wiring_prod.go (key minting) + internal/fleetwire/carrier.go (connect identity) + a DDR amendment to ADR 0189 or 0152/0154.

Git history: both halves of this landed the same session — 8585a954 added the broker's hard ssh_pubkey is required 400, and 516c5054 ("sandcastle: #649") added rentPubKeyPath()/WithRentPubKey with the (incorrect) while-alpha-default assumption, ~1h16m later, without adding a generator for the file it reads.

No self-fix attempted: this needs a new persisted credential (security-sensitive) and a ruling between two conflicting ADRs — outside mechanical-fix bounds.

drive 20260822T125436Z red at rent-fails-clean: expect(locator).toContainText(expected) failed Locator: locator('[data-status="rent-error"]') Expected pattern: /provision/i Received string: "brokerclient: /v1/gateways/rent: 400 Bad Request: ssh_pub
evidence: test-results/…/20260822T125436Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

## Failure The `rent-fails-clean` honesty leg (`tests/e2e/journey.rented.spec.ts`, helper `s4aRentExpectFail` in the wizard fixtures) expects the S4a rent card to show a retriable `[data-status="rent-error"]` naming the broker's injected `provision` stage. Instead it shows a real broker validation error: ``` brokerclient: /v1/gateways/rent: 400 Bad Request: ssh_pubkey is required ``` Run: `test-results/drive-rented/20260822T125436Z`, signature `dcd9de7c3e06`. `state/founding-state.json` confirms the draft never left S4 (`draft.step == "access"`), consistent with the request being rejected before any provisioning happened. ## Root cause The app's rent POST always carries an **empty** `ssh_pubkey`, so the broker's own input-validation 400s the request *before* the rehearsal fault-injection path is ever reached: - `internal/brokerclient/client.go:101` — `body := map[string]string{"host": host, "ssh_pubkey": req.PubKey}` puts whatever `req.PubKey` is (including `""`) on the wire. - `app/src/components/founding/FoundingAccess.vue:288` — the Vue rent call deliberately sends `props.client.rentServer({})`; the pubkey is meant to be filled in server-side. - `internal/founding/access.go:351-360` (`Orchestrator.RentServer`) is the only place that fills it in when the request arrives empty: ```go if req.PubKey == "" && o.rentPubKeyPath != "" { if b, readErr := os.ReadFile(o.rentPubKeyPath); readErr == nil { req.PubKey = strings.TrimSpace(string(b)) } } ``` `readErr` is swallowed by design ("best-effort"), so a missing file just leaves `PubKey` `""`. - `app/helper/cmd/helper/wiring_prod.go:140-142` wires `rentPubKeyPath()` to `stateBaseDir()/own-vps/operator_ed25519.pub`. **Nothing in the codebase ever writes this file.** There's no `Ensure`-style mint call for it anywhere (checked `internal/sshkey`, `internal/founding/{ownvpspath,privatepath}.go`, every `ed25519.GenerateKey` call site). So on every fresh state dir — rehearsal or real — `os.ReadFile` fails, `PubKey` stays `""`, and every rent call (success or fault-injected) hits the broker's hard requirement: - `broker/internal/broker/http.go:190-193`: `if strings.TrimSpace(in.SSHPubKey) == "" { writeErr(w, log, http.StatusBadRequest, "ssh_pubkey is required"); return }` — this runs *before* `authorizeGateway` and before `rentals.Rent(...)`, i.e. before the `rehearsal-rentfail` claim-name fault injection the leg is trying to exercise. The `wiring_prod.go:138` comment ("a missing file leaves the rent's PubKey empty — the broker's while-alpha default stands in") describes broker behaviour that does not exist; the broker has no such default. ## Compounding design conflict (why this isn't a mechanical fix) ADR 0189 ruling 4 (`docs/adr/0189-...md:24-32`) says the rent should reuse "ADR 0152's keypair — not a new one minted per rent," implying an app-held operator SSH identity. But ADR 0152/0154 ("own-VPS founds by the app driving out", shape A) rule the opposite: the own-VPS carrier uses the operator's **ambient** SSH agent/key, explicitly "no identity" (`internal/fleetwire/carrier.go:30-31`: *"Identity is deliberately absent: shape A uses the operator's ambient key/agent (ADR 0152)"*), and `internal/founding/rentedpath.go` reuses that same ambient-only carrier for the rented path too. So even if `rentPubKeyPath()`'s file existed, nothing wires its private half into the carrier's SSH connection — the rent-pubkey file and the carrier's actual connect identity are two disconnected concepts today. ## What plugging it needs Two things, and the second is a design call, not a patch: 1. A real `Ensure`-style mint/persist for `own-vps/operator_ed25519.pub` (+ private half), analogous to `internal/sshkey.Ensure`, run once before/at `RentServer` so `req.PubKey` is non-empty on a fresh state dir. 2. A ruling reconciling ADR 0189 ruling 4 against ADR 0152/0154's ambient-key decision: either the rented path gets its own real identity wired into the carrier's `Connect` (a deliberate exception to shape A, since a freshly-provisioned rented box has no pre-existing ambient trust to reuse), or ADR 0189's text needs correcting to describe what's actually buildable. This determines whether the fix touches `internal/fleetwire/carrier.go`'s `CarrierConfig`/`Connect` as well as the keygen. Suspected layer: `internal/founding` (RentServer / rentedpath.go) + `app/helper/cmd/helper/wiring_prod.go` (key minting) + `internal/fleetwire/carrier.go` (connect identity) + a DDR amendment to ADR 0189 or 0152/0154. Git history: both halves of this landed the same session — `8585a954` added the broker's hard `ssh_pubkey is required` 400, and `516c5054` ("sandcastle: #649") added `rentPubKeyPath()`/`WithRentPubKey` with the (incorrect) while-alpha-default assumption, ~1h16m later, without adding a generator for the file it reads. No self-fix attempted: this needs a new persisted credential (security-sensitive) and a ruling between two conflicting ADRs — outside mechanical-fix bounds. drive `20260822T125436Z` red at `rent-fails-clean`: `expect(locator).toContainText(expected) failed Locator: locator('[data-status="rent-error"]') Expected pattern: /provision/i Received string: "brokerclient: /v1/gateways/rent: 400 Bad Request: ssh_pub` evidence: `test-results/…/20260822T125436Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: dcd9de7c3e06 -->
Author
Member

Ruled by agent under ADR 0174 — veto anytime

Both open questions here are two-way doors, not one-way ones:

  • Minting an app-held ed25519 keypair is not "personal credentials" (that's Ben's own PAT/password-manager class) and not a security-posture widening (it doesn't open a new surface or loosen an auth requirement — the broker already hard-requires ssh_pubkey; this makes that existing requirement actually satisfiable). Revertible by commit/config; provable by unit test (internal/sshkey.Ensure's existing mint/persist/reload tests, plus new founding-level tests proving RentServer mints on a blank PubKey and fails loud on a mint error).
  • The ADR 0189-vs-0152/0154 reconciliation is an explicit design-tier accept under ADR 0174 rule 1 ("DDRs/wireframes... extending the #514/#388 auto-accept precedent to standing policy").

Ruling: ADR 0189 ruling 4's intent (one keypair, minted once, reused across every rent) stands; its origin was wrong — ADR 0152/0154 (own-VPS shape A) is ambient-key-only by design, so there was never an app-held keypair there to reuse. Wrote docs/adr/0191-design-rent-operator-key-is-minted-not-reused-from-0152.md: mint a NEW app-held rent-operator keypair (the same mint-once-and-reload primitive ADR 0126 already uses for guest-trust), and wire its private half explicitly into the RENTED carrier's connect identity — a scoped exception to shape A, since a freshly broker-provisioned box has no ambient trust to reuse. Own-VPS is untouched.

What proves it: internal/founding gains a RentPubKey port (mirrors GuestTrust) and a second WithRentedCarrier port beside WithOwnVPSCarrier (two separate wired instances of the same interface). fleetwire.CarrierConfig gains an Identity field. New seam tests: TestRentServer_FillsBlankPubKeyFromRentPubKeySeam, TestRentServer_CallerSuppliedPubKeyIsNeverOverridden, TestRentServer_RentPubKeyMintFailureFailsLoud (internal/founding/access_test.go), TestOwnVPSCarrier_ConnectDialsExplicitIdentityWhenConfigured (internal/fleetwire/carrier_test.go). go build/vet/test ./... (main + -tags dev) and broker's own module all green; gofmt clean. Landed at 528ffaea.

Not re-proved by a fresh live drive this session: journey.rented.spec.ts needs a real broker + DigitalOcean and this session-runner class cannot itself fire the standing rehearsal (#577/ADR 0184 lock) — the next rented-target drive's rent-fails-clean leg is the live proof, per the #635/#636/#641/#642/#644/#662 precedent this repo already uses for closing on unit-test strength alone.

## Ruled by agent under ADR 0174 — veto anytime Both open questions here are two-way doors, not one-way ones: - **Minting an app-held ed25519 keypair** is not "personal credentials" (that's Ben's own PAT/password-manager class) and not a security-posture *widening* (it doesn't open a new surface or loosen an auth requirement — the broker already hard-requires `ssh_pubkey`; this makes that existing requirement actually satisfiable). Revertible by commit/config; provable by unit test (`internal/sshkey.Ensure`'s existing mint/persist/reload tests, plus new `founding`-level tests proving `RentServer` mints on a blank `PubKey` and fails loud on a mint error). - **The ADR 0189-vs-0152/0154 reconciliation** is an explicit design-tier accept under ADR 0174 rule 1 ("DDRs/wireframes... extending the #514/#388 auto-accept precedent to standing policy"). **Ruling:** ADR 0189 ruling 4's *intent* (one keypair, minted once, reused across every rent) stands; its *origin* was wrong — ADR 0152/0154 (own-VPS shape A) is ambient-key-only by design, so there was never an app-held keypair there to reuse. Wrote `docs/adr/0191-design-rent-operator-key-is-minted-not-reused-from-0152.md`: mint a NEW app-held rent-operator keypair (the same mint-once-and-reload primitive ADR 0126 already uses for guest-trust), and wire its private half explicitly into the RENTED carrier's connect identity — a scoped exception to shape A, since a freshly broker-provisioned box has no ambient trust to reuse. Own-VPS is untouched. **What proves it:** `internal/founding` gains a `RentPubKey` port (mirrors `GuestTrust`) and a second `WithRentedCarrier` port beside `WithOwnVPSCarrier` (two separate wired instances of the same interface). `fleetwire.CarrierConfig` gains an `Identity` field. New seam tests: `TestRentServer_FillsBlankPubKeyFromRentPubKeySeam`, `TestRentServer_CallerSuppliedPubKeyIsNeverOverridden`, `TestRentServer_RentPubKeyMintFailureFailsLoud` (`internal/founding/access_test.go`), `TestOwnVPSCarrier_ConnectDialsExplicitIdentityWhenConfigured` (`internal/fleetwire/carrier_test.go`). `go build/vet/test ./...` (main + `-tags dev`) and `broker`'s own module all green; `gofmt` clean. Landed at `528ffaea`. Not re-proved by a fresh live drive this session: `journey.rented.spec.ts` needs a real broker + DigitalOcean and this session-runner class cannot itself fire the standing rehearsal (#577/ADR 0184 lock) — the next `rented`-target drive's `rent-fails-clean` leg is the live proof, per the #635/#636/#641/#642/#644/#662 precedent this repo already uses for closing on unit-test strength alone.
Author
Member

Close report

Landed: 528ffaea on main — "mint the rent-operator SSH keypair; RentServer fails loud on a mint error, and the rented carrier connects over it (DDR 0191)".

What changed:

  • docs/adr/0191-design-rent-operator-key-is-minted-not-reused-from-0152.md (new DDR, ruling posted above)
  • internal/founding/access.go — new RentPubKey port; RentServer mints/reads a blank PubKey through it and fails loud on a mint error instead of silently sending "" to the broker
  • internal/founding/orchestrator.go, internal/founding/rentedpath.go — new rentedCarrier field + WithRentedCarrier option; the rented journey's Connect now dials over its own carrier instance, never the shared own-VPS one
  • internal/fleetwire/carrier.go — CarrierConfig gains Identity; Connect/RotateHostKey dial -i <identity> when set, "" = ambient (own-VPS unchanged)
  • app/helper/cmd/helper/wiring_prod.go — mints/reuses the keypair at rent-operator/ (new state-dir home, not own-vps/) via sshkey.Ensure; wires the rented carrier's Identity at the private-key path
  • app/helper/cmd/helper/wiring_dev.go, wiring_test.go — demo build + boot-seam exhaustiveness test updated for the new rented-carrier port
  • internal/founding/testing/fakes.go — new FakeRentPubKey
  • Tests: internal/founding/access_test.go (3 new), internal/fleetwire/carrier_test.go (1 new), internal/founding/rentedpath_test.go (wired WithRentedCarrier)
  • STATUS.md updated same-commit

Proof: go build ./..., go build -tags dev ./..., go vet ./..., go test ./... all green (main module + broker's own module); gofmt -l clean. New tests reproduce the exact bug (a blank RentRequest.PubKey used to silently stay "") and prove the fix, plus prove CarrierConfig.Identity reaches the real ssh argv.

Not proved by a fresh live drive — journey.rented.spec.ts needs a real broker + DigitalOcean droplet and this session-runner class cannot fire the standing rehearsal itself (#577/ADR 0184 lock). The next cron-triggered rented-target drive's rent-fails-clean leg is the live proof, per the established #635/#636/#641/#642/#644/#662 precedent for closing on seam-test strength when a live re-drive isn't reachable from a session.

Closing per that precedent.

## Close report **Landed:** `528ffaea` on `main` — "mint the rent-operator SSH keypair; RentServer fails loud on a mint error, and the rented carrier connects over it (DDR 0191)". **What changed:** - `docs/adr/0191-design-rent-operator-key-is-minted-not-reused-from-0152.md` (new DDR, ruling posted above) - `internal/founding/access.go` — new `RentPubKey` port; `RentServer` mints/reads a blank `PubKey` through it and fails loud on a mint error instead of silently sending `""` to the broker - `internal/founding/orchestrator.go`, `internal/founding/rentedpath.go` — new `rentedCarrier` field + `WithRentedCarrier` option; the rented journey's `Connect` now dials over its own carrier instance, never the shared own-VPS one - `internal/fleetwire/carrier.go` — `CarrierConfig` gains `Identity`; `Connect`/`RotateHostKey` dial `-i <identity>` when set, `""` = ambient (own-VPS unchanged) - `app/helper/cmd/helper/wiring_prod.go` — mints/reuses the keypair at `rent-operator/` (new state-dir home, not `own-vps/`) via `sshkey.Ensure`; wires the rented carrier's `Identity` at the private-key path - `app/helper/cmd/helper/wiring_dev.go`, `wiring_test.go` — demo build + boot-seam exhaustiveness test updated for the new `rented-carrier` port - `internal/founding/testing/fakes.go` — new `FakeRentPubKey` - Tests: `internal/founding/access_test.go` (3 new), `internal/fleetwire/carrier_test.go` (1 new), `internal/founding/rentedpath_test.go` (wired `WithRentedCarrier`) - `STATUS.md` updated same-commit **Proof:** `go build ./...`, `go build -tags dev ./...`, `go vet ./...`, `go test ./...` all green (main module + `broker`'s own module); `gofmt -l` clean. New tests reproduce the exact bug (a blank `RentRequest.PubKey` used to silently stay `""`) and prove the fix, plus prove `CarrierConfig.Identity` reaches the real ssh argv. **Not proved by a fresh live drive** — `journey.rented.spec.ts` needs a real broker + DigitalOcean droplet and this session-runner class cannot fire the standing rehearsal itself (#577/ADR 0184 lock). The next cron-triggered `rented`-target drive's `rent-fails-clean` leg is the live proof, per the established #635/#636/#641/#642/#644/#662 precedent for closing on seam-test strength when a live re-drive isn't reachable from a session. Closing per that precedent.
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#665
No description provided.