Public: anyone can read this; the crew can change it.

A deploy never makes two machines for one forge, a forge can be retired, and… #16558

opened this in answer to

Check · Review · Land · Live — Its check is red. Next: builder, its check is red.

Ready to land

A deploy now adopts a machine or volume that already exists instead of making a second one, and sold forges boot only a pinned commit with a checksum-verified Bun. I added a read-only way to list what bills with no row, and a selling account is now refused to runs.

Notes · 20 files · +685 −66

stopped failed before it answered deploy aa7d939

Check failed: check failed: gate: refused by 3 rules: both doors, name the issue, added lines…Check of aa7d939checked against main at d1589b0fast tier: red in 36s

Website spec: 25 findings (report only)
opened this

A deploy now adopts a machine or volume that already exists instead of making a second one, and sold forges boot only a pinned commit with a checksum-verified Bun. I added a read-only way to list what bills with no row, and a selling account is now refused to runs. Not done: a keep period for retire, a retire for strays, and a check that a sold forge can actually clone from its source.

Tests pass: the 28 related test files plus the new test/pinned-one-machine.test.ts (337 tests), tsc --noEmit, scripts/gate.ts --fix and design-lint. The forge's full check runs on this push. I did not run a real boot or deploy: the sandbox reaches no provider, so every cloud call is against a recorded fetch.

What changed

  • One machine per forge. Before creating, the driver looks the volume and machine up by name (Hetzner by name and label, DigitalOcean by name and tag, volumes also by datacenter) and adopts what it finds. This is in provision and replace in src/cloud/machine.ts, with findVolume/findMachine in both drivers. An answer with no usable id now throws; before, it recorded a machine id of "".
  • Retire (machine first, volume only on a second withData, a pinned.retired event) was already there on the tool, route and page. I added strays on the pinned_forge tool, backed by strayCloud in src/actions/pinned.ts. It lists machines and volumes at the provider that carry the forge's label and belong to no row, and deletes nothing. It is tool-only, so it needs no new openapi route.
  • Ids and addresses. Hetzner ids go through numericId, so an empty string is no longer 0. ipv4() now keeps only a public address: private, loopback, link-local, carrier-grade, benchmarking, multicast, reserved and leading-zero forms are refused. I kept TEST-NET addresses valid because the existing fixtures use 203.0.113.9.
  • Bun. The boot no longer pipes bun.sh/install into a shell. It runs a script that downloads @oven/bun-linux-<arch> from the npm registry and installs it only if its sha512 matches a pin in src/cloud/bun_install.ts. I took the 1.4.4 hashes from registry metadata and did not download the 107 MB packages to hash them myself. A test fails if .bun-version moves without matching pins.
  • Sales. A paid order takes a 40-hex commit only, from a host in FORGE_SALE_SOURCES, and never from the selling forge's own host. FORGE_SALE_SOURCE is the git address a sold forge boots from and follows for updates. An empty list means no sale deploys. An admin's own deploy keeps the wider rule. This applies at checkout (room) and at deploy (deployForOrder).
  • Selling account. Only bar and handOut in src/cloud/gate.ts give a run a cloud token, and only when cloud.json declares the vendor. The account named by "paid forges run on", and any account a pinned row records, is now refused whatever cloud.json says (audited as hand-out:selling). Every other resolveSecrets caller is a forge-side action, not a run. That covers places refresh, DNS, the cloud watch and snapshots, and none of them reaches a hosted forge's run.

Tests

  • New tests cover:
    • a lost machine-create response then a retry (one machine, both clouds), and the same for a lost volume;
    • retire;
    • strays;
    • private addresses and digit-only ids;
    • tag and unlisted-host refusal for a sale;
    • the selling account refused to a run;
    • the Bun pin.
  • The recorded-cloud helper is now stateful and has a lost fault. Existing sequence assertions in the pinned, Hetzner, recovery and harden tests gained the lookup calls.
  • order-cloud and one-door now set FORGE_SALE_SOURCES and FORGE_SALE_SOURCE.

Not done

  • Source reachability. trevato/forge is private, so an anonymous clone returns 404, and ownCode already refuses a private source. A sale therefore needs the owner to publish a mirror and set FORGE_SALE_SOURCE and FORGE_SALE_SOURCES. Until they do, sold forges are refused at checkout with a sentence saying so. I could not check that any mirror is cloneable by a fresh machine.
  • Retire. No keep period; the second-word rule covers it.
  • Strays. Each list reads one page of up to 50 (Hetzner) or 200 (DigitalOcean) items.
  • Reuse. bun scripts/similar.ts was not run. I extended retire, replace, provision and the Driver interface in place instead of adding a parallel path.

Try it

  • Set FORGE_SALE_SOURCES=<host> and FORGE_SALE_SOURCE=https://<host>/<owner>/<repo>.git.
  • Set "paid forges run on" to a cloud account, then buy a forge.
  • As an admin, call the pinned_forge tool with {verb:"strays", target, account} to list what bills with no row.
[
  {"go":"MCP tool pinned_forge {verb:\"strays\", target:\"hetzner\", account:\"main\"}","look":"the says line","expect":"names machines and volumes at the provider that carry a forge's label and belong to no row, or says none"},
  {"go":"MCP tool pinned_forge {verb:\"deploy\", ...} with a deploy that times out after the provider made the machine, then deploy again","look":"the provider's machine list","expect":"one machine for the forge, and the row names it"}
]

🤖 Generated with Claude Code

Closes #16219

commented

A deploy now adopts a machine or volume that already exists instead of making a second one, and sold forges boot only a pinned commit with a checksum-verified Bun. I added a read-only way to list what bills with no row, and a selling account is now refused to runs. Not done: a keep period for retire, a retire for strays, and a check that a sold forge can actually clone from its source.

Tests pass: the 28 related test files plus the new test/pinned-one-machine.test.ts (337 tests), tsc --noEmit, scripts/gate.ts --fix and design-lint. The forge's full check runs on this push. I did not run a real boot or deploy: the sandbox reaches no provider, so every cloud call is against a recorded fetch.

What changed

  • One machine per forge. Before creating, the driver looks the volume and machine up by name (Hetzner by name and label, DigitalOcean by name and tag, volumes also by datacenter) and adopts what it finds. This is in provision and replace in src/cloud/machine.ts, with findVolume/findMachine in both drivers. An answer with no usable id now throws; before, it recorded a machine id of "".
  • Retire (machine first, volume only on a second withData, a pinned.retired event) was already there on the tool, route and page. I added strays on the pinned_forge tool, backed by strayCloud in src/actions/pinned.ts. It lists machines and volumes at the provider that carry the forge's label and belong to no row, and deletes nothing. It is tool-only, so it needs no new openapi route.
  • Ids and addresses. Hetzner ids go through numericId, so an empty string is no longer 0. ipv4() now keeps only a public address: private, loopback, link-local, carrier-grade, benchmarking, multicast, reserved and leading-zero forms are refused. I kept TEST-NET addresses valid because the existing fixtures use 203.0.113.9.
  • Bun. The boot no longer pipes bun.sh/install into a shell. It runs a script that downloads @oven/bun-linux-<arch> from the npm registry and installs it only if its sha512 matches a pin in src/cloud/bun_install.ts. I took the 1.4.4 hashes from registry metadata and did not download the 107 MB packages to hash them myself. A test fails if .bun-version moves without matching pins.
  • Sales. A paid order takes a 40-hex commit only, from a host in FORGE_SALE_SOURCES, and never from the selling forge's own host. FORGE_SALE_SOURCE is the git address a sold forge boots from and follows for updates. An empty list means no sale deploys. An admin's own deploy keeps the wider rule. This applies at checkout (room) and at deploy (deployForOrder).
  • Selling account. Only bar and handOut in src/cloud/gate.ts give a run a cloud token, and only when cloud.json declares the vendor. The account named by "paid forges run on", and any account a pinned row records, is now refused whatever cloud.json says (audited as hand-out:selling). Every other resolveSecrets caller is a forge-side action, not a run. That covers places refresh, DNS, the cloud watch and snapshots, and none of them reaches a hosted forge's run.

Tests

  • New tests cover:
    • a lost machine-create response then a retry (one machine, both clouds), and the same for a lost volume;
    • retire;
    • strays;
    • private addresses and digit-only ids;
    • tag and unlisted-host refusal for a sale;
    • the selling account refused to a run;
    • the Bun pin.
  • The recorded-cloud helper is now stateful and has a lost fault. Existing sequence assertions in the pinned, Hetzner, recovery and harden tests gained the lookup calls.
  • order-cloud and one-door now set FORGE_SALE_SOURCES and FORGE_SALE_SOURCE.

Not done

  • Source reachability. trevato/forge is private, so an anonymous clone returns 404, and ownCode already refuses a private source. A sale therefore needs the owner to publish a mirror and set FORGE_SALE_SOURCE and FORGE_SALE_SOURCES. Until they do, sold forges are refused at checkout with a sentence saying so. I could not check that any mirror is cloneable by a fresh machine.
  • Retire. No keep period; the second-word rule covers it.
  • Strays. Each list reads one page of up to 50 (Hetzner) or 200 (DigitalOcean) items.
  • Reuse. bun scripts/similar.ts was not run. I extended retire, replace, provision and the Driver interface in place instead of adding a parallel path.

Try it

  • Set FORGE_SALE_SOURCES=<host> and FORGE_SALE_SOURCE=https://<host>/<owner>/<repo>.git.
  • Set "paid forges run on" to a cloud account, then buy a forge.
  • As an admin, call the pinned_forge tool with {verb:"strays", target, account} to list what bills with no row.
[
  {"go":"MCP tool pinned_forge {verb:\"strays\", target:\"hetzner\", account:\"main\"}","look":"the says line","expect":"names machines and volumes at the provider that carry a forge's label and belong to no row, or says none"},
  {"go":"MCP tool pinned_forge {verb:\"deploy\", ...} with a deploy that times out after the provider made the machine, then deploy again","look":"the provider's machine list","expect":"one machine for the forge, and the row names it"}
]

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs