enroll-configure: clan's path:<config-repo> flake ref makes nix ingest the live .git, so a mid-run repack reds vars generate (drive 20260828T051317Z, sig 25304f657c24) #923

Closed
opened 2026-08-28 05:38:55 +00:00 by matou-build-agent · 1 comment

Failure

Drive 20260828T051317Z (device target) redded at leg standing / journey row enroll-configure:

founding: stand up the rented server: clan: config_eval on gateway: the node's config does not evaluate: error:
error: path '//home/swarm/swarm/Matou/idss/test-results/standing-rented/state/clan-config/.git/objects/17/7ffd08eaf2d8c3628053a9f00e9605218b41e1' does not exist

artifacts/legs.json (8 green, 2 red), artifacts/verdict.json (firstRedLeg: standing, commit bd9796b5), logs/founding-state.log (last three enroll-configure events).

This is not a config fault. The exact revision the drive died on evaluates cleanly:

  • git -C <clan-config> rev-parse HEAD → ebb865a12fad630ed03cedd783237530425b772e
  • nix eval --raw "git+file://<clan-config>?rev=ebb865a…#nixosConfigurations.gateway.config.system.build.toplevel.drvPath" → /nix/store/qgvjha73pi5nff6028wkq9p12qydzfb2-nixos-system-gateway-26.11.20260612.173d0ad.drv, exit 0.
  • git fsck clean; git cat-file -t 177ffd08eaf2d8c3628053a9f00e9605218b41e1 → tree. The "missing" object is present — it is packed, not loose.

Diagnosis

Three facts, each verified on this machine:

1. The failing command was clan vars generate, not the eval preflight.
preflight (internal/clan/enrollment.go:619-669) runs e.generate(...) first, then Readiness. A preflight failure renders preflightInstruction (internal/clan/enrollment.go:1545-1551) and would have ended "…does not evaluate — fix it so the node evaluates, then re-drive" with StatusBlocked (resumable, no error returned). The captured message has no such tail and propagated as a hard fault, so it is failureEventMessage over a Classify result (internal/clan/errors.go:254-260) raised by generate at internal/clan/enrollment.go:787-789. That call site has no retry at all — the #461 bounded retry and the #542 transient-fetch hold live only on evalReadiness (internal/clan/adapter.go:658-690).

2. path:<dir> makes nix ingest the repo's live .git.
generate builds its flake ref with flakeRef(dir, "") (internal/clan/enrollment.go:752), which returns "path:" + dir (internal/clan/adapter.go:778-783). Verified: nix flake prefetch --json path:/tmp/heal-cold produced a store path that contains .git, with 117 loose-object fanout directories copied in. Nine call sites use this ref shape — internal/clan/vars.go:161, :229; internal/clan/enrollment.go:752, :1006, :1256; internal/clan/supply.go:55, :79; internal/clan/seedcommunity.go:109; internal/clan/store_count.go:155. So every clan invocation copies the entire git history — mutable state the same command is concurrently writing to.

3. The repo was fully repacked inside that window.
.git mtimes from the surviving state dir:

05:17:11.9256  refs/heads/master, logs/HEAD   <- clan's last commit ("vars: update via generator state-version")
05:17:11.9572  objects/pack/pack-42d24aa1….pack
05:17:11.9652  objects/pack/…​.idx
05:17:11.9712  objects/pack/…​.rev
05:17:11.9876  objects/pack/multi-pack-index
05:17:12.0047  objects/, objects/info/packs, info/refs

git count-objects -v → count: 0, in-pack: 133. Every loose object — including 17/7ffd08… — was deleted in that 48 ms window, ~30 ms after the final vars commit and inside the failing command. error: path '%s' does not exist is libnixutil's POSIX read error (confirmed with strings on determinate-nix-util-3.22.2/lib/libnixutil.so), i.e. nix was reading the loose-object file off disk when it vanished. Nix runs here with lazy-trees = true, so the ingest reads the live directory rather than a snapshot.

Suspected layer

internal/clan — the flake ref the adapter hands clan. The config repo is the single writer (ADR 0102) and path: puts its .git inside nix's ingest, so the repo's own git housekeeping is a hazard to any concurrent clan/nix run. The three-attempt eval retry does not cover it because the failure lands one call earlier.

Open and needed before a fix: who repacked. I ruled out, by test on this box:

  • nix — a cold-rev git+file:// eval left the source repo at packs: 0 (no repack).
  • clan-cli — its only git verbs are add / diff --cached / commit (clan_lib/git/__init__.py:76-130).
  • git auto-maintenance — neither /usr/bin/git 2.53 nor nix's git 2.54 repacks after commits at 183 loose objects.
  • hooks (all .sample), global/system git config (only user.*), scheduled git maintenance (none registered).

The artifact set (multi-pack-index + objects/info/packs + info/refs, no commit-graph) matches git repack -ad --write-midx followed by update-server-info. Nothing in this checkout, the drive checkout at bd9796b5, or the payload contains the string repack.

What plugging it needs

A ruling on which layer takes it — these are not interchangeable:

  1. Stop handing .git to nix. git+file://<dir> (no ?rev=) excludes .git and honours the working tree, but clan writes files and commits them mid-run (its CLAN_NO_COMMIT / --intent-to-add dance exists for exactly this), so untracked-file visibility has to be proven against a real clan run before the swap. Touches nine call sites.
  2. Give generate the transient hardening the eval preflight already has. Needs a discriminator scoped to <repo>/.git/objects/** — a bare does not exist match would spin on genuine config errors (a missing imported .nix prints the same shape), which is the fail-loud rule internal/clan/adapter.go:610-623 is written to protect.
  3. Find and stop the repacker, and/or pin gc.auto=0 / maintenance.auto=false in ConfigRepo.ensureStore (internal/clan/configrepo.go:114-125) as a belt-and-braces. On its own this is unproven — no git on this box auto-repacks at this object count.

Also seen in this run (separate, concrete)

The gateway-side evidence harvest cannot authenticate to a rented gateway. logs/gateway-journal.txt, gateway-caddy.txt, gateway-stall.txt, gateway-units.txt all read root@209.38.87.90: Permission denied (publickey,keyboard-interactive), while logs/gateway-do-forensics.txt proves the box was up and tcp/22: a FRESH connect succeeded. oc_droplet_evidence dials with no identity (scripts/lib/rehearsal-droplet.sh:450, :463, :477, :496, :537), but on the rented path the box only trusts the app's per-run key — the sibling harvester at scripts/lib/rehearsal-droplet.sh:980-981 already knows it as $run_dir/state/rent-operator/id_ed25519. Result: this red has zero gateway-side evidence. Offline seam tests exist for this surface (scripts/tests/device-evidence-order-test.sh, scripts/tests/droplet-evidence-order-test.sh).

The captured flake is not in the run dir. logs/state-logs.log reads ERROR: no state logs directory at …/standing-rented/state/logs, and the run dir's own state/ is empty. The repo this red is about survives only at the shared path test-results/standing-rented/state/clan-config — a trial-reset or the next drive destroys the only copy.

Healer history

Signature 25304f657c24 has now redded three consecutive drives. The two prior self-fixes (5c8f4c6e, 8b34ddeb) both landed on evidence-harvest surfaces, not on this fault. Filing rather than self-fixing: no line in this checkout is mechanically wrong, the candidate fixes are semantic changes I cannot verify against a real clan run here, and the repacking agent is still unidentified.

drive 20260828T051317Z red at standing: journey leg "enroll-configure" went red: founding: stand up the rented server: clan: config_eval on gateway: the node's config does not evaluate: error: error: path '//home/swarm/swarm/Matou/idss/test
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T051317Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure Drive `20260828T051317Z` (device target) redded at leg `standing` / journey row `enroll-configure`: ``` founding: stand up the rented server: clan: config_eval on gateway: the node's config does not evaluate: error: error: path '//home/swarm/swarm/Matou/idss/test-results/standing-rented/state/clan-config/.git/objects/17/7ffd08eaf2d8c3628053a9f00e9605218b41e1' does not exist ``` `artifacts/legs.json` (8 green, 2 red), `artifacts/verdict.json` (`firstRedLeg: standing`, commit `bd9796b5`), `logs/founding-state.log` (last three `enroll-configure` events). **This is not a config fault.** The exact revision the drive died on evaluates cleanly: - `git -C <clan-config> rev-parse HEAD` → `ebb865a12fad630ed03cedd783237530425b772e` - `nix eval --raw "git+file://<clan-config>?rev=ebb865a…#nixosConfigurations.gateway.config.system.build.toplevel.drvPath"` → `/nix/store/qgvjha73pi5nff6028wkq9p12qydzfb2-nixos-system-gateway-26.11.20260612.173d0ad.drv`, exit 0. - `git fsck` clean; `git cat-file -t 177ffd08eaf2d8c3628053a9f00e9605218b41e1` → `tree`. The "missing" object is present — it is **packed**, not loose. ## Diagnosis Three facts, each verified on this machine: **1. The failing command was `clan vars generate`, not the eval preflight.** `preflight` (`internal/clan/enrollment.go:619-669`) runs `e.generate(...)` first, then `Readiness`. A preflight failure renders `preflightInstruction` (`internal/clan/enrollment.go:1545-1551`) and would have ended `"…does not evaluate — fix it so the node evaluates, then re-drive"` with `StatusBlocked` (resumable, no error returned). The captured message has no such tail and propagated as a hard fault, so it is `failureEventMessage` over a `Classify` result (`internal/clan/errors.go:254-260`) raised by `generate` at `internal/clan/enrollment.go:787-789`. That call site has **no retry at all** — the `#461` bounded retry and the `#542` transient-fetch hold live only on `evalReadiness` (`internal/clan/adapter.go:658-690`). **2. `path:<dir>` makes nix ingest the repo's live `.git`.** `generate` builds its flake ref with `flakeRef(dir, "")` (`internal/clan/enrollment.go:752`), which returns `"path:" + dir` (`internal/clan/adapter.go:778-783`). Verified: `nix flake prefetch --json path:/tmp/heal-cold` produced a store path that **contains `.git`**, with 117 loose-object fanout directories copied in. Nine call sites use this ref shape — `internal/clan/vars.go:161`, `:229`; `internal/clan/enrollment.go:752`, `:1006`, `:1256`; `internal/clan/supply.go:55`, `:79`; `internal/clan/seedcommunity.go:109`; `internal/clan/store_count.go:155`. So every clan invocation copies the entire git history — mutable state the same command is concurrently writing to. **3. The repo was fully repacked inside that window.** `.git` mtimes from the surviving state dir: ``` 05:17:11.9256 refs/heads/master, logs/HEAD <- clan's last commit ("vars: update via generator state-version") 05:17:11.9572 objects/pack/pack-42d24aa1….pack 05:17:11.9652 objects/pack/…​.idx 05:17:11.9712 objects/pack/…​.rev 05:17:11.9876 objects/pack/multi-pack-index 05:17:12.0047 objects/, objects/info/packs, info/refs ``` `git count-objects -v` → `count: 0, in-pack: 133`. Every loose object — including `17/7ffd08…` — was deleted in that 48 ms window, ~30 ms after the final vars commit and inside the failing command. `error: path '%s' does not exist` is libnixutil's POSIX read error (confirmed with `strings` on `determinate-nix-util-3.22.2/lib/libnixutil.so`), i.e. nix was reading the loose-object **file** off disk when it vanished. Nix runs here with `lazy-trees = true`, so the ingest reads the live directory rather than a snapshot. ## Suspected layer `internal/clan` — the flake ref the adapter hands clan. The config repo is the single writer (ADR 0102) and `path:` puts its `.git` inside nix's ingest, so the repo's own git housekeeping is a hazard to any concurrent clan/nix run. The three-attempt eval retry does not cover it because the failure lands one call earlier. **Open and needed before a fix:** who repacked. I ruled out, by test on this box: - nix — a cold-rev `git+file://` eval left the source repo at `packs: 0` (no repack). - `clan-cli` — its only git verbs are `add` / `diff --cached` / `commit` (`clan_lib/git/__init__.py:76-130`). - git auto-maintenance — neither `/usr/bin/git` 2.53 nor nix's git 2.54 repacks after commits at 183 loose objects. - hooks (all `.sample`), global/system git config (only `user.*`), scheduled `git maintenance` (none registered). The artifact set (`multi-pack-index` + `objects/info/packs` + `info/refs`, no `commit-graph`) matches `git repack -ad --write-midx` followed by `update-server-info`. Nothing in this checkout, the drive checkout at `bd9796b5`, or the payload contains the string `repack`. ## What plugging it needs A ruling on which layer takes it — these are not interchangeable: 1. **Stop handing `.git` to nix.** `git+file://<dir>` (no `?rev=`) excludes `.git` and honours the working tree, but clan writes files and commits them mid-run (its `CLAN_NO_COMMIT` / `--intent-to-add` dance exists for exactly this), so untracked-file visibility has to be proven against a real clan run before the swap. Touches nine call sites. 2. **Give `generate` the transient hardening the eval preflight already has.** Needs a discriminator scoped to `<repo>/.git/objects/**` — a bare `does not exist` match would spin on genuine config errors (a missing imported `.nix` prints the same shape), which is the fail-loud rule `internal/clan/adapter.go:610-623` is written to protect. 3. **Find and stop the repacker**, and/or pin `gc.auto=0` / `maintenance.auto=false` in `ConfigRepo.ensureStore` (`internal/clan/configrepo.go:114-125`) as a belt-and-braces. On its own this is unproven — no git on this box auto-repacks at this object count. ## Also seen in this run (separate, concrete) **The gateway-side evidence harvest cannot authenticate to a rented gateway.** `logs/gateway-journal.txt`, `gateway-caddy.txt`, `gateway-stall.txt`, `gateway-units.txt` all read `root@209.38.87.90: Permission denied (publickey,keyboard-interactive)`, while `logs/gateway-do-forensics.txt` proves the box was up and `tcp/22: a FRESH connect succeeded`. `oc_droplet_evidence` dials with no identity (`scripts/lib/rehearsal-droplet.sh:450`, `:463`, `:477`, `:496`, `:537`), but on the rented path the box only trusts the app's per-run key — the sibling harvester at `scripts/lib/rehearsal-droplet.sh:980-981` already knows it as `$run_dir/state/rent-operator/id_ed25519`. Result: this red has zero gateway-side evidence. Offline seam tests exist for this surface (`scripts/tests/device-evidence-order-test.sh`, `scripts/tests/droplet-evidence-order-test.sh`). **The captured flake is not in the run dir.** `logs/state-logs.log` reads `ERROR: no state logs directory at …/standing-rented/state/logs`, and the run dir's own `state/` is empty. The repo this red is about survives only at the shared path `test-results/standing-rented/state/clan-config` — a `trial-reset` or the next drive destroys the only copy. ## Healer history Signature `25304f657c24` has now redded three consecutive drives. The two prior self-fixes (`5c8f4c6e`, `8b34ddeb`) both landed on evidence-harvest surfaces, not on this fault. Filing rather than self-fixing: no line in this checkout is mechanically wrong, the candidate fixes are semantic changes I cannot verify against a real clan run here, and the repacking agent is still unidentified. drive `20260828T051317Z` red at `standing`: `journey leg "enroll-configure" went red: founding: stand up the rented server: clan: config_eval on gateway: the node's config does not evaluate: error: error: path '//home/swarm/swarm/Matou/idss/test` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T051317Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 25304f657c24 -->
Author
Member

Close-report — landed & proven at the seam (advances #923)

Ruled by agent under ADR 0174 — veto anytime. The diagnosis asked for a ruling on which layer takes the fault. Ruling: internal/clan, via the two session-provable two-way doors (options 2 + 3); option 1 is filed as a follow-up that needs a live clan run.

What landed — commit aafba196

  1. generate gains the transient-hold the eval preflight already has. A bounded settle-retry (generateRepackAttempts = 3, transientRepackRetryDelay) discriminated to nix's .git/objects/**-anchored read error (isTransientGitRepack, a regexp on path '…/.git/objects/…' does not exist). This absorbs the fault the retry could not reach before: it landed one call site earlier than evalReadiness's #461/#542 retry. The race settles the instant the repack finishes — the object is now packed, so nix's next readdir never lists the vanished loose file — so the re-ingest reads the stable pack. Cause-agnostic: it absorbs the race whoever repacks, which matters because the repacker is still unidentified.
  2. Belt-and-braces: ConfigRepo.ensureStore pins gc.auto=0 / maintenance.auto=false on provision, closing git's auto-repack culprit class on the ingest source.

Why this is a two-way door (ADR 0174 rule 1)

  • Revertible: pure commit/config; no infra, no spend, no posture change.
  • Provable by test: red-first at internal/clan/generate_repack_retry_test.go (retry-to-success; genuine .nix-source config error takes NO hold and reds terminal at once — the fail-loud discriminator; persistent repack is BOUNDED) + internal/clan/configrepo_repack_test.go (the pin lands on provision). go build / go vet / go test ./internal/clan all green.
  • Fail-loud preserved: the discriminator is anchored to .git/objects/**, which only the ingest-vs-repack race can print — a genuine config error names a missing .nix source or a flake input, never a packed object — so internal/clan/adapter.go:610-623's rule is honoured (verified by the RealConfigErrorNotRetried test).

The human residue, filed not forced

  • #925 — option 1, the structural fix: swap path:<dir> → git+file://<dir> at nine call sites so .git never enters the ingest. Left as a follow-up because it needs a live clan run to prove untracked-file visibility (clan's CLAN_NO_COMMIT/--intent-to-add dance) — not a session-provable two-way door, exactly the residue the diagnosis flagged.

Also-seen defects from this run, filed separately (session rule 1)

  • #926 — the rented-gateway evidence harvest dials with no SSH identity (oc_droplet_evidence), so this red harvested zero gateway-side evidence; should use $run_dir/state/rent-operator/id_ed25519.
  • #927 — the drive run dir does not capture the clan config flake; the only copy survives at the shared state path and is destroyed by the next drive / trial-reset.

Closing: the diagnosed fault is plugged and proven at the seam; the deeper fix and the two harness defects are tracked in #925/#926/#927.

## Close-report — landed & proven at the seam (advances #923) **Ruled by agent under ADR 0174 — veto anytime.** The diagnosis asked for a ruling on which layer takes the fault. **Ruling: `internal/clan`, via the two session-provable two-way doors (options 2 + 3); option 1 is filed as a follow-up that needs a live clan run.** ### What landed — commit `aafba196` 1. **`generate` gains the transient-hold the eval preflight already has.** A bounded settle-retry (`generateRepackAttempts = 3`, `transientRepackRetryDelay`) discriminated to nix's `.git/objects/**`-anchored read error (`isTransientGitRepack`, a regexp on `path '…/.git/objects/…' does not exist`). This absorbs the fault the retry could not reach before: it landed one call site *earlier* than `evalReadiness`'s #461/#542 retry. The race settles the instant the repack finishes — the object is now packed, so nix's next readdir never lists the vanished loose file — so the re-ingest reads the stable pack. **Cause-agnostic**: it absorbs the race whoever repacks, which matters because the repacker is still unidentified. 2. **Belt-and-braces: `ConfigRepo.ensureStore` pins `gc.auto=0` / `maintenance.auto=false`** on provision, closing git's auto-repack culprit class on the ingest source. ### Why this is a two-way door (ADR 0174 rule 1) - **Revertible**: pure commit/config; no infra, no spend, no posture change. - **Provable by test**: red-first at `internal/clan/generate_repack_retry_test.go` (retry-to-success; genuine `.nix`-source config error takes NO hold and reds terminal at once — the fail-loud discriminator; persistent repack is BOUNDED) + `internal/clan/configrepo_repack_test.go` (the pin lands on provision). `go build` / `go vet` / `go test ./internal/clan` all green. - **Fail-loud preserved**: the discriminator is anchored to `.git/objects/**`, which *only* the ingest-vs-repack race can print — a genuine config error names a missing `.nix` source or a flake input, never a packed object — so `internal/clan/adapter.go:610-623`'s rule is honoured (verified by the `RealConfigErrorNotRetried` test). ### The human residue, filed not forced - **#925** — option 1, the *structural* fix: swap `path:<dir>` → `git+file://<dir>` at nine call sites so `.git` never enters the ingest. Left as a follow-up because it needs a live clan run to prove untracked-file visibility (clan's `CLAN_NO_COMMIT`/`--intent-to-add` dance) — **not a session-provable two-way door**, exactly the residue the diagnosis flagged. ### Also-seen defects from this run, filed separately (session rule 1) - **#926** — the rented-gateway evidence harvest dials with no SSH identity (`oc_droplet_evidence`), so this red harvested zero gateway-side evidence; should use `$run_dir/state/rent-operator/id_ed25519`. - **#927** — the drive run dir does not capture the clan config flake; the only copy survives at the shared state path and is destroyed by the next drive / trial-reset. Closing: the diagnosed fault is plugged and proven at the seam; the deeper fix and the two harness defects are tracked in #925/#926/#927.
matou-build-agent 2026-08-28 06:12:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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/idss#923
No description provided.