factory design: factory onboard <repo> — the repo onboarding process (e2e setup is a mandatory question) #572
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Depends on
Reference
Matou/idss#572
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
factory onboard <repo>— a script/skill that takes a repo from zero to swarm-driven, replacing today's implicit "copy ourcloud and patch" (survey:docs/research/2026-08-15-factory-reengineering-survey.md).What it must produce, per the survey's seam map:
prompt.md:209's literal label ids are a live cross-project hazard to retire)runs-onand server URL parameterized (todaygit.matou.nzis hand-built in 4 workflows two lines below wheregithub.server_urlis already available;runs-on: elitebook-03is a committed machine name)swarm-identity.sh(repo slug, API base, paths, drive-issue knob)secrets/, which are per-host;.envcarries the Claude token ONLY)prompt.mdskeleton — the shared method sections vs the per-project asset (ourcloud's is 246 lines of project method; that's correct, but there's no skeleton to start from)Needs Ben: mandatory-vs-optional at onboard, channel policy, and whether onboarding lives as a skill (like setup-matt-pocock-skills) or a script in the factory repo. Blocked by the driver-contract ticket and shaped by the topology ruling.
Ben ruled (2026-08-19, live session): the factory block is delegated under ADR 0174 — dispatched to the agent/session lanes with dependency edges wired; veto via the tracker anytime.
Ruled by agent under ADR 0174 — veto anytime. Ben's 2026-08-19 comment
delegated the factory block (including this ticket's "Needs Ben" asks) to
the agent/session lanes.
Rulings
1. e2e setup — mandatory question. Already resolved by #570's driver
contract (
docs/agents/e2e-driver-contract.md, "Onboarding tiers (feeds#572)"): a repo declares one of
journey/smoke/opt-out, andopt-outneeds a recorded reason — "a declared gap, not a silent one".#572 adopts this as-is; implemented as
onboard.sh e2e-tier, which refusesto write a tier file without an answer and refuses
opt-outwithout areason. Two-way door: a tier file is a commit, reversible by editing it.
2. Skill vs. script. A script in
Matou/dev-factory, not a Claudeskill. Onboarding here is mechanical — mint labels, render templates,
generate an identity file — not a judgment-heavy interview like
grill-ux-with-docs. It needs to be independently testable offline(this repo's own bar,
CLAUDE.md: "every lib change updates its test inthe same commit") and callable from CI later; a markdown skill can't
carry that. Two-way door: it's a new file in a repo, reversible by
deleting it.
3. Mattermost channel policy. One channel per onboarded repo
(
factory-<repo-slug>), replacing today's single shared channel thatserves every project. Two-way door: channel creation/rename is
reversible, and
MATTERMOST_CHANNEL_IDis already a per-repo org secret,so this is a policy change, not a schema change.
What landed
Matou/dev-factoryPR #5 (Matou/dev-factory#5):onboarding/onboard.sh+onboard-lib.sh, five independent idempotentsubcommands covering the survey's seam map —
labels(dynamic ids,retires the
prompt.md:209-class literal-id hazard),workflows(all 6repo workflows templated; fixes both named hazards — the git remote now
derives its host from
github.server_urlat run time instead of ahand-built
git.matou.nz, and everyruns-on:is a render-time paraminstead of a committed machine name),
identity(swarm-identity.shgenerator),
secrets(checklist matching ourcloud's live.env-carries-Claude-token-only /secrets/*-file invariants),dockerfile(harness layer + marked per-stack section), ande2e-tier(ruling 1, above). 29 new offline checks, full existing
tests/*.shsuite still green. Exact scope + what's deliberately deferred (prompt.md
skeleton templating — dev-factory's own separately-tracked follow-up):
onboarding/README.mdin that PR.Why this session can't close #572
Two residues only the human can clear:
swarm-bot's Forgejo token has pull-onlyaccess to
Matou/dev-factory(push: falsevia the API — confirmedlive: a direct push was rejected,
refs/for/mainAGit is the onlypath this session had). Every sibling repo (
Matou/ourcloud) gives thebot push; the org-transfer likely didn't carry the team permission
over. Needs either a permission fix (so future sessions aren't
PR-only here) or a by-hand merge of #5.
"runner registration + one smoke ticket end-to-end" — that needs an
actual second repo to onboard against. None was named this session.
Matou/matou-app(already on pre-extraction copies per dev-factory'sSTATUS.md, re-vendor owed) is the obvious candidate if re-onboarding
it counts as the acceptance test — otherwise, name the target.
Everything else in the ticket's "What it must produce" list is landed in
PR #5 or explicitly scoped out with a reason. Relabelling
ready-for-humanfor exactly these two residues; the rest of the ticketis done pending the merge.
Why human
Merging PR #5 (or fixing
swarm-bot's permission onMatou/dev-factory)is Ben's hands — a repo/org permission change or a merge-button click
this session's credentials can't do. Naming the acceptance-gate target
repo is Ben's call — which repo becomes "project #3" isn't this session's
decision to make blind.
RULED by Ben, 2026-08-19: the acceptance target is
Matou/matou-app.That clears the last human residue on this ticket (the other — swarm-bot's pull-only access to
Matou/dev-factory— was fixed tonight: Ben added the bot to the orgmachinesteam, write on all Matou repos; PR 5's mechanics were hand-merged ase2506caand the repo's founding docs landed, soonboarding/onboard.shis onmain).The acceptance run this ticket's gate asks for, now fully session-shaped:
onboard.shend-to-end againstMatou/matou-app— labels (dynamic IDs), workflows (templated, render-timeruns-on), identity, secrets checklist, dockerfile, and the mandatorye2e-tieranswer. matou-app is still on pre-factory harness copies, so this run doubles as its owed re-vendor to a pinnedFACTORY_REF.onboard.shcan't do that the run reveals → follow-up tickets inMatou/dev-factory(its tracker now has a working bot; mind that its label set gets minted by this very run'slabelsstep precedent).Note for the running session: matou-app's existing
.sandcastle/predates the factory — treat the onboarding as a migration (diff what the old copies carried vs. the vendored set; anything matou-app-specific belongs in its identity layer, not lost). The canonical-runner note in ourcloud #250 and matou-app's forked orchestrator copy are the two known bodies to retire.Labels:
ready-for-human→ready-for-session.Ruled by agent under ADR 0174 — veto anytime. Ben's 2026-08-19 ruling named
Matou/matou-appas the acceptance target and asked for the onboard run +runner-registration/smoke-ticket gate; this session did the run.
What landed
Onboarding artifacts against
Matou/matou-app(matou-app commits237a614/5e96ef8merged as PR #40,569868c,0ab72b4):had #571's pre-factory push-model harness-sync copies (
ourcloud@839e606)— never migrated to the pull model, one of the "two known bodies to
retire" from #571's STATUS entry.
FACTORY_REF/FACTORY_MANIFESTadded,pinned to
Matou/dev-factory@b7d9002; 47 factory-owned files vendoredbyte-identical for the first time (worktree fence, protected-paths gate,
close-report, session-runner, swarm-db, rehearsal-heal/report — matou-app
had none of these safety mechanisms before), 19 stale sed-copies
re-synced.
check-harness-drift.sh: OK.ready-for-session,deferred,priority,model-*were missing).(
matou-workstation/swarm/matou-workstationfor host/swarm/smoke —matching the runner's actual registered labels;
elitebook-04fromonboard.sh's own README example is a stale hazard, not reused).ci.yml's real seam step (raw-clone checkout + docker sandboxbuild/test) and matou-app's known actions/checkout fix (
d18d869) werehand-merged back into the templated skeleton — the placeholder would
have reded every push. New:
swarm-smoke.yml.(
onboard.sh dockerfileonly covers one stack — filed as a dev-factoryfollow-up), merged in the harness layer (git-fence,
OURCLOUD_SANDBOX).docs/SECRETS_CHECKLIST.mdgenerated.E2E_TIER: opt-out, reasoned — no driver satisfies the six-clausecontract yet;
pr-e2e.ymlis PR-scoped feature e2e, not a standingjourney/smoke driver. Follow-up filed in
Matou/matou-app(#41).swarm-identity.sh: already matchedonboard.sh's generated shapefrom #571 — left as-is.
Runner registration: confirmed the shared instance-level runner
(
matou-workstation/swarmlabels) already covers matou-app — it wasalready processing matou-app's workflows historically. Did not
re-register (that's a live, shared-across-repos runner ourcloud and
dev-factory also depend on; re-registering risks disrupting it for no
benefit — a fresh registration was never the gap).
The smoke-ticket acceptance gate.
swarm-smoke.yml— the template'sown named #572 gate — reds on this host: its rootless-Docker check
(
docker info | grep rootless) doesn't match, because this host runsplain rootful
dockerd(confirmed live, pre-existing, host-wide — notmatou-app-specific, not something #572 should paper over by weakening the
check). Proved the gate's actual intent instead: dispatched
swarm.ymlagainst the real ticket queue. That live run surfaced two real bugs any
future onboard target would have hit identically:
run-swarm.sh's pnpm-store cold-start guard (GOTCHAS #20/#489) and itsunconditional root
pnpm install --frozen-lockfileassume every repoalready pnpm-installs at the root (true for ourcloud, never true for
matou-app's npm-only harness root). Fixed: converted matou-app's root to
pnpm (
pnpm-lock.yaml,pnpm-workspace.yamlwithallowBuilds.esbuild,.npmrcwithconfirm-modules-purge=false— mirroring ourcloud's ADR0040 files exactly) and pre-warmed the host's
.sandcastle/pnpm-store.pnpmglobally, somain.mts'sin-sandbox root install died
pnpm: not found(exit 127) before asingle worker could spawn. Fixed:
RUN npm install -g pnpm@11.6.0.Both fixes verified live: a real
swarm.ymldispatch went all the waythrough preflight (7/7 guards on real fixtures) → real ready-task listing
(5 real queued tickets) → model resolution → pnpm install → a clean docker
build → git worktree isolation + the D3 protected-paths fence → a real
authenticated Claude agent launch → real Forgejo API calls (issue/PR/review
reading) + git operations inside the sandbox → correct code analysis of
the Go backend → and a correct
needs_human_decisionescalation viaask-human.shon a genuine scope fork it found on issue #19 (anin-flight PR with an unresolved human review, versus the ticket's own
documented crypto-verifier contract) — exactly the mid-task human-ask path
prompt.md rule 5 exists for. This is the full pipeline mechanically
proven end to end, not just claimed.
.sandcastle/tests/*.sh: 39/41 green on matou-app. The 2 reds(
judgement-call-prompts-test.sh,session-runner-test.sh) are per-repoprompt content a fresh onboard target doesn't have yet — same "too
high-blast-radius to rush" deferral already ruled on this ticket for the
prompt.md skeleton itself. Left red rather than force matou-app's live
prompt.md into ourcloud's exact rule-numbering, or hand-author placeholder
prompt content for a mechanism (standing sessions) matou-app doesn't use.
Two
Matou/dev-factoryFACTORY_MANIFESTgaps found and fixed(dev-factory#7, dev-factory#8):
tests/fixtures/*andtests/fakebin/curlwere never listed despite being depended on by manifested tests — fixed on
ourcloud's own
FACTORY_MANIFESTtoo (both byte-identical to dev-factory,zero drift, just an omission —
698f5c4);onboard.sh dockerfileonlycovers one stack, no multi-language mode.
What's NOT done — residue, doesn't block close
factory-<repo-slug>, ruled on thisticket 2026-08-19) still can't be scripted: no live Mattermost
admin-capable token was available to this session either (same as the
prior session). matou-app keeps the shared channel until a human creates
factory-matou-app, adds the bot, and mints the org secret.swarm-smoke.yml's rootless-Docker assumption doesn't hold on thishost. Not fixed here (host docker-daemon posture is out of this ticket's
scope and affects ourcloud/dev-factory identically, not matou-app-
specific) — worth its own look at whether rootless was ever actually
standing here or the check itself is stale.
Matou/matou-app#41: build a six-clause e2e driver soE2E_TIERcanleave
opt-out(already triaged by matou-app's own triage.yml toready-for-human— a real judgment call, correctly routed).Full detail in
Matou/matou-app's onboarding-branch commits and STATUS.md(
698f5c4).Ben's veto, 2026-08-20 (ADR 0174 veto clause): the channel-per-repo Mattermost policy ruled here on 2026-08-19 is reversed — all onboarded repos share the one factory channel. No channel creation, no admin token needed; notifications self-identify by repo slug. Recorded in
Matou/dev-factoryonboarding/README.md. This clears the last Mattermost residue from this ticket's close report.