rent-fails-clean: broker 400s ssh_pubkey is required before the provision fault fires #668

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

Failure

The rent-fails-clean leg (tests/e2e/journey.rented.spec.ts:210, s4aRentExpectFail) exists to prove the rehearsal fault-injection path: broker does a real Create then a simulated Destroy, returning a 502 with stage provision, so [data-status="rent-error"] should read something matching /provision/i. Instead the callout showed a client-side validation rejection that fired before provisioning ever started:

Locator: locator('[data-status="rent-error"]')
Expected pattern: /provision/i
Received string:  "brokerclient: /v1/gateways/rent: 400 Bad Request: ssh_pubkey is requiredRetry"

artifacts/verdict.json confirms this was the only leg run and the sole red:

"verdict": "red", "firstRedLeg": "rent-fails-clean"

state/founding-state.json shows the draft correctly stayed pinned at S4 ("step": "access", "founded": false) — the "draft untouched" half of the assertion chain, which never got exercised because the /provision/i check failed first.

Root cause (product bug, already fixed at HEAD)

The broker's own request validation rejected the rent call before the rehearsal fault stage could fire, because the client never attached a real SSH pubkey. Pre-528ffae, internal/founding/access.go's RentServer read the operator pubkey from state/own-vps/operator_ed25519.pub — a path nothing in the codebase ever wrote — and silently swallowed the resulting file-read error, leaving req.PubKey == "". internal/brokerclient.Client.Rent then POSTed {"ssh_pubkey": ""}, which the broker correctly 400'd — the broker's own validation working as designed, against a client that never minted the key it claimed to send. DDR 0191 traces this to ADR 0189 ruling 4 wrongly assuming reuse of ADR 0152's own-VPS keypair, which is deliberately ambient-key-only and has no such artifact.

This is fixed in commit 528ffae ("mint the rent-operator SSH keypair; RentServer fails loud on a mint error, and the rented carrier connects over it (DDR 0191)"), which lands after this drive started (verdict.json.startedAt = 2026-08-22T12:54:58Z) and is already present at current HEAD (a2acaec). The fix adds internal/founding.RentPubKey, backed by internal/sshkey.Ensure (the mint-once primitive ADR 0126 uses), wired through rentOperatorKeyAdapter in app/helper/cmd/helper/wiring_prod.go, and fails loud on a genuine mint error instead of silently sending an empty key.

Layer

Product — internal/founding/access.go + app/helper/cmd/helper/wiring_prod.go (pre-528ffae state). Not harness: s4aRentExpectFail / the wizard fixtures only drive the UI and correctly expect the app's own backend to supply the pubkey — minting was never the harness's job. Not infra: no droplet was ever created (the 400 fires before any Create), so there is no logs/droplet-journal.txt and no meaningful guest-side log in this run to consult, and no "Live droplet" section was supplied for this diagnosis — consistent with the failure happening entirely client-side before a droplet existed. (logs/qemu.log's ANGLE/GLX errors and artifacts/host.json's qemu-system-x86_64 ENOENT are local-Electron/GPU noise from the driving workstation, unrelated to this rented-broker path.)

This is not the known own-VPS-carrier pairing frontier (pairing never flips) noted elsewhere in the ratchet spec/legs skip reasons — that's a different leg. This run's single leg, rent-fails-clean, reds on an unrelated pre-fix bug.

What plugging it needs

Nothing new to build — 528ffae already implements the fix. Action: re-run the drive-rented rehearsal against current HEAD (a2acaec) to confirm rent-fails-clean now reaches the real provision-stage broker fault and goes green. If it still reds after re-driving, that points to a residual gap in the DDR 0191 fix (e.g. internal/sshkey.Ensure not persisting/reading back the minted key correctly) and needs fresh diagnosis — but this specific captured run is fully explained by the pre-fix state.

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` leg (tests/e2e/journey.rented.spec.ts:210, `s4aRentExpectFail`) exists to prove the rehearsal fault-injection path: broker does a real Create then a simulated Destroy, returning a 502 with stage `provision`, so `[data-status="rent-error"]` should read something matching `/provision/i`. Instead the callout showed a client-side validation rejection that fired *before* provisioning ever started: ``` Locator: locator('[data-status="rent-error"]') Expected pattern: /provision/i Received string: "brokerclient: /v1/gateways/rent: 400 Bad Request: ssh_pubkey is requiredRetry" ``` `artifacts/verdict.json` confirms this was the only leg run and the sole red: ``` "verdict": "red", "firstRedLeg": "rent-fails-clean" ``` `state/founding-state.json` shows the draft correctly stayed pinned at S4 (`"step": "access"`, `"founded": false`) — the "draft untouched" half of the assertion chain, which never got exercised because the `/provision/i` check failed first. ## Root cause (product bug, already fixed at HEAD) The broker's own request validation rejected the rent call before the rehearsal fault stage could fire, because the client never attached a real SSH pubkey. Pre-`528ffae`, `internal/founding/access.go`'s `RentServer` read the operator pubkey from `state/own-vps/operator_ed25519.pub` — a path nothing in the codebase ever *wrote* — and silently swallowed the resulting file-read error, leaving `req.PubKey == ""`. `internal/brokerclient.Client.Rent` then POSTed `{"ssh_pubkey": ""}`, which the broker correctly 400'd — the broker's own validation working as designed, against a client that never minted the key it claimed to send. DDR 0191 traces this to ADR 0189 ruling 4 wrongly assuming reuse of ADR 0152's own-VPS keypair, which is deliberately ambient-key-only and has no such artifact. This is fixed in commit `528ffae` ("mint the rent-operator SSH keypair; RentServer fails loud on a mint error, and the rented carrier connects over it (DDR 0191)"), which lands after this drive started (`verdict.json.startedAt` = `2026-08-22T12:54:58Z`) and is already present at current HEAD (`a2acaec`). The fix adds `internal/founding.RentPubKey`, backed by `internal/sshkey.Ensure` (the mint-once primitive ADR 0126 uses), wired through `rentOperatorKeyAdapter` in `app/helper/cmd/helper/wiring_prod.go`, and fails loud on a genuine mint error instead of silently sending an empty key. ## Layer **Product** — `internal/founding/access.go` + `app/helper/cmd/helper/wiring_prod.go` (pre-528ffae state). Not harness: `s4aRentExpectFail` / the wizard fixtures only drive the UI and correctly expect the app's own backend to supply the pubkey — minting was never the harness's job. Not infra: no droplet was ever created (the 400 fires before any Create), so there is no `logs/droplet-journal.txt` and no meaningful guest-side log in this run to consult, and no "Live droplet" section was supplied for this diagnosis — consistent with the failure happening entirely client-side before a droplet existed. (`logs/qemu.log`'s ANGLE/GLX errors and `artifacts/host.json`'s `qemu-system-x86_64 ENOENT` are local-Electron/GPU noise from the driving workstation, unrelated to this rented-broker path.) This is **not** the known own-VPS-carrier pairing frontier (pairing never flips) noted elsewhere in the ratchet spec/legs skip reasons — that's a different leg. This run's single leg, `rent-fails-clean`, reds on an unrelated pre-fix bug. ## What plugging it needs Nothing new to build — `528ffae` already implements the fix. Action: re-run the `drive-rented` rehearsal against current HEAD (`a2acaec`) to confirm `rent-fails-clean` now reaches the real `provision`-stage broker fault and goes green. If it still reds after re-driving, that points to a residual gap in the DDR 0191 fix (e.g. `internal/sshkey.Ensure` not persisting/reading back the minted key correctly) and needs fresh diagnosis — but this specific captured run is fully explained by the pre-fix state. 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

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

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

close-report for #668 — status success

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

envelope
{
  "issue": 668,
  "status": "success",
  "commits": [],
  "changed_files": [],
  "tests": [
    {
      "command": "nix develop .#go-ci --command go test ./internal/founding/... ./internal/fleetwire/... ./app/helper/cmd/helper/...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "rent-fails-clean reaches the real provision-stage broker fault (no pre-provision 400 on empty ssh_pubkey)": "Fixed by 528ffae (#665), present at HEAD a2acaec: internal/founding/access.go RentServer now mints/reads req.PubKey via o.rentPubKey.Ensure(ctx) and fails loud on a mint error instead of POSTing an empty ssh_pubkey; wired in app/helper/cmd/helper/wiring_prod.go via rentOperatorKeyAdapter over internal/sshkey.Ensure (DDR 0191).",
    "draft stays pinned at S4 on a provision fault (no half-rented server)": "Unchanged and preserved: RentServer persists no Access on a broker error, per internal/founding/access_test.go TestStory6_RentFailureLeavesNoHalfRentedServerAndReturnsToS4.",
    "fix proven offline at the seam": "go test green (exit 0) over internal/founding (incl. TestRentServer_FillsBlankPubKeyFromRentPubKeySeam, _CallerSuppliedPubKeyIsNeverOverridden, _RentPubKeyMintFailureFailsLoud), internal/fleetwire, app/helper/cmd/helper."
  },
  "summary": "#668 is a duplicate diagnostic of #665 filed from the same pre-fix drive (20260822T125436Z, started 12:54:58Z); the fix landed in 528ffae before HEAD and is verified present with green seam tests, so no new code is needed.",
  "reason": "The bug is already fixed at HEAD by 528ffae (#665, closed): RentServer mints the operator SSH pubkey and fails loud on error rather than silently sending an empty key, so the broker no longer 400s before its provision fault fires. This ticket's captured drive predates that commit. Verified the fix is present in internal/founding/access.go + wiring_prod.go and that its seam tests pass (exit 0). The live rent-fails-clean re-drive needs a real broker + DigitalOcean and this session-runner class cannot fire the standing rehearsal itself (#577/ADR 0184; a live rented drive is also non-routine DigitalOcean spend, a one-way door under ADR 0174) — the next cron-triggered rented-target drive's rent-fails-clean leg is the live proof, per the #635/#636/#641/#642/#644/#662/#665 precedent for closing on seam-test strength.",
  "blockers": [],
  "no_code_change": "Fix already landed in 528ffae (#665) before this session's HEAD (a2acaec); #668 is a stale re-file from a drive captured pre-fix. Verified the fix is present at the seam and its Go tests pass (exit 0). No new code is warranted; the outstanding live-drive confirmation is the standing rehearsal's job, unreachable from this runner class per ADR 0184."
}
**close-report** for #668 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 668, "status": "success", "commits": [], "changed_files": [], "tests": [ { "command": "nix develop .#go-ci --command go test ./internal/founding/... ./internal/fleetwire/... ./app/helper/cmd/helper/...", "exit_code": 0 } ], "criteria": { "rent-fails-clean reaches the real provision-stage broker fault (no pre-provision 400 on empty ssh_pubkey)": "Fixed by 528ffae (#665), present at HEAD a2acaec: internal/founding/access.go RentServer now mints/reads req.PubKey via o.rentPubKey.Ensure(ctx) and fails loud on a mint error instead of POSTing an empty ssh_pubkey; wired in app/helper/cmd/helper/wiring_prod.go via rentOperatorKeyAdapter over internal/sshkey.Ensure (DDR 0191).", "draft stays pinned at S4 on a provision fault (no half-rented server)": "Unchanged and preserved: RentServer persists no Access on a broker error, per internal/founding/access_test.go TestStory6_RentFailureLeavesNoHalfRentedServerAndReturnsToS4.", "fix proven offline at the seam": "go test green (exit 0) over internal/founding (incl. TestRentServer_FillsBlankPubKeyFromRentPubKeySeam, _CallerSuppliedPubKeyIsNeverOverridden, _RentPubKeyMintFailureFailsLoud), internal/fleetwire, app/helper/cmd/helper." }, "summary": "#668 is a duplicate diagnostic of #665 filed from the same pre-fix drive (20260822T125436Z, started 12:54:58Z); the fix landed in 528ffae before HEAD and is verified present with green seam tests, so no new code is needed.", "reason": "The bug is already fixed at HEAD by 528ffae (#665, closed): RentServer mints the operator SSH pubkey and fails loud on error rather than silently sending an empty key, so the broker no longer 400s before its provision fault fires. This ticket's captured drive predates that commit. Verified the fix is present in internal/founding/access.go + wiring_prod.go and that its seam tests pass (exit 0). The live rent-fails-clean re-drive needs a real broker + DigitalOcean and this session-runner class cannot fire the standing rehearsal itself (#577/ADR 0184; a live rented drive is also non-routine DigitalOcean spend, a one-way door under ADR 0174) — the next cron-triggered rented-target drive's rent-fails-clean leg is the live proof, per the #635/#636/#641/#642/#644/#662/#665 precedent for closing on seam-test strength.", "blockers": [], "no_code_change": "Fix already landed in 528ffae (#665) before this session's HEAD (a2acaec); #668 is a stale re-file from a drive captured pre-fix. Verified the fix is present at the seam and its Go tests pass (exit 0). No new code is warranted; the outstanding live-drive confirmation is the standing rehearsal's job, unreachable from this runner class per ADR 0184." } ``` </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#668
No description provided.