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

socialweb.computer/socialweb-computer-kcp

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

1 collaborator
0
0

promote: prepare gives the gate user what staging's has

Merged johnandersen777.bsky.social asked to merge into main from socialweb.computer/socialweb-computer-kcp:phase-2
docs/plans/0040-findings.md+76−0
@@ -1772,3 +1772,79 @@ Each: what was seen (with the log), the cause, the fix, its proof.
No artifacts kept ("kept 0 of gate-runs"). Log: `knotless run list ... --commit a4aa6d629c81 --workflow promote
--log` (saved ~/.tmp/ci-main/promote-a4aa6d62.log). Agents: `rc-0017` (the three 0017 entries and the artifacts),
`rc-0013d` (0013:c as john). Staging at that commit: test-2 3/3, test-3 16/16 green; test-1 and test-4 running.
- Promote 6 (rc182, main a4aa6d62, 20:37Z to 21:50Z, the first complete prod gate in CI): `gate: prod: 26 of 30 PASS`;
0017:run (john), 0017:killed (bob), 0017:killedlate (alice) FAIL 900 `the owner's subscription closed before it
exited: No such file or directory (os error 2)`; 0017:devsup, half, samename PASS. Rolled back to rc180.
CAUSE: the three are the only entries whose `request.start` asks `pty: true` (`tests/modules/acc-0017/src/lib.rs:29`,
`run_with`); the test host runs that invocation through `tokio::process::Command::new("socat")`
(`tests/host/src/swc.rs:659`, `SYSTEM:<line>,pty,setsid,ctty,stderr`), and `spawn()` fails ENOENT, which
`request_start` returns as the subscription's error. The release VM's image has no socat: the published ci-toolchain
rootfs (`deploy/vm-images/ci-toolchain.json`, image.json 0049d853, rootfs.ext4 69ff0747; read with `debugfs` from
hat-8's copy `~/.tmp/ci-image-work4/out/ci-toolchain/`, its SHA256SUMS and image.json hash equal to the published ones)
has no `/usr/bin/socat` and no dpkg entry for it (`knotless-ci-toolchain.sh` installs none); `promote.sh prepare` made
r2 and nothing else. Staging installs it as root beside uidmap (`tests/modules/staging/src/lib.rs` `install`, the
finding above "0017 never ran on staging"), hat-8 has it: so 0017 passes there. Not XDG_RUNTIME_DIR: `promote.sh`
already enables linger for r2 and waits for `/run/user/<uid>`; the old association cloud-init (requester repo
`modules/user-data/src/lib.rs:93`: groupadd, useradd, enable-linger) never installed socat either.
FIX: `promote.sh prepare`, as root, installs socat when it is missing (apt, as the staging install does: unpinned,
like uidmap and socat there) and prints its path. Proof: `promote.sh prepare` as non-root (`socat: /usr/bin/socat`)
and `promote.sh --dry-run` with an empty HOME (exit 0, `~/.tmp/rc-0017/promote-dry.log`). Unproven: the apt install on
a release VM (no VM rented); the 0017 entries in a promote. The next ci-toolchain bake could carry socat instead.
The holds: each FAIL sat its full GATE_FREEZE_TTL (900 s) frozen.
ARTIFACTS: `==> artifacts: kept 0 of gate-runs` although the gate wrote `/work/gate-runs/<run>`. The runner reads
artifacts with two scripts run as ordinary steps through the workload (knotless `crates/knotless-run/src/artifacts.rs`
`collect`, `composition.rs` `step` -> `export`, whose output is only the root module's `result.output`). The release
binding's root is release-workload, which sends any step that is not `release ...` to the
`computer.socialweb.cicd.workload.run` hook (cicd-workload) and answers with that call's final result
(`{steps, ok}`, no output): the listing's lines were cicd-workload's, never the root's, so the runner parsed an empty
listing (exit 0) and kept nothing. Not ownership (root reads r2's files) and not the stop (it runs before, but
deletes nothing). FIX (requester repo, branch `rc-0017-artifacts`): release-workload runs such a step as its own
machine job (`begin`/`on_job`, as its release jobs), so its output is the root's as it comes (commit 8c20a146).
Proof: its `test.mjs` other-job test now asserts the root's output; on the old module it is `''` (the cause
reproduced), on the new one 8 of 8 pass. Needs the module and composition published (`scripts/publish-chain.sh
release-workload`) before a promote keeps artifacts; module.json still names the workload.run hook (now unused).
- 0013:c in CI promote (main a4aa6d62, 2026-11-18 20:37Z to 21:50Z, the first whole prod gate in CI, 26 of 30):
`FAIL 900 req: run requester mk exited exit status: 2 before ready (john)`. SEEN: the requester exited at once; the
900 s is the gate's freeze (`GATE_FREEZE_TTL`); no artifacts were kept, and the note did not carry the requester's
own error. CAUSE (from the code, not from the release VM, which is gone): exit 2 is `exitRefused` of
`cmd/socialweb-computer`, and the only refusal on 0013:c's path that 0013:run (same VM, same binary, alice, PASS)
does not take is `--with-gateway`'s `gatewayPreflight` (`cmd/socialweb-computer/requestergateway.go`): the host
contract `hostcontract.EvaluateRequesterGateway` (cgroup v2, user@<uid> delegation, one subuid/subgid range of 65536
or more, setuid newuidmap/newgidmap, tzdata, `/etc/rancher`). Every other refusal before ready is either taken by
0013:run too or is identical on hat-8, and nothing reads the password before ready (the sign-in fails with exit 1),
so it is neither john nor his quoted password: by hand on hat-8 as john the same entry gets past the requester's
ready (below). The release VM's r2 comes from `scripts/promote.sh prepare`, which makes it with a bare `useradd -m`
and the gate step's `loginctl enable-linger r2`; nothing on that VM (promote.sh, `scripts/knotless-ci-toolchain.sh`,
the release binding's user data) makes `/etc/rancher`, installs `uidmap` or reserves r2's range. Staging gives its
gate account exactly those (`tests/modules/staging/src/lib.rs`: `usermod --add-subuids 1000000-2048575
--add-subgids 1000000-2048575 stg`, `apt-get install uidmap socat` when missing, `loginctl enable-linger stg`,
`install -d -m 0755 /etc/rancher`), the host 0013:c runs on in the staging suite. Which of the checks failed on that VM is
unproven (its stderr was not kept); `/etc/rancher` is certain to be missing on a fresh toolchain image.
FIX: (a) `scripts/promote.sh prepare` (held by the 0017 agent, not edited here) gives r2 what staging gives stg:
as root, after the useradd: `sed -i '/^r2:/d' /etc/subuid /etc/subgid; usermod --add-subuids 1000000-2048575
--add-subgids 1000000-2048575 r2; command -v newuidmap >/dev/null || { apt-get update -q >/dev/null;
DEBIAN_FRONTEND=noninteractive apt-get install -y -q uidmap >/dev/null; }; install -d -m 0755 /etc/rancher`.
(b) legibility (`tests/host/src/swc.rs` requester_start): `exited <st> before ready` now carries the requester log's
last 3 non-empty lines (redact_log, 400 chars each), so the refusal's own line ("run requester: --with-gateway runs
k3s and kine in this account's user manager, and the host does not provide what they need: <checks>") reaches the
RESULT line. The same exit reproduced on hat-8 in a user namespace (`unshare -U`, uid 65534): exit 2 at once, last
line `... does not provide what they need: user-manager-delegation, subuid-subgid-range (check-host -role gateway
names the same fixes)`.
PROOF: by hand on hat-8 as john against prod (rc180), this tree's host (`rc-0013d`), requester sha:7a0406d9 (no change
in `cmd/socialweb-computer`, `internal/hostcontract` or `internal/stack/request` from 7a0406d9 to a4aa6d62): 0013:c
PASS 297.5 s, 21:55:06Z to 22:00:08Z (pod_ready_s 75.3, nodes_zero_s 160.5, records_checked 5, cleanupErrors none;
run `0013-composition-1795038906592`, log `~/.tmp/rc-0013d/0013-c-john.log`). Unproven: the prepare fix on a
release VM (the next promote), and which host contract check(s) the VM failed.
- PROMOTE 6's FOUR PROD FAILURES, ONE THEME: the release VM's gate user r2 had less than staging's stg. `promote.sh
prepare` did a bare `useradd`; staging's install gives its gate user one subordinate id range, `uidmap`, `socat`
and `/etc/rancher`. 0017:run, killed, killedlate start their owner on a pty through `socat` (ENOENT); 0013:c's
`--with-gateway` host check refuses without the id range, `newuidmap` and `/etc/rancher` (exit 2). `prepare` now
does what staging's install does. REHEARSED on a rented VM of the release binding's image (ci-toolchain 0049d853,
4 vCPU / 8G, 22:10Z, `~/.tmp/rehearse-prep/out2.log`): `prepare` exit 0, r2 uid 1001, `/usr/bin/socat`,
`/usr/bin/newuidmap`; as r2 `check-host -role gateway` all OK (delegation cpu memory pids, linger, tzdata), exit 0.
Unproven until the next promote: the four entries themselves. The stale `--image` example in docs/ci-debug.md's
rehearsal needs a current CLI build (the hat-8 installed one has no `--image`) and a fresh `--state-dir` (a stored
old password gave 401).
- STAGING at a4aa6d62: test-1 11/11, test-2 3/3, test-3 16/16, test-4 12 of 13: 0014:concurrent FAIL
(`"st-0014-...-1-0" Held on did:plc:td7hozto6bp5trse4b6obkne, which refused it`, alice2); passed on d6a2b391.
Artifacts kept (12 of runs). Agent `rc-0014c` on the cause.
scripts/promote.sh+13−3
@@ -6,7 +6,9 @@
# (`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.
# r2 the gate runs as (/home/r2), made here since that cloud-init is not there to make it, and socat
# (apt, as the staging install adds it): the test host runs a `pty` request.start (0017:run, killed,
# killedlate) through socat (tests/host/src/swc.rs), which the ci-toolchain image lacks.
# 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
@@ -55,8 +57,16 @@ if [ -e "$r2_unit" ] && [ "${1:-}" != rollback ]; then
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)')"
if [ "$(id -u)" = 0 ]; then
id r2 >/dev/null 2>&1 || useradd -m -s /bin/bash r2
# as staging's gate user (tests/modules/staging install): one subordinate id range, uidmap, /etc/rancher
# (0013:c's --with-gateway host check), socat (0017's pty invocations)
sed -i '/^r2:/d' /etc/subuid /etc/subgid
usermod --add-subuids 1000000-2048575 --add-subgids 1000000-2048575 r2
{ command -v socat >/dev/null && command -v newuidmap >/dev/null; } || { apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq socat uidmap >/dev/null; }
install -d -m 0755 /etc/rancher
fi
echo "==> no guest requester on this VM; the gate's unix user r2: $(id r2 2>/dev/null || echo 'none (not root)'); socat: $(command -v socat || echo none); newuidmap: $(command -v newuidmap || echo none)"
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; }
tests/host/src/swc.rs+10−1
@@ -498,7 +498,16 @@ impl Swc {
if let Some((_, c)) = self.requesters.lock().await.get_mut(&name)
&& let Ok(Some(st)) = c.try_wait()
{
return Err(format!("run requester {name} exited {st} before ready"));
// the requester's own last lines (its log, redacted as the run's logs are), so the failure reads from the
// gate's RESULT line alone (a CI run keeps no artifacts)
let said = std::fs::read_to_string(state.join(format!("{name}.log"))).unwrap_or_default();
let lines: Vec<&str> = said.lines().filter(|l| !l.trim().is_empty()).collect();
let last = redact_log(&lines[lines.len().saturating_sub(3)..].join("\n"));
let last: Vec<String> = last.lines().map(|l| l.chars().take(400).collect()).collect();
return Err(format!(
"run requester {name} exited {st} before ready: {}",
last.join(" | ")
));
}
if Instant::now() > deadline {
return Err(format!("run requester {name}: no ready file in 10 min"));