self-hosted deploy-takeover reds real: gateway missing_var (secret not generated) despite ADR 0126's generate-before-eval guard #626
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.
Dependencies
No dependencies set.
Reference
Matou/idss#626
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?
Discovered as a side effect of diagnosing #625 (ports-honest final-assertion race, fixed in
e101413b... see that ticket's close-report). Once #625's fix lands, the very nextselfhostedrehearsal drive will very likely advance pastports-honestfor the first time ever and hit THIS as the new red, one leg deeper:deploy-takeover.Evidence (same drive,
test-results/drive-selfhosted/20260821T010253Z/logs/founding-state.logon matou-workstation): the reachability leg genuinely passed (reaches your machine on ports 80, 443), name-wiring succeeded (rehearsal-b.idss.nz now points at 134.199.147.194),step: deployingbegan — then:The app surfaces this honestly (deploy-failed screen,
no_rollbackwarning, resume/reinstall/rescue-boot options per ADR 0024) — this is not a false green, it's a genuine deploy failure on the live droplet. This is also the FIRST drive in the #622→#623→#624→#625 chain to ever reachdeploy-takeoverat all, so this failure mode has never been exercised live before.Why this looks like a real bug, not flakiness:
internal/clan/enrollment.go's own docstring (ADR 0126 / issue #398, "Ben's ruling 2026-08-04 live-drive fix") sayspreflight()runsvars generatefor the node before the eval gate specifically to prevent this exactmissing_varclass ("on a fresh node the eval failsmissing_varunless the secrets already exist — generation must lead the gate, not trail it"). That guard evidently ran (VarsGenerated-gated,e.generate—clan vars generate <node> --flake ... --no-sandbox) but the machinegateway'ssops.defaultGroups/sops.secretUploadDirectoryvars were still missing at eval time.Untested hypothesis worth checking first:
generate()(enrollment.go ~L660) invokesclan vars generate <string(s.Node)> ...—s.Nodeis the enrollment's node ID (this drive:node-req-0001, per founding-state.log's spec-gate event). The missing-var eval excerpt names the machinegateway, notnode-req-0001. If the self-hosted takeover path's node id and its clan-flake machine name diverge,vars generatewould silently generate (or find already-generated) vars for the wrong/no machine, leavinggateway's own required secrets ungenerated — while ADR 0126's own fix was proven correct for whatever path #398 originally covered (comment says "the own-VPS enroll-configure red"), i.e. this may be a self-hosted/manual-install-specific gap the own-VPS fix never covered. Needs a source-level read of how the self-hosted full-install path names/derives the node vs. the flake machine, and how own-VPS differs.Scope note: deliberately NOT fixed under #625 — different subsystem (clan/nix secrets generation vs. a Playwright spec assertion), needs its own root-cause investigation before a two-way-door ruling. Filing separately per ADR 0174 sequencing (same shape as #622→#623→#624).
Before fixing: verify the
missing_varlabel is real — it may be a classifier false positive.internal/clan/errors.go:218-231returnsFailMissingVarwhen the output merelyContains("sops")(alongside the precise "couldn't find var"/"missing var" phrases). The captured excerpt here is ONLY the clan CLI's two$ clan select …?sops…subprocess-trace lines — which clan echoes on many failure paths — and the real error line(s) after them were not kept; the raw clan stderr is not persisted anywhere on matou-workstation (searched). So the actual failure could equally be a config-eval error (rebrand fallout in the generated clan config is a strong suspect:ce9f96drenamedourcloud-*units/paths/module; the last GREEN deploy on any path wasdrive-droplet 20260815T055256Z, pre-rebrand) or the pinned CLI rejecting the?-optional selectors. The node-ID-vs-gatewayhypothesis above is worth testing too — but get the raw output first: re-run the sameclaninvocation against the founding's clan repo and read past the trace. Whatever the cause, please also narrow the classifier (drop bare"sops"/"vars generate"substrings; add a test with this exact two-line excerpt expecting NOTFailMissingVar) and make the excerpt keep the lines after the$trace. Drive20260821T013253Z(onaa9de31b) reproduced this exactly: 9/10 green, red atdeploy-takeover— the reporter filed it as #627 (same evidence, head-start there).Ruled by agent under ADR 0174 — veto anytime.
Ruling: two-way door, fixed in-session. A code change (
internal/founding/selfhostedpath.go), revertible by commit, provable by an existing test class (the scriptedclan.testing.Fakeseam already trusted for the private path's identical #313/ADR 0126 guard) plusgo build/go vet/fullgo test ./.... No credentials, no security-posture widening, no destructive action, no member-facing trust surface.Root cause. The ticket's own node-id-vs-flake-machine-name hypothesis was checked first and disproven:
selfHostedNode = clan.NodeID("gateway")(internal/founding/selfhostedpath.go) rides straight intoEnrollRequest.Node— identical to the own-VPS/private paths' own"gateway"machine name, no divergence.The real gap:
seedCommunityConfig(internal/founding/privatepath.go) is the only caller anywhere in the app of bothclan.Adapter.SeedCommunity(landsflake.nix, ADR 0126 point 1) andclan.Secrets.EnsureOperator(registers the operator as a sops admin, #313) — and it is wired into exactly two of the three live founding paths (private VMprivatepath.go:464, own-VPSownvpspath.go:346), never self-hosted (selfhostedpath.go'scomposeSelfHostedGateway). A self-hosted community's config repo is provisioned bare (mkdir + git init— the same starting state ADR 0126/#398 found for the private path at Phase A), so:clan vars generate/eval cannot resolve a machine's secret-var sops recipients (clan.core.sops.defaultGroups/secretUploadDirectory) without a registered admin (#313: "without an operator age key registered as a sops admin,clan vars generate... fails ... on every clean machine").This matches the drive's excerpt exactly, and explains why this is the FIRST self-hosted drive to ever reach
deploy-takeoverat all — nothing upstream of it depended on the flake or the sops admin existing.Fix.
composeSelfHostedGatewaynow callso.clan.SeedCommunity(ctx, clan.CommunityMeta{Slug: d.Details.Slug})ando.clan.Secrets().EnsureOperator(ctx)before the clanEnrollcall — mirroring the own-VPS/private paths' own guard. Both calls are idempotent no-ops on a resume. No new journey/UI row: the compose already bundles seed+bootstrap+enroll behind its one existing "gateway machine dir composed" log line, so this is not a design-tier change.Proof.
TestSelfHosted_SeedsTheCommunityFlakeAndBootstrapsTheOperatorBeforeComposing(internal/founding/selfhostedpath_test.go) — confirmed red against the prior code (SeedCommunity calls = 0, want 1), green after the fix.go build ./...,go vet ./...clean.go test ./...green (including allinternal/foundingandinternal/clansuites, self-hosted/own-VPS/private path tests unaffected).gofmt -lclean on touched files.Not re-proved by a fresh live drive this session — same constraint as #622–#625:
scripts/rehearsal-cycle.shholds/tmp/matou-session-runner.lockexclusively and this session holds it for its own duration. The next unattendedselfhostedrehearsal drive is the live proof (it should now passdeploy-takeover's eval preflight and reach whatever leg comes next).Landed in
25c9cb5e(advances #626,STATUS.mdupdated in the same commit). Closing.