supply: the two best-effort seeds each take the FULL seed bound and spend the whole 600s leg between them #1402

Closed
opened 2026-09-11 22:22:22 +00:00 by matou-build-agent · 1 comment

The failure

Drive 20260911T215059Z (--target droplet, commit a575406b) red at the supply leg:

journey leg "supply" went red: budget of 600s elapsed at "supply" — bar at 66%, no activity line rendered, last advanced 601s ago

artifacts/legs.json — 7 green legs, supply red at 600794ms. Thrown from app/tests/e2e/journey.droplet.spec.ts:235 (waitForLeg's budget death) against the ceiling at app/tests/e2e/journey.droplet.spec.ts:135 (['supply', 10 * 60_000]).

The evidence

Nothing was broken on the box. logs/droplet-stall.txt: load average 0.00, disk 5% used, and a live sftp session still receiving — bytes_received:265904750 busy:182168ms, i.e. ~1.46 MB/s and lastrcv:51 ms at the moment of death. The leg was not stalled; it was still copying.

supply's LOUD correctness steps all passed, fast. logs/droplet-journal.txt (the /var/lib/idss listing after the === marker): device.key, agent-cache/RELEASE and agent-cache/x86_64/idss-agent (11 MB) all landed 22:03 — supply started ~22:02:02 (startedAt 21:52:21 + the 581s of green legs), so ~62s of loud steps, exactly the figure internal/fleetwire/supply.go:101 budgets for.

The two optimisation seeds ate the remaining ~540s:

  • /var/lib/idss/installer-base-cache.staging — narinfo files stamped 22:03→22:07, nar.xz 22:07→22:08, and the dir is still .staging (never mv'd to installer-base-cache). The installer-base seed ran to its own 300s bound and returned (internal/fleetwire/supply.go:476 on the red commit).
  • /var/lib/idss/agent-cache/x86_64/vm-guest.tar.staging — 263,470,080 bytes, mtime 22:12, still growing. The vm-guest seed started at ~22:08 and opened a fresh 300s (internal/fleetwire/supply.go:369 on the red commit) with only ~240s of leg left.

No WARN from either seed appears anywhere: the leg died while the scp still blocked, so seedGuestPayload's degrade-and-return never got to fire — the exact shape its own comment (internal/fleetwire/supply.go:363-378) says the bound exists to prevent.

The suspected layer — confirmed

internal/fleetwire/supply.go, the best-effort seed family's budget arithmetic.

defaultSeedTimeout (internal/fleetwire/supply.go:93-106) is sized in its own words as "half the 600s supply ceiling, leaving ample headroom for supply's ~62s of loud correctness steps even when the seed runs to its bound". That is headroom arithmetic over the leg, and it holds only while the whole best-effort family fits inside ONE bound. #1049 wrote it for the installer-base seed alone. #1191 added seedGuestPayload as a second consumer of the same constant, run serially right after, and each derived its own context.WithTimeout(ctx, s.seedTimeout). Worst case became 2×300s = the entire leg — spent on two copies that are contractually forbidden to fail it (ADR 0133 "every failure degrades to today's behaviour"; ADR 0100 puts the loud check at the device's own guest Create, not here).

The droplet path hits that worst case on every drive: the FullInstall takeover wipes the box (internal/founding/ownvpspath.go:441-443), so neither seed's short-circuit — nix path-info <marker> for installer-base, the vm-guest.tar.sha256 content key for the bundle — can hit, and both copies run in full.

The fix

One shared envelope. Supply.seed opens the seedTimeout context ONCE and passes it to both seeds; neither mints its own. Each still degrades to today's behaviour on its own, and a seed that finds the envelope already spent WARNs and returns instead of opening a copy the leg cannot pay for. No message, assertion, short-circuit or step list changed — only which context the remote calls run under. GOTCHAS #224 records the hazard.

Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime)

Two-way door, mechanical, not a design decision.

Why it is a repair, not a decision. The intended envelope is already written down in the code: defaultSeedTimeout is documented as HALF the supply leg's 600s ceiling precisely so the loud correctness steps still fit. That arithmetic was authored for one seed; #1191 added a second consumer of the same constant without re-doing it. Sharing the deadline makes the code do what the constant already says it means. It changes nothing a community sees and nothing a deploy does: both seeds are, by their own contract (ADR 0133 tier 3, ADR 0100), optimisations that are allowed to lose — a lost installer-base seed means the takeover builds the base from source (backstopped by the #1016 ceiling); a lost vm-guest seed means a VM-mode device join fails LOUD at guest Create, which is the designed consume-time check either way. No route, secret, default, trust-moment message or security posture is touched. The only behaviour that changes is how much of the founding leg the optimisations are permitted to spend — and 600s-of-600s was never a decision anyone made, it was two halves added together.

Revertible how. git revert 16aa06cb restores each seed's own context.WithTimeout(ctx, s.seedTimeout) — the change is three call-site/signature edits plus comments, no schema, no state, no persisted artefact, nothing on the box or in infra. A re-drive after a revert behaves exactly as a575406b did.

Proven by which test. TestSupplySeed_BestEffortSeedsShareOneDeadline (internal/fleetwire/supply_test.go) runs one payload carrying BOTH best-effort slots with both short-circuits missing, and asserts the installer-base scp and the vm-guest scp ran under the identical ctx deadline. It is proven by the deadline the copies carry, not by wall-clock, so the rail cannot silently drift back in under a fast fake runner: on the red commit it fails deterministically (vm-guest's deadline 49–125µs later, across -count=5); with the fix it passes -count=20. All 40 pre-existing supply tests — including the two per-seed deadline rails TestSupplySeed_InstallerBaseCopyBoundedBySeedDeadline and TestSupplySeed_VMGuestCopyBoundedBySeedDeadline — are unchanged and still pass, so the per-seed degrade contract each one pins is intact.

What I did NOT do. I did not widen the supply ceiling in journey.droplet.spec.ts. That would have been the cheap green: it would let two optimisations bill the leg 600s on every paid drive and would paper over arithmetic that breaks again the next time a seed joins the family. The product's own sizing says supply fits in 600s; the honest repair is to make the seeds fit in it. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes.

drive 20260911T215059Z red at supply (sig 404124947736) — self-fixed on the fast lane, commit 74f92a9dcbecb5d469998b5c446dcabc7d6eee0a; checks: targeted (red-first): GOWORK=… go test ./internal/fleetwire/ -run TestSupplySeed_BestEffortSeedsShareOneDeadline -count=5 → FAIL ×5 on the unfixed supply.go ("the best-effort seeds ran under SEPARATE envelopes — vm-guest's deadline is 125.104µs / 49.447µs / 63.943µs / 62.666µs / 64.135µs after installer-base's"); with the fix → ok, and -count=20 → ok 0.009s (no flake). package: go test ./internal/fleetwire/ → ok 0.482s (all 40 supply tests, including the two pre-existing per-seed deadline rails, unchanged and passing); go vet ./internal/fleetwire/ → clean; gofmt -l on both changed .go files → clean. whole tree: go build ./... → clean; go test ./... → every package ok, zero failures. commit shape: 3 files, 147 insertions / 41 deletions, of which 115/41 are non-test (internal/fleetwire/supply.go 63/41, docs/GOTCHAS.md 11/0 — supply_test.go is +73/-0 and a test file); one commit 16aa06cb, not pushed, working tree clean. rails self-check: all 41 removed lines are in supply.go and are comment-prose or the two seedCtx, cancel := context.WithTimeout(ctx, s.seedTimeout) / defer cancel() pairs plus the two function signatures and the two call sites; ZERO removed lines in supply_test.go or GOTCHAS.md; none of the 41 match expect(/assert/require./t.Fatal/t.Error/toBe/toEqual/func Test/it(/test(/describe(/.skip/t.Skip; zero added .skip/.only/t.Skip; 3 files and 115 non-test changed lines, under the cap; no .sandcastle/rehearsal-* or .forgejo/workflows/ path touched.. evidence: /home/swarm/session-runner/idss/test-results/drive-droplet/20260911T215059Z on matou-workstation.

## The failure Drive `20260911T215059Z` (`--target droplet`, commit `a575406b`) red at the `supply` leg: ``` journey leg "supply" went red: budget of 600s elapsed at "supply" — bar at 66%, no activity line rendered, last advanced 601s ago ``` `artifacts/legs.json` — 7 green legs, `supply` red at 600794ms. Thrown from `app/tests/e2e/journey.droplet.spec.ts:235` (`waitForLeg`'s budget death) against the ceiling at `app/tests/e2e/journey.droplet.spec.ts:135` (`['supply', 10 * 60_000]`). ## The evidence Nothing was broken on the box. `logs/droplet-stall.txt`: load average `0.00`, disk 5% used, and a **live sftp session still receiving** — `bytes_received:265904750 busy:182168ms`, i.e. ~1.46 MB/s and `lastrcv:51` ms at the moment of death. The leg was not stalled; it was still copying. supply's LOUD correctness steps all passed, fast. `logs/droplet-journal.txt` (the `/var/lib/idss` listing after the `===` marker): `device.key`, `agent-cache/RELEASE` and `agent-cache/x86_64/idss-agent` (11 MB) all landed **22:03** — supply started ~22:02:02 (startedAt 21:52:21 + the 581s of green legs), so ~62s of loud steps, exactly the figure `internal/fleetwire/supply.go:101` budgets for. The two **optimisation** seeds ate the remaining ~540s: - `/var/lib/idss/installer-base-cache.staging` — narinfo files stamped 22:03→22:07, nar.xz 22:07→**22:08**, and the dir is still `.staging` (never `mv`'d to `installer-base-cache`). The installer-base seed ran to its **own 300s bound** and returned (`internal/fleetwire/supply.go:476` on the red commit). - `/var/lib/idss/agent-cache/x86_64/vm-guest.tar.staging` — **263,470,080 bytes, mtime 22:12**, still growing. The vm-guest seed started at ~22:08 and opened a **fresh 300s** (`internal/fleetwire/supply.go:369` on the red commit) with only ~240s of leg left. No WARN from either seed appears anywhere: the leg died while the scp still blocked, so `seedGuestPayload`'s degrade-and-return never got to fire — the exact shape its own comment (`internal/fleetwire/supply.go:363-378`) says the bound exists to prevent. ## The suspected layer — confirmed `internal/fleetwire/supply.go`, the best-effort seed family's budget arithmetic. `defaultSeedTimeout` (`internal/fleetwire/supply.go:93-106`) is sized in its own words as *"half the 600s supply ceiling, leaving ample headroom for supply's ~62s of loud correctness steps even when the seed runs to its bound"*. That is headroom arithmetic over the **leg**, and it holds only while the whole best-effort family fits inside ONE bound. #1049 wrote it for the installer-base seed alone. #1191 added `seedGuestPayload` as a **second consumer of the same constant**, run serially right after, and each derived its own `context.WithTimeout(ctx, s.seedTimeout)`. Worst case became 2×300s = the entire leg — spent on two copies that are contractually forbidden to fail it (ADR 0133 "every failure degrades to today's behaviour"; ADR 0100 puts the loud check at the device's own guest Create, not here). The droplet path hits that worst case on **every** drive: the FullInstall takeover wipes the box (`internal/founding/ownvpspath.go:441-443`), so neither seed's short-circuit — `nix path-info <marker>` for installer-base, the `vm-guest.tar.sha256` content key for the bundle — can hit, and both copies run in full. ## The fix One shared envelope. `Supply.seed` opens the `seedTimeout` context ONCE and passes it to both seeds; neither mints its own. Each still degrades to today's behaviour on its own, and a seed that finds the envelope already spent WARNs and returns instead of opening a copy the leg cannot pay for. No message, assertion, short-circuit or step list changed — only which context the remote calls run under. GOTCHAS #224 records the hazard. ## Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime) Two-way door, mechanical, not a design decision. **Why it is a repair, not a decision.** The intended envelope is already written down in the code: `defaultSeedTimeout` is documented as HALF the supply leg's 600s ceiling precisely so the loud correctness steps still fit. That arithmetic was authored for one seed; #1191 added a second consumer of the same constant without re-doing it. Sharing the deadline makes the code do what the constant already says it means. It changes nothing a community sees and nothing a deploy does: both seeds are, by their own contract (ADR 0133 tier 3, ADR 0100), optimisations that are *allowed to lose* — a lost installer-base seed means the takeover builds the base from source (backstopped by the #1016 ceiling); a lost vm-guest seed means a VM-mode device join fails LOUD at guest Create, which is the designed consume-time check either way. No route, secret, default, trust-moment message or security posture is touched. The only behaviour that changes is how much of the founding leg the optimisations are permitted to spend — and 600s-of-600s was never a decision anyone made, it was two halves added together. **Revertible how.** `git revert 16aa06cb` restores each seed's own `context.WithTimeout(ctx, s.seedTimeout)` — the change is three call-site/signature edits plus comments, no schema, no state, no persisted artefact, nothing on the box or in infra. A re-drive after a revert behaves exactly as `a575406b` did. **Proven by which test.** `TestSupplySeed_BestEffortSeedsShareOneDeadline` (`internal/fleetwire/supply_test.go`) runs one payload carrying BOTH best-effort slots with both short-circuits missing, and asserts the installer-base scp and the vm-guest scp ran under the **identical** ctx deadline. It is proven by the deadline the copies carry, not by wall-clock, so the rail cannot silently drift back in under a fast fake runner: on the red commit it fails deterministically (vm-guest's deadline 49–125µs later, across `-count=5`); with the fix it passes `-count=20`. All 40 pre-existing supply tests — including the two per-seed deadline rails `TestSupplySeed_InstallerBaseCopyBoundedBySeedDeadline` and `TestSupplySeed_VMGuestCopyBoundedBySeedDeadline` — are unchanged and still pass, so the per-seed degrade contract each one pins is intact. **What I did NOT do.** I did not widen the `supply` ceiling in `journey.droplet.spec.ts`. That would have been the cheap green: it would let two optimisations bill the leg 600s on every paid drive and would paper over arithmetic that breaks again the next time a seed joins the family. The product's own sizing says supply fits in 600s; the honest repair is to make the seeds fit in it. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes. drive `20260911T215059Z` red at `supply` (sig 404124947736) — self-fixed on the fast lane, commit `74f92a9dcbecb5d469998b5c446dcabc7d6eee0a`; checks: targeted (red-first): `GOWORK=… go test ./internal/fleetwire/ -run TestSupplySeed_BestEffortSeedsShareOneDeadline -count=5` → FAIL ×5 on the unfixed supply.go ("the best-effort seeds ran under SEPARATE envelopes — vm-guest's deadline is 125.104µs / 49.447µs / 63.943µs / 62.666µs / 64.135µs after installer-base's"); with the fix → ok, and `-count=20` → ok 0.009s (no flake). package: `go test ./internal/fleetwire/` → ok 0.482s (all 40 supply tests, including the two pre-existing per-seed deadline rails, unchanged and passing); `go vet ./internal/fleetwire/` → clean; `gofmt -l` on both changed .go files → clean. whole tree: `go build ./...` → clean; `go test ./...` → every package ok, zero failures. commit shape: 3 files, 147 insertions / 41 deletions, of which 115/41 are non-test (internal/fleetwire/supply.go 63/41, docs/GOTCHAS.md 11/0 — supply_test.go is +73/-0 and a test file); one commit 16aa06cb, not pushed, working tree clean. rails self-check: all 41 removed lines are in supply.go and are comment-prose or the two `seedCtx, cancel := context.WithTimeout(ctx, s.seedTimeout)` / `defer cancel()` pairs plus the two function signatures and the two call sites; ZERO removed lines in supply_test.go or GOTCHAS.md; none of the 41 match expect(/assert/require./t.Fatal/t.Error/toBe/toEqual/func Test/it(/test(/describe(/.skip/t.Skip; zero added .skip/.only/t.Skip; 3 files and 115 non-test changed lines, under the cap; no `.sandcastle/rehearsal-*` or `.forgejo/workflows/` path touched.. evidence: `/home/swarm/session-runner/idss/test-results/drive-droplet/20260911T215059Z` on matou-workstation. <!-- rehearsal-sig: 404124947736 -->
Author
Member

close-report for #1402 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1402,
  "status": "success",
  "commits": [
    "74f92a9dcbecb5d469998b5c446dcabc7d6eee0a"
  ],
  "changed_files": [
    "docs/GOTCHAS.md",
    "internal/fleetwire/supply.go",
    "internal/fleetwire/supply_test.go"
  ],
  "tests": [
    {
      "command": "targeted (red-first): `GOWORK=… go test ./internal/fleetwire/ -run TestSupplySeed_BestEffortSeedsShareOneDeadline -count=5` → FAIL ×5 on the unfixed supply.go (\"the best-effort seeds ran under SEPARATE envelopes — vm-guest's deadline is 125.104µs / 49.447µs / 63.943µs / 62.666µs / 64.135µs after installer-base's\"); with the fix → ok, and `-count=20` → ok 0.009s (no flake). package: `go test ./internal/fleetwire/` → ok 0.482s (all 40 supply tests, including the two pre-existing per-seed deadline rails, unchanged and passing); `go vet ./internal/fleetwire/` → clean; `gofmt -l` on both changed .go files → clean. whole tree: `go build ./...` → clean; `go test ./...` → every package ok, zero failures. commit shape: 3 files, 147 insertions / 41 deletions, of which 115/41 are non-test (internal/fleetwire/supply.go 63/41, docs/GOTCHAS.md 11/0 — supply_test.go is +73/-0 and a test file); one commit 16aa06cb, not pushed, working tree clean. rails self-check: all 41 removed lines are in supply.go and are comment-prose or the two `seedCtx, cancel := context.WithTimeout(ctx, s.seedTimeout)` / `defer cancel()` pairs plus the two function signatures and the two call sites; ZERO removed lines in supply_test.go or GOTCHAS.md; none of the 41 match expect(/assert/require./t.Fatal/t.Error/toBe/toEqual/func Test/it(/test(/describe(/.skip/t.Skip; zero added .skip/.only/t.Skip; 3 files and 115 non-test changed lines, under the cap; no `.sandcastle/rehearsal-*` or `.forgejo/workflows/` path touched.",
      "exit_code": 0
    }
  ],
  "criteria": {
    "the red leg is now green": "healed on the fast lane, commit 74f92a9dcbecb5d469998b5c446dcabc7d6eee0a"
  },
  "summary": "supply's two best-effort seeds (installer-base #1049, vm-guest #1191) each derived their OWN full 300s `seedTimeout` and ran serially, so together they could bill the whole 600s supply leg and red it mid-copy — `Supply.seed` now opens one shared envelope and passes it to both.",
  "blockers": []
}
**close-report** for #1402 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1402, "status": "success", "commits": [ "74f92a9dcbecb5d469998b5c446dcabc7d6eee0a" ], "changed_files": [ "docs/GOTCHAS.md", "internal/fleetwire/supply.go", "internal/fleetwire/supply_test.go" ], "tests": [ { "command": "targeted (red-first): `GOWORK=… go test ./internal/fleetwire/ -run TestSupplySeed_BestEffortSeedsShareOneDeadline -count=5` → FAIL ×5 on the unfixed supply.go (\"the best-effort seeds ran under SEPARATE envelopes — vm-guest's deadline is 125.104µs / 49.447µs / 63.943µs / 62.666µs / 64.135µs after installer-base's\"); with the fix → ok, and `-count=20` → ok 0.009s (no flake). package: `go test ./internal/fleetwire/` → ok 0.482s (all 40 supply tests, including the two pre-existing per-seed deadline rails, unchanged and passing); `go vet ./internal/fleetwire/` → clean; `gofmt -l` on both changed .go files → clean. whole tree: `go build ./...` → clean; `go test ./...` → every package ok, zero failures. commit shape: 3 files, 147 insertions / 41 deletions, of which 115/41 are non-test (internal/fleetwire/supply.go 63/41, docs/GOTCHAS.md 11/0 — supply_test.go is +73/-0 and a test file); one commit 16aa06cb, not pushed, working tree clean. rails self-check: all 41 removed lines are in supply.go and are comment-prose or the two `seedCtx, cancel := context.WithTimeout(ctx, s.seedTimeout)` / `defer cancel()` pairs plus the two function signatures and the two call sites; ZERO removed lines in supply_test.go or GOTCHAS.md; none of the 41 match expect(/assert/require./t.Fatal/t.Error/toBe/toEqual/func Test/it(/test(/describe(/.skip/t.Skip; zero added .skip/.only/t.Skip; 3 files and 115 non-test changed lines, under the cap; no `.sandcastle/rehearsal-*` or `.forgejo/workflows/` path touched.", "exit_code": 0 } ], "criteria": { "the red leg is now green": "healed on the fast lane, commit 74f92a9dcbecb5d469998b5c446dcabc7d6eee0a" }, "summary": "supply's two best-effort seeds (installer-base #1049, vm-guest #1191) each derived their OWN full 300s `seedTimeout` and ran serially, so together they could bill the whole 600s supply leg and red it mid-copy — `Supply.seed` now opens one shared envelope and passes it to both.", "blockers": [] } ``` </details>
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.

Dependencies

No dependencies set.

Reference
Matou/idss#1402
No description provided.