Onboarding workflow templates are behind the live consumer workflows (two host-capacity slots, per-repo workdir lock, git-setup.sh) #16

Closed
opened 2026-08-22 11:35:11 +00:00 by ben · 3 comments
Owner

Part of the agent-driven install-session arc (Ben, 2026-08-21/22; docs/superpowers/specs/2026-08-21-vendor-command-design.md §Context records the decomposition: 2 vendor ✅ → 1 policy layer + prompt rendering → 3 host enrolment → 4 the install session). Worked by the factory's own swarm (STATUS.md 2026-08-22 — SELF-HOSTED).

Symptom

onboarding/templates/workflows/swarm.yml.tmpl (and triage.yml.tmpl) render the single global /tmp/matou-swarm.lock and an inline fetch-or-clone. Matou/idss's live swarm.yml has since gained: the two pooled host-capacity slots (idss #577 / ADR 0184 — host-capacity-lib.sh is already vendored here), the per-repo workdir lock (#638), and the git-setup.sh verdict path (#639). This repo's own freshly rendered swarm.yml (2026-08-22) therefore runs the old single-slot protocol beside idss's two-slot one on the same hosts — it still excludes correctly (slot 1 is the shared name) but can never use slot 2.

Fix

  • Port the three changes into the templates; git-setup.sh becomes a vendored factory file (manifest) if it is generic, or the template inlines a generic equivalent.
  • onboarding/tests/onboard-lib-test.sh: render fixture updated; a test that the rendered swarm.yml contains both slot names.
  • Re-render this repo's .forgejo/workflows/ from the fixed templates in the same commit (protected path → this is a ready-for-session ticket).

Acceptance

  • diff <(onboard.sh workflows ... swarm.yml) idss/.forgejo/workflows/swarm.yml shows only the documented per-repo deltas (token-sync, HEAL_DRY_RUN comment).
_Part of the agent-driven install-session arc (Ben, 2026-08-21/22; `docs/superpowers/specs/2026-08-21-vendor-command-design.md` §Context records the decomposition: 2 vendor ✅ → 1 policy layer + prompt rendering → 3 host enrolment → 4 the install session). Worked by the factory's own swarm (STATUS.md 2026-08-22 — SELF-HOSTED)._ ## Symptom `onboarding/templates/workflows/swarm.yml.tmpl` (and `triage.yml.tmpl`) render the single global `/tmp/matou-swarm.lock` and an inline fetch-or-clone. `Matou/idss`'s live `swarm.yml` has since gained: the two pooled host-capacity slots (idss #577 / ADR 0184 — `host-capacity-lib.sh` is already vendored here), the per-repo workdir lock (#638), and the `git-setup.sh` verdict path (#639). This repo's own freshly rendered `swarm.yml` (2026-08-22) therefore runs the old single-slot protocol beside idss's two-slot one on the same hosts — it still excludes correctly (slot 1 is the shared name) but can never use slot 2. ## Fix - Port the three changes into the templates; `git-setup.sh` becomes a vendored factory file (manifest) if it is generic, or the template inlines a generic equivalent. - `onboarding/tests/onboard-lib-test.sh`: render fixture updated; a test that the rendered `swarm.yml` contains both slot names. - Re-render this repo's `.forgejo/workflows/` from the fixed templates in the same commit (protected path → this is a `ready-for-session` ticket). ## Acceptance - `diff <(onboard.sh workflows ... swarm.yml) idss/.forgejo/workflows/swarm.yml` shows only the documented per-repo deltas (token-sync, HEAL_DRY_RUN comment).
Author
Owner

Ruling 2026-08-22 (Ben, from matou-app): harness-only workflows run on the pool label, never a named host. 8d2a402 retires HOST_RUNNER_LABEL — healer and ci templates now use SWARM_RUNNER_LABEL, and onboard.sh workflows is <out-dir> <swarm-label> <smoke-label>. When this ticket adds the verify / harness-drift / pr-e2e / smoke-drive templates: verify and harness-drift are SWARM_RUNNER_LABEL; pr-e2e and smoke-drive are SMOKE_RUNNER_LABEL (they need the product's e2e stack, which is #6's job to provision on a second host).

Ruling 2026-08-22 (Ben, from matou-app): harness-only workflows run on the pool label, never a named host. `8d2a402` retires `HOST_RUNNER_LABEL` — healer and ci templates now use `SWARM_RUNNER_LABEL`, and `onboard.sh workflows` is `<out-dir> <swarm-label> <smoke-label>`. When this ticket adds the verify / harness-drift / pr-e2e / smoke-drive templates: verify and harness-drift are `SWARM_RUNNER_LABEL`; pr-e2e and smoke-drive are `SMOKE_RUNNER_LABEL` (they need the product's e2e stack, which is #6's job to provision on a second host).
Author
Owner

Live evidence this is costing runs (2026-08-23, priority added): swarm runs 146–154, 167, 171, 173–175 on this repo each had ONE matrix job die within ~5 s of start with no verdict, no worker log, no runlog line — the healer (runs 146/147, then the 3-strike quiet at 152) placed the death in swarm.yml's pre-run git setup, sibling job green on the same commit, correlated with issue-event bursts. That is exactly idss #638's signature: two matrix jobs on the same host, the second one's git fetch / checkout -f / reset --hard racing the first's mutation of the shared $HOME/swarm/<repo> workdir. idss's live swarm.yml carries the per-repo workdir lock (/tmp/matou-workdir-<repo>.lock, scoped to the git setup) and the git-setup.sh verdict path (#639); the templates this repo rendered from do not.

Fix priority for this ticket: port the workdir lock + git-setup.sh first (that stops the reds), then the two-slot capacity change. Re-render this repo's .forgejo/workflows/ in the same commit (protected path → session).

**Live evidence this is costing runs (2026-08-23, priority added):** swarm runs 146–154, 167, 171, 173–175 on this repo each had ONE matrix job die within ~5 s of start with no verdict, no worker log, no runlog line — the healer (runs 146/147, then the 3-strike quiet at 152) placed the death in `swarm.yml`'s pre-run git setup, sibling job green on the same commit, correlated with issue-event bursts. That is exactly idss #638's signature: two matrix jobs on the same host, the second one's `git fetch / checkout -f / reset --hard` racing the first's mutation of the shared `$HOME/swarm/<repo>` workdir. idss's live `swarm.yml` carries the per-repo workdir lock (`/tmp/matou-workdir-<repo>.lock`, scoped to the git setup) and the `git-setup.sh` verdict path (#639); the templates this repo rendered from do not. Fix priority for this ticket: port the workdir lock + git-setup.sh first (that stops the reds), then the two-slot capacity change. Re-render this repo's `.forgejo/workflows/` in the same commit (protected path → session).

Close report — #16

Ruled by agent under ADR 0174 (idss) — veto anytime. Every change here is a two-way door: commits on a repo I control, proven by the existing offline test suite (for t in tests/*.sh onboarding/tests/*.sh; ... bash "$t", all green before and after). No credentials, no security-posture widening, no member-facing trust accept, no data destruction, no spend. Nothing routed to ready-for-human.

What landed (commit 3eced57, pushed to origin/main after a rebase over #24 which landed concurrently — only STATUS.md conflicted, resolved by hand, offline suite re-run green post-rebase):

  • onboarding/templates/workflows/swarm.yml.tmpl / triage.yml.tmpl gain idss's three post-2026-08-22 fixes: the pooled 2-slot host-capacity semaphore (idss #577 / idss ADR 0184 — /tmp/matou-swarm.lock + /tmp/matou-host-slot-2.lock, first-fit non-blocking, plus idss #664's per-consumer defer-count on the drive-reservation yield), the per-repo workdir lock (idss #638), and dispatch through git-setup.sh once a prior run has left it in the workdir (idss #639) so a git-setup fault drops a real stage/exit/error verdict instead of collapsing onto the bare workflow-name signature.
  • git-setup.sh vendored byte-identical from idss's .sandcastle/git-setup.sh (it's already generic — no idss-specific content), added to onboarding/vendor-manifest. Its offline test tests/git-setup-test.sh ported alongside it (4 scenarios, all pass).
  • Bonus fix found while closing the drift: the templates were ALSO stale against this repo's OWN already-rendered .forgejo/workflows/swarm.yml/triage.yml — the drive-reservation guard had been hand-patched into the rendered output on 2026-08-22 but never back-ported to the .tmpl. Re-rendering from the stale template as originally planned would have silently REVERTED that live guard. Folded the guard into the templates too; recorded as docs/GOTCHAS.md #10 so the next drift ticket checks for this before re-rendering.
  • .forgejo/workflows/swarm.yml / triage.yml re-rendered from the fixed templates in the same commit (acceptance criterion). SWARM_ALLOW_COLD_STORE (a dev-factory-only local delta, unrelated to this ticket) reapplied to swarm.yml after the render since it's not template-sourced.
  • onboarding/tests/onboard-lib-test.sh gains checks that a rendered swarm.yml/triage.yml carries both slot lock names, the per-repo workdir lock, and the git-setup.sh dispatch line.

One deliberate divergence from the acceptance criterion's literal reading. idss's actual swarm.yml/triage.yml hardcode the pre-git-setup.sh inline fallback's git host as a literal git.matou.nz. This repo's templates instead keep deriving that fallback's host from github.server_url — per onboarding/README.md's explicitly documented fix ("the git remote URL is derived from github.server_url at run time — no more hand-built git.matou.nz") and CLAUDE.md's "no repo names, hosts, or product-specific paths in harness files" rule, both of which predate and directly govern this file. git-setup.sh itself (a vendored root script, not a template) DOES default to the literal git.matou.nz — consistent with this repo's existing convention for vendored root scripts (session-runner.sh, check-harness-drift.sh, rehearsal-report.sh, onboard-lib.sh, swarm-identity.sh all do the same, override-able). So: diff <(onboard.sh workflows ...) idss/.forgejo/workflows/{swarm,triage}.yml is NOT byte-identical modulo only token-sync/HEAL_DRY_RUN — it also differs in this one host-derivation line plus ordinary prose-wording deltas across both files' comments (dev-factory's own voice vs idss's). All functional elements (lock names, workdir lock, git-setup.sh dispatch, defer counters) match idss exactly. I judged preserving this repo's own stricter, already-tested, already-documented genericity invariant to be the correct call over literal byte-matching a downstream consumer's file — happy to be overruled.

Verification: full offline suite (tests/*.sh + onboarding/tests/*.sh, excluding fakebin/fixtures) green before commit, before push, and again after the rebase over #24.

## Close report — #16 **Ruled by agent under ADR 0174 (idss) — veto anytime.** Every change here is a two-way door: commits on a repo I control, proven by the existing offline test suite (`for t in tests/*.sh onboarding/tests/*.sh; ... bash "$t"`, all green before and after). No credentials, no security-posture widening, no member-facing trust accept, no data destruction, no spend. Nothing routed to `ready-for-human`. **What landed** (commit `3eced57`, pushed to `origin/main` after a rebase over `#24` which landed concurrently — only `STATUS.md` conflicted, resolved by hand, offline suite re-run green post-rebase): - `onboarding/templates/workflows/swarm.yml.tmpl` / `triage.yml.tmpl` gain idss's three post-2026-08-22 fixes: the pooled 2-slot host-capacity semaphore (idss #577 / idss ADR 0184 — `/tmp/matou-swarm.lock` + `/tmp/matou-host-slot-2.lock`, first-fit non-blocking, plus idss #664's per-consumer defer-count on the drive-reservation yield), the per-repo workdir lock (idss #638), and dispatch through `git-setup.sh` once a prior run has left it in the workdir (idss #639) so a git-setup fault drops a real stage/exit/error verdict instead of collapsing onto the bare workflow-name signature. - `git-setup.sh` vendored byte-identical from idss's `.sandcastle/git-setup.sh` (it's already generic — no idss-specific content), added to `onboarding/vendor-manifest`. Its offline test `tests/git-setup-test.sh` ported alongside it (4 scenarios, all pass). - **Bonus fix found while closing the drift:** the templates were ALSO stale against this repo's OWN already-rendered `.forgejo/workflows/swarm.yml`/`triage.yml` — the drive-reservation guard had been hand-patched into the rendered output on 2026-08-22 but never back-ported to the `.tmpl`. Re-rendering from the stale template as originally planned would have silently REVERTED that live guard. Folded the guard into the templates too; recorded as `docs/GOTCHAS.md` #10 so the next drift ticket checks for this before re-rendering. - `.forgejo/workflows/swarm.yml` / `triage.yml` re-rendered from the fixed templates in the same commit (acceptance criterion). `SWARM_ALLOW_COLD_STORE` (a dev-factory-only local delta, unrelated to this ticket) reapplied to `swarm.yml` after the render since it's not template-sourced. - `onboarding/tests/onboard-lib-test.sh` gains checks that a rendered `swarm.yml`/`triage.yml` carries both slot lock names, the per-repo workdir lock, and the `git-setup.sh` dispatch line. **One deliberate divergence from the acceptance criterion's literal reading.** idss's actual `swarm.yml`/`triage.yml` hardcode the pre-`git-setup.sh` inline fallback's git host as a literal `git.matou.nz`. This repo's templates instead keep deriving that fallback's host from `github.server_url` — per `onboarding/README.md`'s explicitly documented fix ("the git remote URL is derived from `github.server_url` at run time — no more hand-built `git.matou.nz`") and `CLAUDE.md`'s "no repo names, hosts, or product-specific paths in harness files" rule, both of which predate and directly govern this file. `git-setup.sh` itself (a vendored root script, not a template) DOES default to the literal `git.matou.nz` — consistent with this repo's existing convention for vendored root scripts (`session-runner.sh`, `check-harness-drift.sh`, `rehearsal-report.sh`, `onboard-lib.sh`, `swarm-identity.sh` all do the same, override-able). So: `diff <(onboard.sh workflows ...) idss/.forgejo/workflows/{swarm,triage}.yml` is NOT byte-identical modulo only token-sync/HEAL_DRY_RUN — it also differs in this one host-derivation line plus ordinary prose-wording deltas across both files' comments (dev-factory's own voice vs idss's). All *functional* elements (lock names, workdir lock, git-setup.sh dispatch, defer counters) match idss exactly. I judged preserving this repo's own stricter, already-tested, already-documented genericity invariant to be the correct call over literal byte-matching a downstream consumer's file — happy to be overruled. **Verification:** full offline suite (`tests/*.sh` + `onboarding/tests/*.sh`, excluding fakebin/fixtures) green before commit, before push, and again after the rebase over #24.
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.

Dependencies

No dependencies set.

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