A pinned forge (#8697)

A pinned forge is a forge the owner put on their own cloud. The forge that deployed it gives it no crew and no automatic release: on its machine it runs and updates its own code (see "Its own code"). Its recorded version and config change only through one explicit Update, recorded with who and when; Rollback is one action to the previous version. It is served on its own name over HTTPS, and its first admin is whoever holds the one-time claim link the deploy shows (#16217).

Doors (forge admin, admin-scope token)

A deploy names a cloud account (Settings → Cloud accounts, writes allowed), the app (owner/name), a git source (https), a version (a 40-character commit id or a tag like v1.2.3 — never a branch, so nothing moves under it) and a host: the DNS name the forge is served on. Left empty, source is this forge's own repository at its public address (<FORGE_URL>/<forgeRepo>.git, which must be public) and version the commit this forge runs (FORGE_COMMIT); either refusal says which is missing (ownCode in src/actions/pinned.ts).

Its own code (#16361)

The machine boots the source at the version from /opt/forge, and from then on runs its own repository. Its boot sets FORGE_REPO=forge/forge, FORGE_UPSTREAM (the source), FORGE_COMMIT (the version, when it is a commit), FORGE_RELEASE_KEEPER=swap and FORGE_SELF_SWAP=1; none of them is a setting a deploy may name. At first boot, before any claim, the checkout's history and tags become forge/forge (a reserved organisation with nobody in it yet), its main at the commit the machine runs. That repository is the forge's source, its crew is seated on it, and it follows FORGE_UPSTREAM's main with take-updates (src/spawn/own_forge.ts). A restart finds it and changes nothing.

At the claim the repository moves to the new admin's own account (<admin>/forge, the old path a redirect), and the forge's source names it there. The release keeper swaps in what lands on its main, so a merge there, or an update taken from the forge it was deployed from, updates the forge on its machine. A forge deployed from that one follows it in turn. The boot also installs Claude Code (npm install -g @anthropic-ai/claude-code) for the owner's crew; when that fails the forge starts without it.

An update that conflicts with a change made here opens one issue naming the files, and a builder takes it only when Crew resolves upstream conflicts is on. That is a setting of every repository that follows an address (crew_resolves on repo_upstream), off by default whatever the repository's autonomy, on its Follow upstream card with the words: "When an update from <upstream> and a change made here touch the same lines, the crew merges them for you. Off: the update waits, and an issue names the files for you to decide in the code." On the forks screen an admin presses r to turn it on or off (setCrewResolving in src/actions/upstream_follow.ts).

On /deploy-to, Source and Version are optional; left empty, they are this forge's own code.

Not yet: a launcher on the machine that brings back the last good tree when a swap fails at boot, a release that waits for a green check, and a private source (the machine reads it without a credential).

The name and HTTPS (#16217)

A forge is served at https://<host>/ and nowhere else. host is a full lowercase DNS name you control (forge.example.com): no address, port, wildcard or trailing dot, checked by one pattern (validHost in src/core/pinned.ts) before it is written anywhere, and one forge a name.

The claim (#16217)

A deploy is for one person. Its answer holds a claim link, https://<host>/first-admin#<code>, shown once: on the page, in the HTTP and MCP answer (claim.link, claim.expiresAt), and in the terminal's dialog. Whoever opens it makes the forge's first admin with a passkey; an agent trades the part after # at POST /api/v1/first-admin for a token. It works once, for 7 days (FIRST_ADMIN_SEED_TTL_MS), and never once the forge has an admin. A visitor without it gets the refusal any wrong code gets, and a new forge's signup is by invite, so nobody else gets an account there first.

Why it cannot move on its own

pinned_forge.version and .config are guarded by a SQLite trigger (migration 20261103090000-pinned-forge): an UPDATE passes only with a change_id that points at a newer update or rollback row in pinned_change whose target is exactly the new version and config. pinned_change cannot be updated or deleted. crew and auto_release are CHECKed to 0. test/pinned-forge.test.ts tries each other way and fails if one works. A pinned forge is a row and a droplet, not a repository on this forge, so the crew, the release keeper and upstream following have nothing of it to touch.

Credentials

The cloud token stays sealed. It is opened for the one call that needs it (a secret.read event names the run), sent as an Authorization header over HTTPS, and never reaches argv, a row, an event, a request body or the boot script. The boot script holds no secret: of the claim it carries the sha256 alone (see The claim). Config refuses names that look like secrets.

What the booted machine is (#16218)

A pinned forge runs on a public address, so its machine is set up for that (src/cloud/harden.ts; test/pinned-harden.test.ts).

What only a real boot proves

On a new machine (reach it through the provider's console, since SSH is closed): ufw status verbose lists only 80 and 443; systemctl show forge -p User says forge and ps -o user= -C bun too; sshd -T | grep -Ei 'passwordauthentication|permitrootlogin' says no; apt-config dump | grep Unattended-Upgrade:: and systemctl status apt-daily-upgrade.timer; journalctl -t forge-boot says sandbox ready; systemd-run --wait --pty -p User=forge -p NoNewPrivileges=yes -p ProtectSystem=strict -p PrivateTmp=yes bwrap --unshare-user --ro-bind / / -- /bin/true exits 0 (the one that proves NoNewPrivileges and bubblewrap agree); the same with every directive of the unit and a sandbox that mounts its own /proc, systemd-run --wait --pty -p User=forge -p NoNewPrivileges=yes -p ProtectSystem=strict -p ProtectHome=yes -p PrivateTmp=yes -p ProtectKernelModules=yes -p ProtectClock=yes -p RestrictSUIDSGID=yes bwrap --unshare-user --unshare-pid --ro-bind / / --proc /proc --dev /dev -- /bin/true, exits 0 (the unit hides no part of /proc, which is why it has no ProtectKernelLogs); stat -c %A /usr/bin/bwrap is not setuid; journalctl -u forge shows no read-only-file-system error from the checkout; systemctl is-active caddy says active and ss -ltnp shows Caddy on 80 and 443 and Bun on 127.0.0.1 alone; cat /etc/caddy/Caddyfile is the forge's own and curl -s http://<address>/ never showed Caddy's welcome page (the claim that dpkg kept the file); stat -c %U <mount>/caddy says caddy after a forge restart; once the DNS record exists, journalctl -u caddy shows the certificate obtained, and after an Update it shows none requested. HTTP/3 is not offered a way in (ufw opens 443/tcp only; browsers fall back). The forge's start walks the whole volume to set ownership, which is slow on a large one. No email from the provider with a root password arrives.

Where it is made: the place (#16205)

A deploy is made at a place from the Places catalog (GET /api/v1/places): provider:datacenter:size, such as digitalocean:sfo2:s-1vcpu-2gb. Every door takes it as place (the API body and MCP tool field, the Place select on /deploy-to, an optional last word of the terminal's d line). Left out, it is the catalog's default for the small plan among the chosen account's provider (the cheapest orderable place in the United States, or the one pinned on Places). The place must exist in the catalog, be orderable and be on the account's provider; otherwise the deploy is refused in a sentence, before any call to a provider. ARM sizes are listed with their reason and are never offered: the machine boots x86 only.

The row records its place (datacenter and size, in pinned_size); the volume and the machine are made in that datacenter, and every replace (Update, Roll back, a new claim link) orders the row's own place, never today's default, because the volume lives there. The ceiling prices that place. A forge deployed before places were kept has none recorded and is read as the place the drivers once hard-coded (DigitalOcean nyc3 s-1vcpu-2gb, Hetzner nbg1).

Pay and go: no DNS work for the buyer (#16205)

An admin names the domain for deployed forges (forges.example.com) on Pinned forges (/pinned; the terminal's b; PATCH /api/v1/admin/settings with {"pinnedDomain": "forges.example.com"}, null to clear; the MCP tool's domain verb). It is a forge setting (settings/pinned_domain.ts, pinned.base_domain, every change kept with who and when). With one set, a deploy needs no hostname: the forge is served on <name>.<domain>; a full hostname may still be given (the terminal's - takes the default).

With a Cloudflare cloud account attached and writes allowed, the forge then writes the record itself: after the machine has an address (the deploy, and every Update, Roll back and new claim link), and again on Check, it upserts <host> A <address> in the zone that holds the name, through the first such account whose token can edit that zone: found by name and updated, or made, so a replaced machine's new address changes the record and never adds one; DNS only (not proxied, so the machine gets its own certificate), TTL 60. The calls go to api.cloudflare.com only (upsertARecord, src/cloud/providers.ts), the token in the Authorization header alone, each call audited as pinned:dns like the other cloud calls; the record's id and zone are kept (pinned_dns) with the account that wrote it. A zone the token cannot see or edit, a CNAME already at the name, or any refusal leaves the record for a person to make, and the deploy answer and Check say that instead (dnsWrittenBy is empty). The token needs DNS edit on the zone; the cloud account's check cannot tell that, so the first write is the proof.

An admin chooses where paid forges run on Pinned forges (/pinned; the terminal's p; PATCH /api/v1/admin/settings with {"paidPlacement": "digitalocean/main"}, "hosted" or null for the default; GET answers it as paidPlacement). It is a forge setting (settings/paid_placement.ts, paid.placement, every change kept with who and when). hosted, the default, is today's: a bought forge runs inside this one. A cloud account (one a pinned forge can be deployed to, with writes allowed) makes each paid order a pinned forge of its own (src/spawn/cloud_placement.ts). Free forges always stay hosted.

Retiring a forge (#16219)

A test forge, or one whose buyer left, would bill forever without a way out. Retire (POST /api/v1/admin/pinned/:name/retire, the pinned_forge tool's retire verb, Retire on /pinned, x in the terminal) deletes the forge's machine and the DNS record the forge wrote for it (job above), and keeps its data volume: the answer says what keeping it costs a month at list price. The row ends retired, and the account's ceiling counts it at that volume's price alone. The volume is deleted only by the second word: withData on the API and the tool, Retire and delete its data on the page (which asks for the forge's name), and a second choice and the name in the terminal. That call is the data-destroying one under the delete tier (tier: "delete" on the tool, test/delete-tier.test.ts): the forge's own agent is refused it with the page to use. A retired forge can be retired again with its data, and nothing else: Update, Roll back, a new claim link and Check refuse it. It is idempotent: a machine or volume already gone at the cloud (a 404) is done, so asking again finishes a retire whose volume the cloud would not delete (the machine is gone and the forge retired by then, its data kept). A forge its buyer has claimed, as the forge itself says when asked (or as recorded), is refused with the sentence that its data is on that volume, unless despiteClaim says the owner means it (the page's form for a claimed forge carries it; the terminal asks in its question). One event, pinned.retired, says who, whether the data went, and what became of the record.

After the claim: what the host can still do (#16204)

Nobody marks a forge claimed by hand: the deployed forge says so. Check, and every Update, Roll back and request for a new claim link, asks it first; when one hears claimed (The claim, above), the selling forge records it once (pinned_forge.claimed_at, event pinned.claimed). From then it refuses update, rollback and a new claim link for that forge, each with the same sentence (CLAIMED_REFUSAL): updates are the buyer's to take, and no machine of theirs is replaced from here. A forge that cannot be asked is never recorded as claimed, and is not taken as unclaimed either: once its current machine has answered about its claim (pinned_forge.reached), silence from it (a broken DNS record, a forge that is down) refuses Update, Roll back and a new claim link, with a sentence saying the forge could not be reached to confirm nobody claimed it and to run Check until it answers. A forge whose current machine has never answered (still booting, DNS not pointed yet, a first boot that failed) may still be replaced, or it could never be recovered. The question starts with a read of the machine at its cloud: when the cloud refuses that read the change is refused with the cloud's answer, before anything is recorded; a machine that is gone (404) has nobody to ask and is replaced. /pinned (once, when any forge is claimed) and /deploy-to say what the host still can while the machine is in the host's cloud account (HOST_CAN in src/core/pinned.ts): open its console, boot it into rescue, snapshot its disk, read its boot data. It never says "no access". The path that gives the host none is the buyer's own cloud account: deploy there (the account picker on /deploy-to; choosing it at purchase is #16203).

Targets: what runs, what it costs, what is refused

Prices are list prices as last read (USD a month); the owner's own bill is the truth. Source of truth in code: src/cloud/targets.ts.

TargetStatusWhat runsCostRefused / caveat
DigitalOceandeploys todayOne droplet (Ubuntu 24.04) at the forge's place, with a 10 GiB block volume in the same datacenter as FORGE_DATA. An Update deletes the droplet and starts a new one on the same volume, so data is untouched.~$12 + ~$1.20A token cannot be narrowed below "create droplets and volumes".
Hetzner Clouddeploys todayOne server (Ubuntu 24.04) with a 10 GiB volume as FORGE_DATA, at the forge's place. See deploy-to-hetzner.md.the API's list price + the volumeThe token must be read-write; Hetzner offers nothing narrower.
AWSnot writtenEC2 t4g.small + EBS gp3, same boot script; SigV4 already exists for reads.~$12 + ~$0.80 + public IPv4 ~$3.65Wants a role scoped to a tag rather than a long-lived key.
Azurenot writtenB1ms VM + managed disk through a service principal on one resource group.~$15 + ~$1 + public IP ~$3.65Needs a resource group, network and public IP first: three calls more.
CloudflarerefusedWorkers/Durable Objects keep state, but not as files a Bun process opens. Containers run, with a disk wiped on sleep or replace.Workers Paid from $5No volume that survives; the forge refuses rather than lose repositories quietly.
VercelrefusedFunctions and Sandboxes: short-lived, scratch disk.Pro from $20/seatNo long-running process, no persistent disk. Vercel can host an app a forge ships, not the forge.

The cloud facts for Cloudflare and Vercel are from memory of their documentation, last written 2026-11-02; check them before relying on a refusal for a decision beyond this forge.

Prior art

Open-source "Deploy to" buttons (Heroku's app.json, Render's render.yaml, DigitalOcean's App Platform button, Railway templates) are a link carrying a repository and a settings file to a provider's sign-in. That is the shape for the button: a link with app, source, version that lands on the Deploy form after one sign-in. The older deploy/ cloud path and the child-forge path (#4416, #2928, #3785) are the other prior art; neither pins.

Address and health check (#8745)

check (POST /api/v1/admin/pinned/:name/check, MCP pinned_forge verb check, terminal c) reads the machine from its cloud (read-only, no write permission needed) and records its public IPv4 (pinned_forge.address, validated as IPv4). It then asks DNS for the forge's name. Until the name resolves to that address the result is healthy: false, waiting: "dns" with the record to create, and nothing is sent anywhere: the probe only ever goes to the machine this forge made. Once it does, Check probes https://<host>/; no answer yet is waiting: "answer" (the machine is booting, or its certificate is not issued). Every view carries url (https://<host>/) and dns. A forge that answers is set running, so a failed one recovers by itself once its machine is up; one that does not answer keeps its state. A deploy and a new claim read the address once, so their answer can name the record; a cloud that has not assigned one yet leaves it to check.

One at a time

Every create (a deploy, and the machine an Update, Roll back or new claim link makes) is held to its cloud account's ceiling (src/cloud/ceiling.ts, set on /settings/cloud). A forge is priced from the one catalog of places (src/cloud/places.ts, GET /api/v1/places): what the provider's own API last said its size costs at the place its row records, with its volume and address, converted at the day's rate and rounded up. The forge reads the catalog again before a create when it is stale or was never read; a size it still has no price for is refused, never counted as free. Creates on one account run one after the other from the ceiling check until the machine is recorded, so two asked together cannot both fit where one does. Changes to one forge run one after the other too: two new claim links asked together make two replacements in turn, never two machines at once, and the second link is the one that works.

Failing half-way

Each id is recorded the moment it exists. A first deploy that fails before a droplet exists leaves a failed row with the volume's id; deploying the same name again reuses that volume. An Update deletes the old droplet and clears its id at once; a 404 on that delete counts as deleted, so after a failed create a Rollback or another Update goes straight to creating. A failed forge may be told the version it already has, to finish the replacement. The droplet installs the Bun in BUN_VERSION (src/cloud/droplet.ts), so the runtime moves only when a pull moves it.

Not done

Canary (#8746)

The driver is tested against a fake API only. scripts/pinned-canary.ts runs one real Deploy, Update and Rollback through the admin API, times each, and fails past 10 minutes or when a version or state is not the asked one:

FORGE_TOKEN=<admin token> bun scripts/pinned-canary.ts https://your.forge --account <do account, writes allowed> --host <a name you control> \
  --app owner/name --source https://… --version <commit> --next <second commit or tag>

The name defaults to canary-<date>-<time>, so a second run the same day does not collide. Versions and source are checked before any paid call, and on failure the script prints the droplet and volume ids it recorded. It leaves a droplet and a volume (~$13 a month) the driver cannot delete; remove them in the DigitalOcean console. test/pinned-canary.test.ts covers the script against a fake forge.

Canary results

Not run yet. It needs a DigitalOcean token an owner has put in Settings → Cloud accounts; none was available to the agent that wrote the script. Paste the table the script prints here, with the date, and close #8746.

This is an operator script, not a feature: it has no screen in src/tui/ and no MCP verb because it drives the doors that exist (the HTTP admin API, the same actions the terminal and pinned_forge use); a second door to a one-off paid test would be one more thing to keep honest. It is small, touches no src/, and was written so the owner's run is one command; it does not displace the pipeline list. The pull refers to #8746 and does not close it: the issue closes when the table above is real.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs