deploy-files: unescaped ${komiti_grp#komiti_} in files.nix reds every deploy at Nix eval #1443
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
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
Matou/idss#1443
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?
The failure
The drive got all the way to the last leg and died there.
artifacts/verdict.json:This is NOT the known own-VPS pairing frontier.
pairis green (144 ms) andlegs.jsoncarries zero skips — no skip reason names this. It is a fresh, specific defect.The one red leg,
artifacts/legs.json:Same string in
artifacts/journey.json(rows[20].errorand top-level"fault"), in the Playwrighterror-context.md, and on the box's own journal —logs/droplet-journal.txt:1994:Root cause — found on the live box, traced to source
The live box at
168.144.173.229answered (read-only).systemctl --failedis empty and nothing crashed — the preflight refused to evaluate, so nothing was ever built. Corroborated:systemctl list-units '*nextcloud*' '*phpfpm*'returns nothing andss -tlnpshows no files stack (only kanidm:8443, caddy:80/443, control-plane:8080, netbird). The failure is pure Nix evaluation, not a runtime unit.The offending line,
/srv/idss/config/machines/gateway/files.nix:211-215on the box:The body is a Nix indented string (
''…'') — line 211's${config.services.nextcloud.occ}proves${is live antiquotation here. Line 214's${komiti_grp#komiti_}is meant as bash parameter expansion, but Nix eats it first and looks for a Nix binding namedkomiti_grp→undefined variable 'komiti_grp'. Lines 213 and 215 are safe because they use$(…)and brace-less"$komiti_grp"; only the one brace form on 214 trips it.The generator is in-repo —
internal/clan/files.go:865:This is the
#1409komiti-ocgroups backfill block (commit4b30dbf6), andgrep -c "''\$" machines/gateway/*.nixon the box returns 0 for every file — this repo had no escaped-antiquotation precedent, so the new bash brace expansion is the first one and it was never escaped.Why CI did not catch it
internal/clan/files_test.go:700asserts the generated text contains the literal:That is a substring check over a Go string that is never handed to Nix, so the test passes on exactly the byte sequence that makes Nix fail. The test currently pins the bug in place.
Suspected layer
Product — a defect in IDSS's own clan-config generator (
internal/clan/files.go), shipped by#1409. Not harness, not infra: the harness reported the real error verbatim with the right leg attribution, and the droplet is healthy with zero failed units. The blast radius is total for this path — the eval preflight excludes the node, so every files deploy on every community reds, including a founding community with no komiti at all (the empty-safe guard at runtime never gets a chance to run, because evaluation dies before build).What plugging it needs
internal/clan/files.go:865— in a Nix indented string the escape is''${: (Equivalent brace-free alternative, matching the surrounding style:komiti_bare="$(printf '%s' "$komiti_grp" | sed 's/^komiti_//')".)internal/clan/files_test.go:700to expect the escaped form.nix-instantiate --parse/--evalover the renderedfiles.nix) rather than substring-matching it. A string-equality test over generated Nix cannot catch an antiquotation collision, and this class of bug will recur the next time a bash${…}is added to any generated script.internal/clan/for unescaped bash${…}inside emitted Nix strings — this was the first such form in the tree, so there may be more landing behind it.drive
20260912T144514Zred atdeploy-files:deploy failed (clean-retry): provision: deploy gateway: clan: config_eval on gateway: the node was excluded at the eval preflight — nothing was deployed: error: error: undefined variable 'komiti_grpevidence:
/home/swarm/session-runner/idss/test-results/drive-droplet/20260912T144514Zon matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was capturedAgent Brief
Category: bug
Summary: The komiti-ocgroups backfill script (#1409) emits an unescaped bash parameter expansion inside a Nix indented string, so Nix reads it as antiquotation and every files deploy reds at eval with
undefined variable 'komiti_grp'.Verified (triage reproduced against source): confirmed. In
internal/clan, the files-stack generator writes the backfill block into a Nix indented (''…'')script— the same block also emitsocc=${config.services.nextcloud.occ}/bin/nextcloud-occ, proving${is live Nix antiquotation there. The generator then emitskomiti_bare="${komiti_grp#komiti_}"intending bash parameter expansion, but Nix consumes the${…}at eval time and fails on the non-existent bindingkomiti_grp. The eval preflight excludes the node, so nothing is built — the runtime empty-safe guard never runs, and the blast radius is total: every files deploy on every community reds, including a founding community with no komiti at all. No''${(escaped-antiquotation) form exists anywhere in the generator today — this is the first bash brace-expansion emitted into a Nix string in the tree, and it was never escaped.Current behavior:
The generated
files.nixfails Nix evaluation (undefined variable 'komiti_grp') at the deploy preflight. The node is excluded before build; no unit crashes (the box is healthy —systemctl --failedempty), because evaluation dies before anything is built.Desired behavior:
The generated files-stack
scriptevaluates cleanly. Thekomiti_bareassignment must reach the shell as literal bash${komiti_grp#komiti_}(strip thekomiti_prefix from$komiti_grp) rather than being consumed by Nix. Deploy succeeds; the existing empty-safe backfill path runs at runtime as designed.Key interfaces / what to change:
internal/clan, the function that emitsbackfill_komiti_ocgroups). Escape the antiquotation so Nix passes the${…}through to bash — in a Nix indented string the escape is''${, so the emitted line becomeskomiti_bare="''${komiti_grp#komiti_}". (Equivalent brace-free alternative matching the surrounding style:komiti_bare="$(printf '%s' "$komiti_grp" | sed 's/^komiti_//')".)nix-instantiate --parse) the renderedfiles.nix, so an antiquotation collision fails the test. A string-equality test over generated Nix cannot catch this class, and it will recur the next time a bash${…}lands in any generated script.Sibling sweep (item 4 from the report — triage pre-checked): the only other
${…}in an emitted script that isn't obviously${config.…}issecret="$(cat ${…})", where the${…}resolves toconfig.clan.core.vars.generators.….path— a legitimate, intended Nix antiquotation (it yields the secret file path at eval,catreads it at runtime), not a bug. Sokomiti_bareis the only genuine offender in this generator today. Still re-run the sweep after the fix in case anything landed behind it.Acceptance criteria:
files.nixevaluates withoutundefined variable 'komiti_grp'.komiti_bareis computed at runtime by bash (prefixkomiti_stripped from$komiti_grp), producing the same claim-map write as intended by #1409.files.nixand fails on an antiquotation collision (not a substring match).Out of scope:
pairwas green and no skip names this; this is a separate, fresh defect.Ruled by agent under ADR 0174 — veto anytime
Ruling:
bug+ready-for-agent+priority.Why a two-way door: the fix is a one-line escaping change (plus a test) in the in-repo generator, fully revertible by a later commit and provable by an existing/added test that Nix-evaluates the output. It touches none of the one-way-door list — no personal credentials, no security-posture widening, no member-facing trust accept, no data destruction, no non-routine spend. No UI surface, flow, or wireframe is referenced, so no
needs-design.Why
priority: the eval failure excludes the node before build, so the blast radius is total — every files deploy on every community reds, including founding communities with no komiti. This regression blocks the deploy path outright, so it outranks ordinary backlog. Remove by hand when it lands.What proves it: a green files deploy at the
deploy-filesleg, and the new Nix-eval test failing on the pre-fix output and passing on the fixed output.swarm-claim host=matou-dev-server-01 run=22579
(automated multi-host claim — lowest live claim id works this ticket)
close-report for #1443 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope