Acceptance 0007: bidder-side VM termination (ops)
Proves a bidder operator can end a VM whose requester cannot release it (tab or app
gone, cascade gap, stray debug VM) and that the delete leaves nothing behind: the
contract is released, vm.terminated is pinned in the bidder repo, and every atirc
token leased to the contract dies.
- Procedure: bidder.md, End a VM
- Used on prod: R2 orphan (hat-7, 2026-10-30), iOS cross-restart retry VM (hat-7, 2026-10-31 02:07Z), stray debug VM (hat-7, 2026-10-31 18:11Z)
- Last pass: 2026-11-12 21:56-22:01Z (kcp e190a3b1, release 66f3bd4d, rollout 19; CLI requester with no bidders list,
winner hat-8
swc-bidder): alice (QR; consent page qr.fedfork.com for @aliceoa.bsky.social)run request --hold, Held 21:59:40Z;kb deleteoffc-lpfuqerea3de-8c5c62ad(DID prefix + created 21:58:43Z) 22:00:16.634Z -> gone in 1.4 s; bidder journal: termination StateSync 22:00:16.703Z,Running -> Releasing,released22:00:17.854Z,released: the backend is gone and the finalizer is dropped22:00:17.925Z (the holding CLI was still up: no submit WARN);vm.terminatedpinned (termination-payload-ba7bdc172f501a0786f7acac21396e45, cidbafyreibdqzdkpvh2jczmb2jtonc6prex5g5aujgrhrvauvq4u3z6lcxxf4,deleted_on_request, norequestref); the holding CLI itself went Released "the bidder ended the contract: deleted_on_request" at 22:00:17Z,requester_contract_records_deleted4/4, accept and rfp RecordNotFound x3, nothing of the contract left in alice's repo; hosts 0 ComputeVM / 0 firecracker /vms/empty. No atirc token exists for such a contract (token check n/a) - Previous pass: 2026-11-11 12:45-12:48Z (kcp e496cbff, release d9438c15, ident.link; CLI requester with no bidders list, the
winner was hat-8
swc-bidder): bob (pdsAccount)run request --hold, Held 12:47:13Z;kb deleteoffc-ocnuqjlzgohy-5ecb1d26-> gone in 4.1 s; bidder journal: termination StateSync 12:47:23.041Z, WARNsubmitting the market event to the requester failed(the CLI had exited),released12:47:26.850Z,released: the backend is gone and the finalizer is dropped12:47:26.909Z;vm.terminatedpinned (termination-payload-dae982a43e6a8e7ddd61f7c184f3e8c1, cidbafyreicq6udf5vhetwxcvfyn4h6ilzknvslmaeturf5fkabbgz4nuzb64y,deleted_on_request, norequestref); requesterrelease-> Released "the bidder ended the contract: deleted_on_request",requester_contract_records_deleted4/4, accept and rfp RecordNotFound x3; hosts 0 ComputeVM / 0 firecracker. No atirc token exists for such a contract (token check n/a) - Last expiry pass: 2026-11-12 22:09-22:23Z (same release, hat-8 won): alice
run request --hold --expires-in 3m(QR, same consent page); walk of alice roots [alice], noexpiresAt;bidder_lifetime_capped22:11:56.98Z (expiresAt 22:12:57Z, sourcecompute.vm expiresAt), Held 22:13:08Z;bidder_association_expired_release22:22:57.006Z, released 22:22:58.281Z, finalizer 22:22:58.347Z;vm.terminatedpinned (termination-payload-0f6c3f9e19d47e9cacf22705ad0f1272, cidbafyreig2ab5p6ywrlt3ii4ixehfce22vqaz2vlt6pcwx4wxoy7qvk2sgue,expired, norequestref); the holding CLI went Released "the bidder ended the contract: expired", records 4/4 deleted, accept and rfp RecordNotFound x3; hosts empty. A first try (22:00:58Z) failedno bids received within 30s: the QR url came 2+ min late, sign-in at 22:08:49Z was past the 3 mexpiresAt, every bidderbidder_payload_invalid(pitfalls); its 3/3 records deleted - Previous expiry pass: 2026-11-11 12:48-13:02Z (same release, hat-8 won): bob
run request --hold --expires-in 3m; walk of bob roots [bob], noexpiresAt;bidder_lifetime_capped12:48:59Z (expiresAt 12:51:23Z, sourcecompute.vm expiresAt);bidder_association_expired_release13:01:23.006Z, released 13:01:24.055Z;vm.terminatedpinned (termination-payload-2e7931213cd951bfa81d1fcea1906bed, cidbafyreiaayfwhrzrokc6ux4idsq5eg3sgaapph6nes34ytsootligd4nlui,expired, norequestref); requesterrelease-> Released "the bidder ended the contract: expired"; accept and rfp RecordNotFound x3; hosts empty - Earlier pass: 2026-11-10 15:14Z (hat-7, rollout 5 438ca0fa): bob's held contract, delete -> gone in ~1 s,
vm.terminatedpinned (termination-payload-19e3b1b5db974dc15cff4d61429bbeb2,deleted_on_request, norequestref), requesterrelease-> Released "the bidder ended the contract: deleted_on_request" - Earlier expiry pass: 2026-11-11 01:17Z (hat-9, rollout 10 253031e2, binary 233343a9): bob
run request --hold --expires-in 3m,bidder_lifetime_capped(compute.vm expiresAt 01:07:32Z),bidder_association_expired_release01:17:32Z, released in 1 s,vm.terminatedpinned (termination-payload-8719af6146077f7514b9d08be02b4c4e, cidbafyreiht6bbyzcvfy4jfakpzqrkdp6tn7os6mi6cetmlq44eefmqwidjoi,expired, norequestref), requesterrelease-> Released "the bidder ended the contract: expired"; the contract's records gone from bob's repo; hosts 0 firecracker
sequenceDiagram
participant Op as operator (bidder host)
participant K as bidder kcp
participant P as bidder repo
participant Rq as requester (maybe gone)
participant A as atirc
Op->>K: delete ComputeVM fc-<did12>-<hash> --wait=false
K->>P: termination StateSync + vm.terminated (reason deleted_on_request)
K->>K: stop VM process, unit, work dir; release contract
K-->>Rq: vm.terminated event (404 = requester gone, fine)
A->>P: lease check sees vm.terminated -> token dead (latched)
K->>K: drop finalizer, ComputeVM gone
Core restart under a Held VM (0007:restart, staging)
A bidder core restarted in place (dev restart <network> <bidder>/core, or upgrade on an installed bidder: no drain) must
leave its Held VM alone. The hostprocess supervisor of the new core adopts the VM's unit when it is Active, logging one
hostprocess_unit_adopted line (hostprocess vm-<ComputeVM name>, unit, pid, invocation, activeSince, state);
the adopted lines with a role (kine-a, front, kcp-a) are the core's own infrastructure units.
Test: tests/compositions/0007 entry restart; staging only (staging in tests/entries.txt: prod's rollout is the same restart). It holds
a VM, reads its FirecrackerVM status.runtime (pid, invocationID, unit, startTicks, startTime) and the guest's boot id,
restarts the winner's core (and reads its HostProcess vm-<name>: status.runtime pid = the unit's MainPID, invocationID,
activeSince = ActiveEnterTimestamp, as the supervisor read them), then asserts:
- the ComputeVM is
Runningevery 2 s from before the restart to 30 s after it (neverLost,Releasing, deleted) - the VM's runtime (FirecrackerVM and HostProcess: pid, invocationID, unit, startTicks, startTime, activeSince) is unchanged, the guest's boot id is unchanged and ssh answers
- the new core's log has exactly one
hostprocess_unit_adoptedline forvm-<name>whose pid and invocation are the unit's (HostProcess runtime) before the restart, state active, activeSince the unit's, to the second - none of the VM's
placed,stopped,shutdown,work dir and API socket removed,the process wait saw the VMM exit,a released bid is marked terminatedlines after the restart - the restart happened: a new
core holds the instanceline (a dev network's core), or at least 3 newadoptedinfra lines - no
vm.terminatedfor the receipt; the contract never leaves Held; the release leaves no record
Secrets: one channel by comms mode, one path rule (0007:run, 0007:webrtc, 0007:restart)
The entries rent with --secrets (steps::secrets_bundle: under /root/swc-test-secrets/ a string, an object, a
mode 0644 and a mode 0400; and /etc/swc-test-secret) and read the guest's files over ssh: the string, the
object's compact JSON text {"k":"v","n":1}, modes 700 600 600 644 400 600 (the made directory 0700), /etc still
755 root:root. The contract's own status is read from the invocation's kcp (test host request.contract: the
ComputeContract contract).
0007:run(comms mode Both, an inbound endpoint,--secrets-fallback Sealed):- the requester's log has
requester_guest_secrets_fetchedwithchannelirohorwebrtcwithin 60 s of Held, and the contract says the same:status.secretsFetchedViathat channel, condition SecretsApplied reasonGetSecretsIrohorGetSecretsWebRTC(within 30 s of the line) - a symlink at a secret's path, then a refetch: the file replaces the link, the link's target is untouched
- the guest asks for a sealed bundle as a Firehose guest would (the marker, no ready file, an agent restart);
from the moment that ssh goes out the requester logs
requester_guest_secrets_not_sealedwithin 2 min, neverrequester_guest_secrets_sealedor a publishedguest.secrets; its records of the contract hold noguest.secrets, and nomarket.eventof its repo created since the run started (every listRecords page, each record read) has this run's receipt with aguest.secretspayload - four more
run requests with refused bundles exit non-zero before any contract, each with its message in the CLI's last lines:..and relative paths, a path ending in a newline, a..ending in a newline (entry 0: the path is not a clean absolute path), a mode ending in a newline (entry 0: the mode is not an octal string of at most 0777)
- the requester's log has
0007:webrtc(comms mode Both): the contract's user_data (runcmd,steps::SECRETS_NO_IROH) dropsirohfrom/etc/socialweb-guest-agent/requester.jsonbefore the guest agent reads it (the request's own runcmd is the base runcmd, andBuildUserDataputs every start of the requester's and the bidder's layers after it, the agent's included: AGENTS.md "Guest user data"), so getSecrets must go over WebRTC:requester_guest_secrets_fetchedchannelwebrtcwithin 2 min of Held,status.secretsFetchedViawebrtcand SecretsAppliedGetSecretsWebRTC, the same files, then the release leaves no record0007:restart(staging,--comms-mode Firehose --secrets-fallback Sealed): within 5 min of Held the requester logsrequester_guest_secretssecretsAppliedviasealed(never a fetch ornot_sealed), the contract has nostatus.secretsFetchedViaand SecretsApplied reasonSealedFallback, the same files, and the requester's records hold aguest.secretsrecord of age armor, gone after the release
Self-update while a guest fetches its binaries (0007:upgrade, staging)
A bidder that upgrades (releasefollow, or upgrade by hand) while a guest it placed has not fetched its binaries yet must
still serve that guest the downloads its user_data names: a request the new core's GuestControlPlane does not pin is
served from what the install keeps, the binary at bin/<sha256>/ and the old asset tree, once the file hashes to the
sha256 asked for. The old binary records nothing, so a guest of any earlier release gets its downloads
(docs/plans/0040-findings.md, "A SELF-UPDATE TOOK AWAY THE BINARY A LIVE GUEST WAS STILL FETCHING" and "ONE LANDING").
Test: tests/compositions/0007 entry upgrade; staging only, exclusive (every bidder changes binary). The from binary is
SWC_UPGRADE_FROM, else SWC_COMPAT_REQUESTER (the previous rc); any earlier release binary will do. The host
call bidder.upgrade {name, binary: from|test, from, stopFirst} (from: the from binary's spec, else that env) puts that one binary at /var/tmp/swc-upgrade-<sha256> on the
bidder's host, checked against its sha256: kept there, else copied from the install's own bin/<sha256>/ (the binary
under test is there: the bidder was installed with it), else fetched by the bidder host itself from its public URL
(sha:, local:, release:: the bucket, 20 min at most), else (a path: binary of a hand run) copied over ssh, which
stops after 30 s when its rate would not finish inside 20 min; then it runs
<state>/bin/current/socialweb-computer upgrade --binary <file> --sha256 <sum> --state-dir <state> as the bidder's account
(docs/ci-debug.md step 5d); the cleanup upgrades every bidder it moved back to the binary under test (with the from spec it
was moved by). Steps and asserts:
- every bidder is upgraded to the from binary (it runs
bin/<from sha256>/) and is ready (bidder_guest_image_ready) run request --guest-tools socialweb-computer --hold --exec -- id; the first new ComputeVM on any bidder: that bidder's core unit is stopped and upgraded to the binary under test at once (it runsbin/<test sha256>/)- the contract is Held,
idreturns 0, the receipt is that bidder's - in the guest, once
setup-guest-binaries.serviceis active or failed (300 s at most):uid=0, the unitactive,/usr/local/bin/socialweb-computerhashes to the from binary's sha256 - the upgraded core's log (read after that): a
pinned_download_servedline forsocialweb-computer-x86_64at the from binary's sha256, every-x86_64download it served at the sha256 the guest installed, at least oneserves a previous binary, nopinned_download_not_pinned - the guest agent the guest installed was served by the upgraded core: from its own pin (a line with no path) or, when
it differs from that pin, from a kept older downloads tree (a path not under
bin/); readingagentFrom - the release leaves no record; every bidder is back on the binary under test, ready, 0 automatic restarts, 0 startup ERROR
A guest's rules follow its bidder through an upgrade (0007:fence, staging)
A guest's nftables bridge table swcguest is loaded by vmexec when the VM boots; a bidder core that adopts a running
guest (a self-update, a rollback, a restart) replaces it with its own rule set in one nf_tables transaction (plan 0040
decision 75; AGENTS.md "A guest's rules follow the running bidder"). The promote it fixes: its requester ran in a guest
booted by the previous rc, which had no decision 54 rule, so WebRTC to a guest of the same host (guest tap to the
host's own address on the target's forwarded port, 31000-31999) was dropped (docs/plans/0040-findings.md, "PROMOTE
93fd8c11 ROOT CAUSE").
Test: tests/compositions/0007 entry fence; staging only (it upgrades a bidder under a running guest), exclusive. The
from binary is the entry's own, release:v0.0.0-rc186 (main 688c2105, the last release without decision 54's rule;
FROM in tests/modules/acc-0007/src/fence.rs, passed as bidder.upgrade's from), not the previous rc: its subject is
the migration from a release without the rule, whatever rc the network follows (no env names it). It ends unmet if that
binary is the binary under test or loads the rule. Host calls: bidder.upgrade (above), bidder.guestNft {name, vm, owner, op} (as
root on the bidder VM, nsenter -n nft in the VMM's network namespace: list the product table; probe a test-only
table bridge swcprobe of two counters with no verdict for UDP from the guest's tap to the host's own IPv4 addresses on
31000-31999, chain sent at priority -301 before swcguest and chain passed at -299 after it; counters; unprobe),
bidder.awaitLog {name, texts, seconds} (the bidder's journal followed until a line holds every text) and
binary.published (the bucket URL of the binary under test: main/ or local/ of the commit its version names). Steps
and asserts, all on the target's first bidder B:
- B is upgraded to the from binary; G (
--hold --guest-tools socialweb-computer --associate guest, allow-bidder-dids B) is Held on B; G'sswcguestholds no accept of 31000-31999 (elseunmet) - the probe is loaded; G fetches the binary under test (its guest tools are the from binary, which cannot pin a bidder; the promote's requester also ran the binary under test in a guest of the previous rc)
- G's guest requester (user r2,
--guest-requester --skip-ssh=false: one invocation, a guest's association serves one) holds T pinned to B with--tunnel ssh:22:webrtc; G's ssh sessioncatof a fifo opens (it must stay open to the end) - from inside G,
run request ssh T --transport webrtc --exec -- uname -a: it fails (ICE: no candidate pair);sent> 0 andpassed0 (G's packets to B's own address on T's forwarded port dropped byswcguest) - B is upgraded to the binary under test with G running; B's journal shows
guest_rules_reloadedfor G's FirecrackerVM withwebrtcUDPPorts31000-31999; G'sswcguestnow holds that accept - the same ssh from inside G exits 0 with
uname -a;passed> 0 (decision 54's rule matched, packet by packet) - B is rolled back to the from binary: G's
swcguestis unchanged (that binary reloads nothing); B is upgraded again:guest_rules_reloadedagain and the table is byte for byte the one of the first reload - the fifo is written: G's ssh session opened before the first upgrade ends cleanly with what was written
- the probe goes, T and G are released, B runs the binary under test
The guest requester's own atirc token mint answers 403 "association not verified" for minutes right after the grant
(0005's note; the requester retries it, the rental does not wait on it): the entry counts those lines
(readings.atirc_mint_403) instead of failing fast on them.
The market endpoint over iroh survives a new ingress instance (0007:ingress, staging)
A bidder's market endpoint over iroh is the Exposure svc-bidder-bidder-iroh, published through the IngressProxy
ingress-iroh (a dumbpipe listener per registration). Any new generation of that IngressProxy, and a rebuild after its
service exited, makes the core's runtime stop the service instance and build a new one with no registration; the
exposure publisher re-registers on the new instance (its fingerprint holds the instance, component.Entry.Attempt) and
the Exposure is Ready only once dumbpipe printed its ticket. Before the fix the publication stayed on the dead instance
and the bidder was deaf over iroh until its core restarted (docs/plans/0040-findings.md, "A BIDDER GOES DEAF OVER IROH
WHEN ITS STORED DUMBPIPE PATH CHANGES").
Test: tests/compositions/0007 entry ingress; staging only (it replaces each bidder's IngressProxy), exclusive. The
trigger is the bidder root's own component override, the one kube write the test host may make on a bidder (its guard:
a patch of the MarketBidder, restored after): spec.components["IngressProxy/ingress-iroh"].settings.ingressProxy .keepaliveMilliseconds (an xrpc-subscription setting the iroh provider never reads). The compose pass rewrites the
IngressProxy spec, the generation changes and the core's runtime (internal/component/runtime.go Reconcile: generation
changed, stop, start) replaces the instance while the core stays up: the path a compose rewrite of
spec.iroh.dumbpipePath takes after a switch between binaries whose pinned dumbpipe differs, without changing the pin.
A core restart (0007:restart) is no such trigger: a new process starts a new publisher with nothing published; an
upgrade (0007:upgrade) is one only when the stored spec differs (the first start of a release on the previous one's
stored path). There is no operator command for one component of an installed bidder (dev restart <component> reads a
dev instance's record) and no kubectl on the staging bidders. Host call bidder.dumbpipe {name} (the dumbpipe children
of the bidder's run bidder process: pid, executable, --host, read from /proc over ssh, no sudo); request.start takes
bidderEndpoints (SOCIALWEB_REQUESTER_BIDDER_ENDPOINTS of that run request). Per bidder, three rounds (keepalive 6000 ms,
6001 ms, then the override as it was), each:
- the MarketBidder patch; then, read every 3 s for at most 180 s: an
ingressproxy_iroh_startedafter the patch, aningressproxy_iroh_dumbpipe_listeningofsvc-bidder-bidder-irohafter the LAST started, and the IngressProxy Ready at its generation (readings.rounds: seconds to heal, lines, generation, address)
then a live dumbpipe child of the core on the address of the last listening line (readings.dumbpipe), and a run
limited to that bidder (--allow-bidder-dids, bidder endpoints iroh only, --exec -- id) exits 0 (its submitRfp
over iroh reached the bidder and was answered) and leaves no record. Any failure while an override is applied (a round
that does not heal, the deadline, a failed call) puts it back first; a run killed from outside (SIGTERM, on-fail cleanup)
is put back by the test host's end: the kube transport's ledger restores every spec the run patched (kube.cleanup).
Preconditions
- Authority: the owner asked for it, or the VM is matched to a contract you are ending (stray test / orphan). Never an owner-held VM unless the owner says so
- Shell on the bidder host with sudo; announce on atirc:
<nick>: deleting <vm> on <host> out of band (contract <name>) - Know the requester DID and the contract (
kb get computevms ... -o wide, watcher timeline)
Steps
K=$(sudo -n -u swc-bidder sh -c 'ls -t /var/lib/socialweb-computer/swc-bidder/handles/*/kcp/front.json | head -1 | sed s,front.json,admin.kubeconfig,')
kb() { sudo -n -u swc-bidder env HOME=/var/lib/socialweb-computer/swc-bidder KUBECONFIG="$K" kubectl "$@"; }
kb get computevms.socialweb.computer -o custom-columns=NAME:.metadata.name,PHASE:.status.phase,CREATED:.metadata.creationTimestamp
# name = fc-<first 12 chars of requester DID after did:plc:>-<hash>; match DID prefix AND creation time
kb delete computevms.socialweb.computer <name> --wait=false
kb get computevms.socialweb.computer -w # until it is gone
Then pin vm.terminated (getRecord on the bidder repo, see 0008) and ask atirc-dev
to confirm the leased token is dead.
Expected observations
Bidder journal, in order (hat-7 example, 2026-10-31 22:51Z):
| Line | Time |
|---|---|
termination StateSync termination-<hash> | 22:51:38.49 |
Running -> Releasing | |
released | 22:51:39.75 (+1.3 s) |
released: the backend is gone and the finalizer is dropped | 22:51:39.81 |
a released bid is marked terminated | |
vm.terminated record pinned, reason deleted_on_request |
- Requester side:
vm.terminateddelivery may 404 (requester gone): record in the bidder repo still stands; the termination StateSync then endsFailedwiththe ComputeVM is released; the market event is no longer sent: HTTP 404(expected; pin the record, not the StateSync phase) - An operator delete always pins
vm.terminated, also when an earlier inbound requester delete was refused or its StateSync stalled (648384c1); an unsigned inboundvm.deleteis refused at submitEvent with 400 and creates no StateSync - atirc: next use of any token leased on the contract -> 401
lease is not alive, latched (no revival if the record later disappears) - Without an operator delete: a VM whose requester never returns is released by the bidder at its
spec.associationExpiresAt+ 10 min: the compute.vmexpiresAt(CLI--expires-in), else accept + 24 h, or the requester's identlink lifetime (the earliest grantexpiresAton its walk, e.g. an R2's contract-scoped grant) when earlier (bidder_lifetime_cappedat provisioning,sourceidentlink lifetime of <roots>;bidder_association_expired_releaseat the end), and itsvm.terminatedhas reasonexpiredand norequestref. Check the walk the cap came from:socialweb-computer internal association <requester DID> | jq -c '{roots, expiresAt}'. Before this cap (2026-11-10), 8 VMs that the iOS app leaked from killed launches ran on hat-9 until an operator delete.
Pass criteria
- ComputeVM gone within seconds; contract released
vm.terminatedexists in the bidder repo with reasondeleted_on_request- Without an operator delete (expiry):
vm.terminatedwith reasonexpiredand norequestref - Host clean:
kb get computevms,firecrackervms"No resources found",pgrep -c -x firecracker0,sudo ls -A <handle>/vms | wc -l0 - Leased tokens dead (atirc-dev check, or a probe with the token gets 401)
- Unleased (plain) tokens of the contract revoked manually (atirc-dev, by subhandle)
Cleanup
- Post the timeline and the pinned record on atirc (split lines < 300 chars)
- Note the root cause of the orphan (why the requester did not release) as an open item; out-of-band delete is a mitigation, not the fix
Known pitfalls
| Symptom | Cause / fix |
|---|---|
| deleted the wrong VM | matched by DID prefix only; always match DID prefix + creation time + contract |
vms/ count 0 while a VM runs | dir is 0700; read with sudo |
| token still answers | token was plain (pre-lease or test mint); revoke it by subhandle |
ComputeVM Lost after uninstall --force | expected: forced uninstall does not run the finalizer path; do not use it to end one VM |
| requester resumes later and re-releases | harmless: release is idempotent; the contract is already Released |
--expires-in round fails no bids received within 30s; bidder bidder_payload_invalid (since branch bid-capacity: "a bid failed" reason DeclinedUnservable at submitRfp, bidder_payload_refused kind unservable for an RFP seen over the firehose only) "the RFP payload's expiresAt ... has passed" (2026-11-12) | the CLI fixes expiresAt when the invocation starts, before the QR sign-in; a sign-in later than the duration expires the RFP. Sign in right when the QR url appears (it can take 2+ min) |