~ knotless Search/
↑↓ move↵ open⇧↵ all results

socialweb.computer/socialweb-computer-kcp

socialweb.computer: a compute market on atproto (kcp)

1 collaborator
0
0

promote: no guest requester expected; prepare creates r2 and refuses an associating binding

Merged johnandersen777.bsky.social asked to merge into main from socialweb.computer/socialweb-computer-kcp:phase-2
.knotless/workflows/promote.yml+4−2
@@ -4,7 +4,9 @@
# comes back then). After `release` (`after: [release]`: filed without running when release failed or was cancelled; it
# does not wait for `test`, and `test` does not cancel it: `superseded` is only about a newer commit's run), on the `release`
# executor binding (only main's names socialweb-computer-release, whose
# release-workload module holds the socialweb.computer session with the software.release.* scopes): its one step is
# release-workload module holds the socialweb.computer session with the software.release.* scopes; the binding asks for
# no guest requester: the gate signs in as bob and alice, and `promote.sh prepare` exits 1 on a VM that has one and makes
# the gate's unix user r2): its one step is
# `release <command>`: the module writes the rc's manifest and version and moves channel rc, runs the command on the VM
# (scripts/promote.sh: the prod target, the droplets, the rc operators' heartbeats, the prod gate: every `both` entry of
# tests/entries.txt as prod bob and alice, then the wait for this commit's `test` check: exit 0 only when test is green
@@ -51,4 +53,4 @@ stop_timeout: 30
steps:
- name: release
timeout: 240
run: release bash scripts/ci-test.sh host && bash scripts/ci-test.sh binary && bash scripts/promote.sh
run: release bash scripts/promote.sh prepare && bash scripts/ci-test.sh host && bash scripts/ci-test.sh binary && bash scripts/promote.sh
docs/plans/0040-findings.md+40−0
@@ -1391,3 +1391,43 @@ Each: what was seen (with the log), the cause, the fix, its proof.
binding asks for an association and the gate now runs as bob and alice, so no guest requester ever reports (agent
on it, branch `promote-assoc`). A killed promote does not roll back while the `step-12` module is unpublished: rc
stays rc180 and prod runs 7a0406d9's build. Owner (AskUserQuestion): "Leave prod on rc180".
- The runner stopped promote mid-gate: no guest requester on the release VM (branch `promote-assoc`, off main 79621be6).
SEEN: promote at main 7a0406d990dc (check filed 16:57:38Z; hat-8 `~/.tmp/ci-main/promote-7a0406d9.log`): inputs
`{"mem":8,"cpus":4,"image":{...},"association":true}` (line 4), `==> associating the guest requester beside the
steps` right after the rent (line 11), rc180 on channel rc 16:58:53Z, the droplets deployed (caddy ts 17:01:26Z), the
four rc operators heartbeating the build, `gate: target kind prod: 30 entries`, `RESULT 0001:run FAIL 1200` and
`RESULT 0004:run PASS 319` (0004 started 17:21:31Z, its run dir's ms), then `the guest requester was not associated:
computer.socialweb.vm.associate: the guest reported no requester DID (gave up)`, `==> stopped: ...`, `==> killed
after 14400s` (a misleading line: the step had no exit code, knotless `crates/knotless-run/src/lib.rs:387` prints the
limit), `stop` `release-rollback: not found` (exit 127, the unpublished step-12 module, above); the log ends 17:32:27Z.
Nothing rolled back: channel rc still names rc180 (`software.release.channel/socialweb-computer:rc`, read 2026-11-18).
CAUSE: the binding `com.fedfork.exec.binding/release` of socialweb.computer (only promote uses it; kcp-build and
kcp-small have no `association`, kcp-test has it) still asks for the guest requester. The runner (deployed fork
62c08d7b, `composition.rs:531` reads `association`; `:700-723` starts `computer.socialweb.vm.associate` beside the steps
with `poll_ms` 10000, `max_polls` 200; `:915-930` a failed association stops the running step) gave up 2000 s after
the rent (~16:58:50Z + 2000 s = ~17:32:10Z) because nothing on the VM reports an R2 DID: since main abf580f1 (step 11)
the gate runs as bob and alice (`./gate.sh <target> --account bob,alice`, their creds files from
`ci-prod-target.sh`; `tests/targets/prod.json` has no `guestRequester` and no `identity` account, `roles` are alice,
bob, john), where before (85c689be) it ran `GATE_ACCOUNTS=r2` with `accounts.r2 guestRequester: true` and started
R2 itself. No `both` entry needs a guest requester on the release VM (the test host takes R2 only for an account
with `guestRequester` or an associated `identity`: `tests/host/src/swc.rs:433-470`, `more.rs:183`). The
association was also what made the unix user r2 the gate runs as: the requester repo's user-data module
(`association()`: `useradd -m -s /bin/bash -G socialweb-r2 r2`, `socialweb-r2.service`); release-workload signs in
with its own `release` session and reads no association.
FIX (the design: promote runs nothing as R2, so its binding asks for none): drop `association` from that binding
(the command: docs/ci-debug.md "The release binding"; not run here, no repo-documented write of a binding; left to
the lead, the record saved in `~/.tmp/promote-assoc/binding-release-before.json`, CID
bafyreih2dx77wwhc4i2g3wwiwyymxc4ljxjevcxy4obzwgwap3jyjdka5i). `scripts/promote.sh prepare`, promote.yml's first
command, exits 1 at once on a VM with the association cloud-init (`/etc/systemd/system/socialweb-r2.service`, the
same check in every mode, `--dry-run` too), naming the binding, so a binding that asks again fails at the start, not
34 min in; then it makes the unix user r2 (root only); `promote-rehearse.sh` uses it. Not chosen: starting R2 on the
release VM, which nothing the prod gate runs would use.
Also seen: `tools.sh: chrome lacks libXcomposite.so.1 ...: apt as root` and the apt run on every promote (the release
image lacks Chrome's libraries); the log has no time per line, so its share is unmeasured: the whole stretch from the
rc move (16:58:53Z) through ci-test.sh host and binary, the target, the apt and the droplet deploy (17:01:26Z) took
2 min 33 s. Left as is.
PROOF: `promote.sh --dry-run` and `promote.sh prepare` with an empty HOME on hat-8 (below, in the commit). Unproven:
a promote with the binding rewritten (needs the lead's write, then an asked promote).
- The `release` binding rewritten 17:42Z (lead, as socialweb.computer, putRecord with swapRecord): `inputs.association`
removed; before: cid bafyreih2dx77ww... saved at ~/.tmp/release-binding/before.json; after: cid bafyreic7gfekuj...,
inputs {cpus, image, mem}. With it `promote.sh prepare` creates the user r2 itself.
docs/ci-debug.md+28−1
@@ -233,7 +233,8 @@ only when `tests/target/release/swc-test-host` is there):
CI_HOME=$HOME/.tmp/promote-dry RELEASE_URL=$RU RELEASE_SHA256=$RS bash scripts/promote.sh --dry-run
```
The real promote's gate is the hat-8 gate's command below, as r2 on the release VM, on the target
The real promote's gate is the hat-8 gate's command below, as the unix user r2 on the release VM (`promote.sh prepare`
makes it; no guest requester runs there), on the target
`scripts/ci-prod-target.sh` writes from the secrets `.knotless/workflows/promote.yml` lists. Open (plan 0040 step 11):
the release VM does not reach the bidder hosts (`ssh hat-N`: each bidder's kcp and its host's journal), so the entries
that read them fail there until the owner decides how.
@@ -262,6 +263,32 @@ cargo wasm -p release-workload -p cicd-workload -p process-mcp && node --test mo
Debug a rolled-back promote from its `gate-runs` artifact and its log; nothing is held.
### The release binding
socialweb.computer's `com.fedfork.exec.binding/release` (only promote uses it) asks for no guest requester: its inputs
are `{mem, cpus, image}`, no `association`. The prod gate signs in as bob and alice from their creds files
(`ci-prod-target.sh`); nothing on the release VM runs as R2. With `association: true` the runner associates a guest
requester beside the step (knotless `crates/knotless-run/src/composition.rs`, `computer.socialweb.vm.associate`, 200
polls of 10 s from the rent) and, when that gives up, stops the step mid-gate (`==> stopped: the guest requester was
not associated: ... (gave up)`, then a misleading `==> killed after 14400s`). `promote.sh prepare`, promote's first
command, exits 1 at once on such a VM (it has the association cloud-init's `/etc/systemd/system/socialweb-r2.service`).
Read it (public), and drop `association` as the account (its creds file `~/.socialweb_computer_source`, as
`publish-chain.sh` in the requester repo uses it; a swapped write, the record read first is the undo):
```sh
D=did:plc:gmlkrhimoueejcertevr4hl3 P=https://brittlegill.us-west.host.bsky.network
mkdir -p ~/.tmp/release-binding
curl -fsS "$P/xrpc/com.atproto.repo.getRecord?repo=$D&collection=com.fedfork.exec.binding&rkey=release" > ~/.tmp/release-binding/before.json
jq -c .value.inputs ~/.tmp/release-binding/before.json
tok=$( (set -a; . ~/.socialweb_computer_source; jq -n --arg i "$D" '{identifier: $i, password: env.SOCIALWEB_COMPUTER_ATPROTO_PASSWORD}') |
curl -fsS -H 'content-type: application/json' -d @- "$P/xrpc/com.atproto.server.createSession" | jq -r .accessJwt)
jq -c --arg d "$D" '{repo: $d, collection: "com.fedfork.exec.binding", rkey: "release", swapRecord: .cid, record: (.value | del(.inputs.association))}' \
~/.tmp/release-binding/before.json | curl -fsS -H "authorization: Bearer $tok" -H 'content-type: application/json' -d @- "$P/xrpc/com.atproto.repo.putRecord"
curl -fsS "$P/xrpc/com.atproto.repo.getRecord?repo=$D&collection=com.fedfork.exec.binding&rkey=release" | jq -c .value.inputs
```
Undo: the same putRecord with `record: .value` of `before.json` (and `swapRecord` the new CID).
## The hat-8 gate
```sh
scripts/promote-rehearse.sh+1−1
@@ -14,7 +14,7 @@ curl -fsSL --retry 3 -o src.tar.gz "$src"
echo "$src_sha src.tar.gz" | sha256sum -c --quiet
tar xzf src.tar.gz && rm src.tar.gz
git init -q && git add -A && git -c user.name=rehearse -c user.email=rehearse@localhost commit -qm src
id r2 >/dev/null 2>&1 || useradd -m r2
bash scripts/promote.sh prepare
bash scripts/ci-test.sh host
install -d -o r2 /home/r2
echo "sha:$commit" > /home/r2/requester.spec
scripts/promote.sh+20−3
@@ -1,6 +1,13 @@
#!/usr/bin/env bash
# promote.sh [--dry-run] [rollback]: plan 0040's promote, on the release VM, run by the release-workload module after it
# promote.sh [--dry-run] [prepare|rollback]: plan 0040's promote, on the release VM, run by the release-workload module after it
# moved channel rc.
# prepare (promote.yml's step, first) the release VM must have no guest requester: the gate signs in as bob and
# alice (their creds files), nothing on this VM runs as R2, so a VM whose binding asked for one
# (`association: true`: the association cloud-init's /etc/systemd/system/socialweb-r2.service) exits 1
# at once, else the runner waits beside the step for an R2 DID nothing reports and stops the step
# mid-gate when the associate gives up (200 polls of 10 s after the rent). Then, as root, the unix user
# r2 the gate runs as (/home/r2), made here since that cloud-init is not there to make it.
# Every mode but rollback runs the same check, --dry-run too
# (no argument) the prod target (scripts/ci-prod-target.sh: the sealed secrets to 0600 files of r2, then out of the
# environment), the socialweb.computer droplets to RELEASE_URL (RELEASE_SHA256), every rc operator's bidder
# heartbeating that binary (deploy/release/rc-operators.json, within updateWithin), then the prod gate as
@@ -24,13 +31,23 @@
# composition on that target (the target, the composition and the requester binary load; no account
# is touched). It prints the droplet deploys and the gate command it would run, and the state now
# of the `test` check it would wait for (KNOTLESS_RUN_SHA, else the commit RELEASE_URL names)
# Needs the secrets of .knotless/workflows/promote.yml, and before it `scripts/ci-test.sh host` and `binary` (the test
# host, the page, the requester spec).
# Needs the secrets of .knotless/workflows/promote.yml, and before it `promote.sh prepare`, then `scripts/ci-test.sh host`
# and `binary` (the test host, the page, the requester spec).
set -euo pipefail
cd "$(dirname "$0")/.."
dry=0
if [ "${1:-}" = --dry-run ]; then dry=1; shift; fi
would() { echo "==> would run: $*"; }
r2_unit=/etc/systemd/system/socialweb-r2.service
if [ -e "$r2_unit" ] && [ "${1:-}" != rollback ]; then
echo "==> promote runs no guest requester, but this VM has one ($r2_unit: its executor binding asks for \`association: true\`): the runner would stop the gate when its associate gives up; drop \`association\` from socialweb.computer's com.fedfork.exec.binding/release (docs/ci-debug.md \"The release binding\")" >&2
exit 1
fi
if [ "${1:-}" = prepare ]; then
if [ "$(id -u)" = 0 ]; then id r2 >/dev/null 2>&1 || useradd -m -s /bin/bash r2; fi
echo "==> no guest requester on this VM; the gate's unix user r2: $(id r2 2>/dev/null || echo 'none (not root)')"
exit 0
fi
command -v curl >/dev/null && command -v jq >/dev/null || { apt-get update -qq && apt-get install -y -qq curl jq >/dev/null; }
home=${CI_HOME:-/home/r2}
pidfile=$home/promote.pid rolled=$home/promote.rolled-back
AGENTS.md+1−1
@@ -28,7 +28,7 @@ needs the argument behind it. Do not read it end to end.
| What a host must provide | `socialweb-computer check-host -role gateway`, `-role bidder` or `-role requester`, `docs/host-contract.md` |
| The market network | `deploy/market-network/README.md` |
| The operator handoff | `handoff.yaml` |
| What CI runs on a push, and its runners | `.knotless/workflows/` (knotless only; GitHub CI is gone): the workflows `release`, `test-1` to `test-4` and `promote`, and `pins` (kcp-small 4/8) runs only when asked. `release` (kcp-build 12/16; on pushes to main and v* tags only, a branch when asked) is the gate's checks (`deploy/check.sh --fast`: gofmt, apigen, codegen drift, go vet on the host and every cross-OS target, architecture rules, the docs checker, the pins records, the policy engine tests; nothing is built), then the ONE build (the release binaries for every platform, the static test host, the wasm test modules and the static meshd of this commit's trees; a tree already published is skipped), the amd64 binary pushed to ttl.sh by digest for `test`, the node downloads and the guest image, and on main and v* tags its last steps stage `staging/<sha>/`, copy it inside the bucket to `main/<sha>/` and `main/latest/` (a tag: `releases/<tag>/`) and check what was published from the public URLs (its key a sealed secret of main and v* pushes; `superseded: finish` on those refs, a newer branch push cancels the older run). `test-1` to `test-4` (each kcp-test 4/8, `after: [release]`, side by side; a workflow file has no fan-out, so they are files written from `scripts/ci-test-workflow.yml.tmpl` by `scripts/ci-test-workflows.sh`, which holds the count; `deploy/check.sh` fails on drift) are the staging gate: each stands up ONE staging network from its own CI VM (its own guest requester) and `tests/compositions/staging/suite.sh` runs its share of the gate on it (`CI_SHARD=i/4` -> `tests/gate.sh` `GATE_SHARD`: the shares are disjoint and their union is every entry of `tests/entries.txt`, 43, `scripts/check-shards.sh`; as the network's alice1 to alice4, four at once; `scripts/ci-test.sh` `input_default`), printing `gate: staging: K of M PASS (shard i/4)`; `scripts/ci-staging-total.sh <commit>` reads the four and prints `gate: staging: N of 43 PASS` (exit 0 only when all four passed); it takes release's binary (main: `main/<sha>/`) and release's test host and meshd. `promote` (the `release` executor binding, `after: [test-1, test-2, test-3, test-4]`; only when asked until plan 0040 step 15) is the release: release-workload writes the rc's records and moves channel `rc`, `scripts/promote.sh` writes the prod target (`scripts/ci-prod-target.sh`), deploys the droplets, waits for every rc operator's heartbeat and runs the prod gate (`tests/gate.sh <target> --account bob,alice`: the `both` entries), then stable, or rc back to what it rolled forward from at once. Nothing but `release` compiles anything, and nothing rebuilds anything to compare (no reproducible-build verification in CI). The release pipeline: `docs/plans/0040-release-pipeline.md` Flow `promote` runs after `release`, alongside the `test-N` workflows, and ends green only when every one of them is green at the same commit (owner decision 28: `scripts/promote.sh` waits with `scripts/ci-check-wait.sh` for each name of `scripts/ci-test-workflows.sh names`). |
| What CI runs on a push, and its runners | `.knotless/workflows/` (knotless only; GitHub CI is gone): the workflows `release`, `test-1` to `test-4` and `promote`, and `pins` (kcp-small 4/8) runs only when asked. `release` (kcp-build 12/16; on pushes to main and v* tags only, a branch when asked) is the gate's checks (`deploy/check.sh --fast`: gofmt, apigen, codegen drift, go vet on the host and every cross-OS target, architecture rules, the docs checker, the pins records, the policy engine tests; nothing is built), then the ONE build (the release binaries for every platform, the static test host, the wasm test modules and the static meshd of this commit's trees; a tree already published is skipped), the amd64 binary pushed to ttl.sh by digest for `test`, the node downloads and the guest image, and on main and v* tags its last steps stage `staging/<sha>/`, copy it inside the bucket to `main/<sha>/` and `main/latest/` (a tag: `releases/<tag>/`) and check what was published from the public URLs (its key a sealed secret of main and v* pushes; `superseded: finish` on those refs, a newer branch push cancels the older run). `test-1` to `test-4` (each kcp-test 4/8, `after: [release]`, side by side; a workflow file has no fan-out, so they are files written from `scripts/ci-test-workflow.yml.tmpl` by `scripts/ci-test-workflows.sh`, which holds the count; `deploy/check.sh` fails on drift) are the staging gate: each stands up ONE staging network from its own CI VM (its own guest requester) and `tests/compositions/staging/suite.sh` runs its share of the gate on it (`CI_SHARD=i/4` -> `tests/gate.sh` `GATE_SHARD`: the shares are disjoint and their union is every entry of `tests/entries.txt`, 43, `scripts/check-shards.sh`; as the network's alice1 to alice4, four at once; `scripts/ci-test.sh` `input_default`), printing `gate: staging: K of M PASS (shard i/4)`; `scripts/ci-staging-total.sh <commit>` reads the four and prints `gate: staging: N of 43 PASS` (exit 0 only when all four passed); it takes release's binary (main: `main/<sha>/`) and release's test host and meshd. `promote` (the `release` executor binding, which asks for no guest requester: no `association`, `scripts/promote.sh prepare` exits 1 on a VM that has one and makes the gate's unix user r2, docs/ci-debug.md "The release binding"; `after: [test-1, test-2, test-3, test-4]`; only when asked until plan 0040 step 15) is the release: release-workload writes the rc's records and moves channel `rc`, `scripts/promote.sh` writes the prod target (`scripts/ci-prod-target.sh`), deploys the droplets, waits for every rc operator's heartbeat and runs the prod gate (`tests/gate.sh <target> --account bob,alice`: the `both` entries), then stable, or rc back to what it rolled forward from at once. Nothing but `release` compiles anything, and nothing rebuilds anything to compare (no reproducible-build verification in CI). The release pipeline: `docs/plans/0040-release-pipeline.md` Flow `promote` runs after `release`, alongside the `test-N` workflows, and ends green only when every one of them is green at the same commit (owner decision 28: `scripts/promote.sh` waits with `scripts/ci-check-wait.sh` for each name of `scripts/ci-test-workflows.sh names`). |
| What the system does, end to end, and its tests | `docs/acceptance/` (the runbooks), `tests/system` (one test file per runbook), `tests/testkit/README.md` |
## Layout