onboard-host: host registry + idempotent machine enrolment — compute plugs in like repos do #6

Closed
opened 2026-08-19 23:13:41 +00:00 by ben · 6 comments
Owner

Problem

Compute joins the factory artisanally. Enrolling the second pool host took a day of hand-work (docker mode, subuid walls, unit env, runner registration, uid alignment) and most of it lives only in scar tissue and memory, not in a script. Meanwhile the factory has factory onboard <repo> (#5) for products but nothing symmetric for machines — so "make the most of compute" currently means "repeat the elitebook-03 day per machine".

Per-host behaviour is also undeclared: every machine gets the same binary one-heavy-worker flock regardless of its size, and nothing records which repos or workload classes a host serves. The scheduling policy those declarations feed is Matou/ourcloud#577 (capacity semaphore, per-repo fairness, drive-vs-worker serialization); this ticket is the mechanism that gets a host into that model.

What to build

1. A host registry (factory-owned state). Each enrolled machine declares, in one committed file per host (e.g. hosts/<name>.conf, shell-sourceable like swarm-identity.sh):

  • identity: name, door (ssh target), runner labels
  • capacity: heavy-worker slots, whether it accepts exclusive workloads (drives), light-worker allowance
  • coverage: which product repos it serves
  • kill switch path (per-host off-file, the session-runner pattern)

The registry is the input #577's semaphore reads and the TUI's (#573 in ourcloud) fleet screen lists. Registry format should be settled with a #577 sketch in mind but must not block on its ruling — start with the fields above; the semaphore can grow columns.

2. onboard-host <name> — idempotent enrolment, sibling of onboarding/onboard.sh (#5/PR 5):

  • preflight the machine: docker mode (rootful — the rootless subuid wall is a known killer), required uids, disk, toolchain for the repos it will serve
  • register the Forgejo runner with the right labels
  • install the worker crontab entries rendered from the registry (converges with #3 — host state factory-owned; don't hand-edit crontabs per machine)
  • write the host's registry file and verify it round-trips
  • self-test: claim + release a synthetic ticket, prove the claim shows the right host name; run one offline harness test suite on the box

Same bar as the rest of this repo: offline-testable subcommands, no repo or host literals in the shared code, every step idempotent and loud on failure.

3. Log egress rule for pool hosts (GOTCHAS 1). A job scheduled onto a pool member must ship its own log (artifact upload or ticket post) — enrolment installs whatever that needs, because a host whose failures are unreadable is worse than no host.

4. Decommission is part of the lifecycle: onboard-host --retire <name> drains (stops claiming, waits out live claims), removes crontab entries, deregisters the runner, and marks the registry entry retired — never delete history.

Explicitly out of scope

  • The scheduling policy itself (weights, fairness, serialization classes) — that's Matou/ourcloud#577's ruling; this ticket only makes hosts declare inputs to it.
  • Moving existing hosts' state wholesale — that's #3; this ticket must not fight it, only converge (rendered crontabs are the shared seam).

Acceptance

  • A fresh machine goes from bare ssh access to claiming and completing one real light ticket via onboard-host alone, no undocumented hand-steps.
  • The registry file exists for every active host, and at least one existing host (matou-workstation or elitebook-03) is retrofitted into the registry without behaviour change.
  • Retire drains cleanly on a live host with a claim in flight.

Refs: Matou/ourcloud#577 (policy), #3 (host state), #5 (onboarding sibling), GOTCHAS 1 (log egress), Matou/ourcloud GOTCHAS (rootful-docker cutover scar tissue, 2026-08-12).

## Problem Compute joins the factory artisanally. Enrolling the second pool host took a day of hand-work (docker mode, subuid walls, unit env, runner registration, uid alignment) and most of it lives only in scar tissue and memory, not in a script. Meanwhile the factory has `factory onboard <repo>` (#5) for products but nothing symmetric for machines — so "make the most of compute" currently means "repeat the elitebook-03 day per machine". Per-host behaviour is also undeclared: every machine gets the same binary one-heavy-worker flock regardless of its size, and nothing records which repos or workload classes a host serves. The scheduling *policy* those declarations feed is `Matou/ourcloud#577` (capacity semaphore, per-repo fairness, drive-vs-worker serialization); this ticket is the *mechanism* that gets a host into that model. ## What to build **1. A host registry (factory-owned state).** Each enrolled machine declares, in one committed file per host (e.g. `hosts/<name>.conf`, shell-sourceable like `swarm-identity.sh`): - identity: name, door (ssh target), runner labels - capacity: heavy-worker slots, whether it accepts exclusive workloads (drives), light-worker allowance - coverage: which product repos it serves - kill switch path (per-host off-file, the session-runner pattern) The registry is the input #577's semaphore reads and the TUI's (#573 in ourcloud) fleet screen lists. Registry format should be settled with a #577 sketch in mind but must not block on its ruling — start with the fields above; the semaphore can grow columns. **2. `onboard-host <name>` — idempotent enrolment, sibling of `onboarding/onboard.sh` (#5/PR 5):** - preflight the machine: docker mode (rootful — the rootless subuid wall is a known killer), required uids, disk, toolchain for the repos it will serve - register the Forgejo runner with the right labels - install the worker crontab entries *rendered from the registry* (converges with #3 — host state factory-owned; don't hand-edit crontabs per machine) - write the host's registry file and verify it round-trips - self-test: claim + release a synthetic ticket, prove the claim shows the right host name; run one offline harness test suite on the box Same bar as the rest of this repo: offline-testable subcommands, no repo or host literals in the shared code, every step idempotent and loud on failure. **3. Log egress rule for pool hosts (GOTCHAS 1).** A job scheduled onto a pool member must ship its own log (artifact upload or ticket post) — enrolment installs whatever that needs, because a host whose failures are unreadable is worse than no host. **4. Decommission is part of the lifecycle:** `onboard-host --retire <name>` drains (stops claiming, waits out live claims), removes crontab entries, deregisters the runner, and marks the registry entry retired — never delete history. ## Explicitly out of scope - The scheduling policy itself (weights, fairness, serialization classes) — that's `Matou/ourcloud#577`'s ruling; this ticket only makes hosts *declare* inputs to it. - Moving existing hosts' state wholesale — that's #3; this ticket must not fight it, only converge (rendered crontabs are the shared seam). ## Acceptance - A fresh machine goes from bare ssh access to claiming and completing one real light ticket via `onboard-host` alone, no undocumented hand-steps. - The registry file exists for every active host, and at least one existing host (matou-workstation or elitebook-03) is retrofitted into the registry without behaviour change. - Retire drains cleanly on a live host with a claim in flight. Refs: `Matou/ourcloud#577` (policy), #3 (host state), #5 (onboarding sibling), GOTCHAS 1 (log egress), `Matou/ourcloud` GOTCHAS (rootful-docker cutover scar tissue, 2026-08-12).
Author
Owner

Live evidence for the host-registry need (2026-08-20). elitebook-03 was enrolled for Matou/idss only: its matou-app pnpm-store was empty, so every matou-app swarm tick on that host died in ~8 s for 20 h (mis-logged as a preflight red — see #9). Hand-seeded the 28 M store from the workstation via a laptop pipe (the pool hosts can't reach each other). onboard-host must treat warm state as per repo per host and seed/verify it for every repo the host serves; sqlite3 is also absent on that host (harmless today — the swarm.db mirror is python — but worth a tool-inventory line in the registry).

**Live evidence for the host-registry need (2026-08-20).** `elitebook-03` was enrolled for `Matou/idss` only: its `matou-app` `pnpm-store` was empty, so every `matou-app` swarm tick on that host died in ~8 s for 20 h (mis-logged as a preflight red — see #9). Hand-seeded the 28 M store from the workstation via a laptop pipe (the pool hosts can't reach each other). `onboard-host` must treat warm state as *per repo per host* and seed/verify it for every repo the host serves; `sqlite3` is also absent on that host (harmless today — the swarm.db mirror is python — but worth a tool-inventory line in the registry).
Author
Owner

Addendum 2026-08-22 — e2e coverage is part of enrolment

Ben's ruling (matou-app): harness-only flows run on the pool label (dev-factory 4e602ae, matou-app PR #55). The remaining per-host pin is SMOKE_RUNNER_LABEL — flows that need a product e2e stack — and today only matou-workstation carries it. Getting a second host there is the rest of this ticket's job, with a clean split:

  • Factory (here): the generic host — docker, runner + labels, crontab, registry. The registry's coverage field gains, per repo, whether this host carries that repo's e2e stack; if so the host gets the SMOKE_RUNNER_LABEL.
  • Product repo: owns .sandcastle/provision-e2e-stack.sh (per-repo layer, not vendored; idempotent; --check mode) — the factory knows nothing about KERIA. Matou/matou-app#57 builds it.
  • onboard-host invokes that hook (if present) for each repo in the host's coverage list, and its preflight runs --check. A repo without the hook is pool-only on that host.

Acceptance added: elitebook-03 is retrofitted with matou-app e2e coverage so pr-e2e / smoke-drive / swarm-smoke can move to runs-on: swarm — no single machine is the bottleneck on a ticket's e2e verdict.

## Addendum 2026-08-22 — e2e coverage is part of enrolment Ben's ruling (matou-app): harness-only flows run on the pool label (dev-factory `4e602ae`, matou-app PR #55). The remaining per-host pin is `SMOKE_RUNNER_LABEL` — flows that need a **product** e2e stack — and today only matou-workstation carries it. Getting a second host there is the rest of this ticket's job, with a clean split: - **Factory (here):** the generic host — docker, runner + labels, crontab, registry. The registry's `coverage` field gains, per repo, whether this host carries that repo's e2e stack; if so the host gets the `SMOKE_RUNNER_LABEL`. - **Product repo:** owns `.sandcastle/provision-e2e-stack.sh` (per-repo layer, not vendored; idempotent; `--check` mode) — the factory knows nothing about KERIA. Matou/matou-app#57 builds it. - **`onboard-host`** invokes that hook (if present) for each repo in the host's coverage list, and its preflight runs `--check`. A repo without the hook is pool-only on that host. **Acceptance added:** elitebook-03 is retrofitted with matou-app e2e coverage so `pr-e2e` / `smoke-drive` / `swarm-smoke` can move to `runs-on: swarm` — no single machine is the bottleneck on a ticket's e2e verdict.
Author
Owner

Ruling (Ben, 2026-08-22): the session-runner is part of the factory by default, not a per-host afterthought. Enrolling a host for a repo (onboard-host / the install session) installs the ready-for-session drainer as a standing deliverable:

  • one crontab line per repo, rendered from the identity (*/10 * * * * . <env-file> && <workdir>/.sandcastle/session-runner.sh >> <log> 2>&1), idempotent (grep-before-append, exactly what was done by hand for Matou/dev-factory on matou-workstation today);
  • the runner's dedicated checkout (~/session-runner/<repo>) and state dir created or left alone;
  • the kill switch (session-runner.off) documented in the enrolment output;
  • a verify that lists the installed cron lines and the last tick's log line.

Today's by-hand precedent: the dev-factory line was appended next to idss's at ~16:25Z; idss's points at its dedicated checkout, dev-factory's at the swarm workdir — enrolment should pick ONE convention (the dedicated checkout, after bootstrapping it) so the script isn't read from a tree the swarm resets mid-run.

**Ruling (Ben, 2026-08-22):** the session-runner is part of the factory by default, not a per-host afterthought. Enrolling a host for a repo (`onboard-host` / the install session) installs the `ready-for-session` drainer as a standing deliverable: - one crontab line per repo, rendered from the identity (`*/10 * * * * . <env-file> && <workdir>/.sandcastle/session-runner.sh >> <log> 2>&1`), idempotent (grep-before-append, exactly what was done by hand for `Matou/dev-factory` on matou-workstation today); - the runner's dedicated checkout (`~/session-runner/<repo>`) and state dir created or left alone; - the kill switch (`session-runner.off`) documented in the enrolment output; - a `verify` that lists the installed cron lines and the last tick's log line. Today's by-hand precedent: the dev-factory line was appended next to idss's at ~16:25Z; idss's points at its dedicated checkout, dev-factory's at the swarm workdir — enrolment should pick ONE convention (the dedicated checkout, after bootstrapping it) so the script isn't read from a tree the swarm resets mid-run.
Author
Owner

Ruling addendum (Ben, 2026-08-22): the session-runner is on by default for every factory repo, including dev-factory itself (so the factory can file ready-for-session tickets for itself and have them completed), with a per-repo opt-out asked once during setup:

  • Policy knob: SESSION_RUNNER=on|off in swarm-policy.sh (default on; policy-lib.sh validates it like the other enums; onboard.sh policy writes it). The install session asks the question.
  • Enrolment installs the cron line only when the policy says on; off removes/skips it idempotently.
  • The existing session-runner.off kill-switch file remains the operational pause (per host, temporary); the policy knob is the permanent, per-repo decision. Both documented in the enrolment output.
**Ruling addendum (Ben, 2026-08-22):** the session-runner is **on by default for every factory repo, including dev-factory itself** (so the factory can file `ready-for-session` tickets for itself and have them completed), with a per-repo **opt-out asked once during setup**: - Policy knob: `SESSION_RUNNER=on|off` in `swarm-policy.sh` (default `on`; `policy-lib.sh` validates it like the other enums; `onboard.sh policy` writes it). The install session asks the question. - Enrolment installs the cron line only when the policy says `on`; `off` removes/skips it idempotently. - The existing `session-runner.off` kill-switch file remains the *operational* pause (per host, temporary); the policy knob is the *permanent, per-repo* decision. Both documented in the enrolment output.

Report — the mechanism landed; the fresh-machine acceptance is human residue

Ruled by agent under ADR 0174 — veto anytime. Commit 6934f82 on main
(root touch is policy-lib.sh alone; everything else is onboarding/, which
is vendor-excluded). Decision record:
docs/adr/0005-machines-enrol-by-declaration-onboard-host.md.

One ruling worth your veto: the registry stays host-resident

This ticket asked for "one committed file per host (e.g. hosts/<name>.conf)".
Declined, and the substance delivered in the host registry #3/ADR 0004
already created, for three reasons:

  1. ADR 0004 point 4 ruled — five commits ago — that which repos a machine
    carries and where their checkouts sit are per-host operational facts,
    the same class as the consumer list that lives in STATUS.md and not in a
    harness file (CLAUDE.md's blast-radius rule). A committed
    hosts/matou-workstation.conf is a host name plus product checkout paths in
    the factory repo.
  2. Two registries — one in-repo for identity/capacity, one on-host for cron —
    would have to be kept in sync by hand, which is the exact failure mode
    this ticket exists to end.
  3. The ticket itself says this must "not fight #3, only converge". Converging
    means one declaration, not two.

The cost is real and is written into the ADR: the fleet's shape is not readable
from one place without ssh. That is what the new door field is for, and if a
fleet-wide read ever has to happen without ssh, the answer is a published
artifact per host, not a second source of truth. If you want it in-repo
instead, say so and it moves — the schema and renderers are unchanged either
way.

What landed

1. The registry declares the machine (schema:
onboarding/templates/host-registry.conf.example), on top of ADR 0004's cron
inputs — identity (name, door, runner-labels), capacity (heavy-slots,
light-slots, drive-exclusive — ADR 0003's knob finally has a home —
killswitch), coverage (coverage <repo> pool|e2e), inventory/lifecycle
(tools, status active|retired [<stamp>]). Every default reproduces today's
behaviour byte-identically.

Capacity is declared, never probed: how much a box can carry is a judgement
made from observed RAM and load — ADR 0003 rules two similar-spec hosts
differently for good reasons — so reading it off nproc would silently re-rule
that judgement on every run.

host_state_capacity_env writes <home>/factory-cron/host-capacity.env, the
sourceable seam Matou/ourcloud#577's semaphore and the TUI's fleet screen
read
, with HOST_CAPACITY_SLOTS derived from heavy-slots into exactly the
lock paths host-capacity-lib.sh's pool uses. Weights, fairness and
serialization classes stay #577's ruling — this is the input, not the arbiter.

2. onboard-host — bash onboarding/onboard.sh onboard-host {preflight|enrol|verify|selftest|claim-probe|runner-register|retire|capacity-env}.
Preflight never short-circuits (one run names everything wrong with a box) and
checks the scars by name:

  • docker mode — a rootless daemon is refused by name. Its subuid wall is
    the known enrolment killer and it fails much later, as an unreadable
    permission error inside a worker.
  • uid alignment — reports the AGENT_UID/AGENT_GID every image build on
    this host must use (GOTCHAS 9) and refuses a checkout this user does not own.
  • per repo per host — checkout, .sandcastle/, and a warm pnpm store,
    naming the repo that lacks one. This is your 2026-08-20 evidence made into a
    check: a cold store kills every worker for that repo in ~8 s with a red the
    healer mis-attributes (#9). tools is the inventory line you asked for.
  • e2e coverage — for coverage <repo> e2e, the product repo's own
    .sandcastle/provision-e2e-stack.sh --check, per your 2026-08-22 split. The
    factory knows nothing about any product's stack; it invokes the hook. A repo
    claiming e2e with no hook fails loud, rather than silently downgrading to
    pool-only.
  • log egress (GOTCHAS 1) — the logdir must be writable and every managed
    line must ship both streams into it. Proven at enrolment, not assumed.

3. The kill switch is per host and actually gates the cron lines — each is
prefixed [ -e "<killswitch>" ] || { … }. The braces are the whole point:
[ -e ks ] || . env && cmd parses as (([ -e ks ] || . env) && cmd), which
runs the command exactly when the switch is present. The rendered shape is
pinned by a test that executes it both ways in /bin/sh, and the inversion
was demonstrated in dash on this host before the live install.

4. SESSION_RUNNER=on|off landed in policy-lib.sh per your 2026-08-22
addendum: on by default for every factory repo, opt-out asked once at setup,
validated like the other enums, writable by onboard.sh policy. The render
honours it by reading — never sourcing — the repo's swarm-policy.sh. Your
"pick ONE convention" ruling is enforced by the schema comment: session points
at a dedicated checkout, never a tree the swarm resets mid-run.

5. Retire's order is its safety property. Kill switch first (so the
drain is bounded — a host still claiming can never finish draining), wait out
in-flight claims, and only then stamp retired <UTC> and re-install, which
renders an empty managed block. A timed-out drain fails and leaves the host
fully installed
: half-retired — no schedule, live claims — is the one state
worse than either end. The entry is stamped, never deleted; re-enrolment is
flipping status back to active.

Proof

  • Full offline suite green, 64 files. New
    onboarding/tests/onboard-host-lib-test.sh (65 cases — every host fact
    shimmed: docker, df, crontab, the runner service, the tracker);
    host-state-lib-test.sh 55 → 94; tests/policy-lib-test.sh +5.
  • matou-workstation retrofitted live, no behaviour change. 16-check
    preflight PASSED, enrolled, verify green, second enrol byte-identical. The
    only crontab delta is the kill-switch guard — absent switch = identical
    behaviour, proven in dash both ways before installing. host-capacity.env
    written (2 heavy + 2 light slots, drive-exclusive all per ADR 0003).
  • Self-test on the box: ran a served repo's own vendored
    tests/host-capacity-lib-test.sh (13 groups) from its checkout.
  • Claim probe: opened, claimed, proved the claim carries matou-workstation,
    and closed synthetic ticket #39. It is closed and unlabelled — no queue litter.
  • Retire drained against this host's REAL in-flight claims (both pooled
    slots genuinely held at the time): it set the switch, refused to finish, left
    the schedule installed and the registry unstamped — then completed against a
    byte-copy of the real crontab once the locks were free. The live crontab was
    verified byte-identical throughout (/usr/bin/crontab -l, absolute path — the
    shim was on PATH).
  • One live finding fixed while retrofitting: the warm-store check must NOT
    apply to session-runner checkouts — a session runs Claude in place and never
    mounts a store, and both live session checkouts are cold, correctly. Pinned by
    a test case.

Matou/matou-app's coverage is recorded pool, not e2e, until it ships
.sandcastle/provision-e2e-stack.sh (Matou/matou-app#57) — by your own rule
that a repo without the hook is pool-only on a host.

Why human

Three acceptance items are not proven, and each is a one-way door or a
missing door, not a gap in the mechanism:

  1. "A fresh machine goes from bare ssh to claiming via onboard-host alone."
    Needs (a) a machine — none is available to this session; (b) a rootful
    docker cutover / subuid configuration
    , which is privileged, host-wide and
    not revertible by a commit; (c) a Forgejo runner registration token, a
    personal credential ADR 0174 rule 2 reserves for a human. The code path
    exists and is offline-tested (runner-register registers under the declared
    name and labels, is idempotent against an existing .runner, and refuses
    without the token rather than prompting) — what is missing is the box and the
    credential, not the script.
  2. "The registry file exists for every active host." matou-workstation is
    done. elitebook-03 cannot be reached from here — no ssh door, and the
    pool hosts cannot reach each other (your 2026-08-20 note). Its retrofit is
    the same five minutes of work run from that box, or from a laptop with both
    doors.
  3. "Retire drains cleanly on a live host with a claim in flight." The drain
    half is proven against this host's real in-flight claims (above). Actually
    decommissioning a live pool host is fleet-affecting: it stops the machine
    that carries all three repos' schedules. That is a deliberate operational
    act, not an unattended one.

Also worth a human eye, though not blocking: matou-app's e2e coverage flip
waits on Matou/matou-app#57's hook, and the SESSION_RUNNER knob is a root
change, so it reaches the running copies only at the next re-vendor
(GOTCHAS 4).

Relabelled ready-for-human. Everything two-way is landed, pushed and proven.

## Report — the mechanism landed; the fresh-machine acceptance is human residue **Ruled by agent under ADR 0174 — veto anytime.** Commit `6934f82` on `main` (root touch is `policy-lib.sh` alone; everything else is `onboarding/`, which is vendor-excluded). Decision record: `docs/adr/0005-machines-enrol-by-declaration-onboard-host.md`. ### One ruling worth your veto: the registry stays host-resident This ticket asked for "one committed file per host (e.g. `hosts/<name>.conf`)". **Declined**, and the substance delivered in the host registry #3/ADR 0004 already created, for three reasons: 1. ADR 0004 point 4 ruled — five commits ago — that which repos a machine carries and where their checkouts sit are per-host **operational facts**, the same class as the consumer list that lives in `STATUS.md` and not in a harness file (CLAUDE.md's blast-radius rule). A committed `hosts/matou-workstation.conf` is a host name plus product checkout paths in the factory repo. 2. Two registries — one in-repo for identity/capacity, one on-host for cron — would have to be kept in sync **by hand**, which is the exact failure mode this ticket exists to end. 3. The ticket itself says this must "not fight #3, only converge". Converging means one declaration, not two. The cost is real and is written into the ADR: the fleet's shape is not readable from one place without ssh. That is what the new `door` field is for, and if a fleet-wide read ever has to happen without ssh, the answer is a published artifact per host, not a second source of truth. **If you want it in-repo instead, say so and it moves — the schema and renderers are unchanged either way.** ### What landed **1. The registry declares the machine** (schema: `onboarding/templates/host-registry.conf.example`), on top of ADR 0004's cron inputs — identity (`name`, `door`, `runner-labels`), capacity (`heavy-slots`, `light-slots`, `drive-exclusive` — ADR 0003's knob finally has a home — `killswitch`), coverage (`coverage <repo> pool|e2e`), inventory/lifecycle (`tools`, `status active|retired [<stamp>]`). Every default reproduces today's behaviour byte-identically. Capacity is **declared, never probed**: how much a box can carry is a judgement made from observed RAM and load — ADR 0003 rules two similar-spec hosts differently for good reasons — so reading it off `nproc` would silently re-rule that judgement on every run. `host_state_capacity_env` writes `<home>/factory-cron/host-capacity.env`, the sourceable seam **`Matou/ourcloud#577`'s semaphore and the TUI's fleet screen read**, with `HOST_CAPACITY_SLOTS` derived from `heavy-slots` into exactly the lock paths `host-capacity-lib.sh`'s pool uses. Weights, fairness and serialization classes stay #577's ruling — this is the input, not the arbiter. **2. `onboard-host`** — `bash onboarding/onboard.sh onboard-host {preflight|enrol|verify|selftest|claim-probe|runner-register|retire|capacity-env}`. Preflight never short-circuits (one run names everything wrong with a box) and checks the scars by name: - **docker mode** — a *rootless* daemon is refused by name. Its subuid wall is the known enrolment killer and it fails much later, as an unreadable permission error inside a worker. - **uid alignment** — reports the `AGENT_UID`/`AGENT_GID` every image build on this host must use (GOTCHAS 9) and refuses a checkout this user does not own. - **per repo per host** — checkout, `.sandcastle/`, and a **warm pnpm store**, naming the repo that lacks one. This is your 2026-08-20 evidence made into a check: a cold store kills every worker for that repo in ~8 s with a red the healer mis-attributes (#9). `tools` is the inventory line you asked for. - **e2e coverage** — for `coverage <repo> e2e`, the *product repo's own* `.sandcastle/provision-e2e-stack.sh --check`, per your 2026-08-22 split. The factory knows nothing about any product's stack; it invokes the hook. A repo claiming e2e with no hook fails **loud**, rather than silently downgrading to pool-only. - **log egress (GOTCHAS 1)** — the logdir must be writable and every managed line must ship *both* streams into it. Proven at enrolment, not assumed. **3. The kill switch is per host and actually gates the cron lines** — each is prefixed `[ -e "<killswitch>" ] || { … }`. The braces are the whole point: `[ -e ks ] || . env && cmd` parses as `(([ -e ks ] || . env) && cmd)`, which runs the command **exactly when the switch is present**. The rendered shape is pinned by a test that *executes* it both ways in `/bin/sh`, and the inversion was demonstrated in dash on this host before the live install. **4. `SESSION_RUNNER=on|off`** landed in `policy-lib.sh` per your 2026-08-22 addendum: on by default for every factory repo, opt-out asked once at setup, validated like the other enums, writable by `onboard.sh policy`. The render honours it by **reading** — never sourcing — the repo's `swarm-policy.sh`. Your "pick ONE convention" ruling is enforced by the schema comment: `session` points at a dedicated checkout, never a tree the swarm resets mid-run. **5. Retire's order is its safety property.** Kill switch **first** (so the drain is bounded — a host still claiming can never finish draining), wait out in-flight claims, and only then stamp `retired <UTC>` and re-install, which renders an *empty* managed block. A timed-out drain **fails and leaves the host fully installed**: half-retired — no schedule, live claims — is the one state worse than either end. The entry is stamped, never deleted; re-enrolment is flipping `status` back to `active`. ### Proof - **Full offline suite green, 64 files.** New `onboarding/tests/onboard-host-lib-test.sh` (65 cases — every host fact shimmed: docker, df, crontab, the runner service, the tracker); `host-state-lib-test.sh` 55 → 94; `tests/policy-lib-test.sh` +5. - **`matou-workstation` retrofitted live, no behaviour change.** 16-check preflight PASSED, enrolled, `verify` green, second enrol byte-identical. The *only* crontab delta is the kill-switch guard — absent switch = identical behaviour, proven in dash both ways before installing. `host-capacity.env` written (2 heavy + 2 light slots, `drive-exclusive all` per ADR 0003). - **Self-test on the box**: ran a served repo's own vendored `tests/host-capacity-lib-test.sh` (13 groups) from its checkout. - **Claim probe**: opened, claimed, proved the claim carries `matou-workstation`, and closed synthetic ticket #39. It is closed and unlabelled — no queue litter. - **Retire drained against this host's REAL in-flight claims** (both pooled slots genuinely held at the time): it set the switch, refused to finish, left the schedule installed and the registry unstamped — then completed against a byte-copy of the real crontab once the locks were free. The live crontab was verified byte-identical throughout (`/usr/bin/crontab -l`, absolute path — the shim was on PATH). - **One live finding fixed while retrofitting**: the warm-store check must NOT apply to session-runner checkouts — a session runs Claude in place and never mounts a store, and both live session checkouts are cold, correctly. Pinned by a test case. `Matou/matou-app`'s coverage is recorded `pool`, not `e2e`, until it ships `.sandcastle/provision-e2e-stack.sh` (`Matou/matou-app#57`) — by your own rule that a repo without the hook is pool-only on a host. ## Why human Three acceptance items are **not** proven, and each is a one-way door or a missing door, not a gap in the mechanism: 1. **"A fresh machine goes from bare ssh to claiming via `onboard-host` alone."** Needs (a) a machine — none is available to this session; (b) a **rootful docker cutover / subuid configuration**, which is privileged, host-wide and not revertible by a commit; (c) a **Forgejo runner registration token**, a personal credential ADR 0174 rule 2 reserves for a human. The code path exists and is offline-tested (`runner-register` registers under the declared name and labels, is idempotent against an existing `.runner`, and refuses without the token rather than prompting) — what is missing is the box and the credential, not the script. 2. **"The registry file exists for every active host."** `matou-workstation` is done. **`elitebook-03` cannot be reached from here** — no ssh door, and the pool hosts cannot reach each other (your 2026-08-20 note). Its retrofit is the same five minutes of work run from that box, or from a laptop with both doors. 3. **"Retire drains cleanly on a live host with a claim in flight."** The drain half is proven against this host's real in-flight claims (above). Actually *decommissioning* a live pool host is fleet-affecting: it stops the machine that carries all three repos' schedules. That is a deliberate operational act, not an unattended one. Also worth a human eye, though not blocking: `matou-app`'s e2e coverage flip waits on `Matou/matou-app#57`'s hook, and the SESSION_RUNNER knob is a root change, so it reaches the running copies only at the next re-vendor (GOTCHAS 4). Relabelled `ready-for-human`. Everything two-way is landed, pushed and proven.
Author
Owner

Closed 2026-10-21 (Ben's stale sweep): the mechanism landed 2026-08-23 (6934f82, ADR 0005) and the fresh-machine acceptance it owed was proven on 2026-10-17 when onboard-host enrol ran on a clean /tmp on elitebook-03 and matou-workstation (#218/#222). bens-mac-04's enrol is tracked on #222.

Closed 2026-10-21 (Ben's stale sweep): the mechanism landed 2026-08-23 (`6934f82`, ADR 0005) and the fresh-machine acceptance it owed was proven on 2026-10-17 when `onboard-host enrol` ran on a clean /tmp on elitebook-03 and matou-workstation (#218/#222). bens-mac-04's enrol is tracked on #222.
ben 2026-10-21 14:16:36 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/dev-factory#6
No description provided.