sandcastle: persistent /nix across worker containers — the Go gate re-downloads the pinned toolchain every run #249
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.
Dependencies
No dependencies set.
Reference
Matou/idss#249
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?
Why (measured 2026-07-31)
Worker wall-clock regressed from 43 min avg on 07-25 (24 runs, max 64) to 50–73 min avg this week with a new pathological tail (110, 116, 161-minute runs). The tail correlates exactly with nix activity in the worker logs:
nix developcallsMeanwhile non-Go tickets still run at last week's pace (07-31: #234 = 14 min, #218 = 18 min, #233 = 25 min) — the harness is not uniformly slower; the Go path is.
Root cause:
.sandcastle/main.mtspersists only the pnpm store across containers:mountshas.sandcastle/pnpm-store → /home/agent/.pnpm-store— and nothing for nix./nixempty in the image (single-user install at build time installs the nix binaries, not the dev-shell closure).nix develop .#go-cire-evaluates the flake and re-substitutes the entire pinned toolchain (go,golangci-lint, deps) from the binary cache — per container, and again on every gate retry after a rebase. The Dockerfile comment's claim that the go-ci shell "warms in seconds from the binary cache" is contradicted by the logs.Compounding: gate re-runs per worker grew from 2–20 (07-25) to 20–72 (07-31) as rebase/retry loops multiplied, so the cold-store cost is paid many times per slice.
Acceptance criteria
main.mtsmounts(e.g. host.sandcastle/nix-store(or/nixvolume) → container/nix, readonly: false;run-swarm.shcreates the dir besidepnpm-storethe same way it does today for pnpm). Concurrent access is already fenced: the global swarm flock admits one heavy worker per host./nixmust remain owned by the agent UID/GID (Dockerfile currentlychowns it at build; the mount must not undo that — match the pnpm-store handling)..#go-ci(better). Non-fatal on failure, same posture as the existing nix install (gate fails closed, main stays green)..#go-ciwithout mass substitution (seconds, not minutes) on the second and subsequent runs; note before/after in the ticket comment.Matou/matou-app's.sandcastleif/when its slices grow a nix-gated toolchain (or fold into the shared-harness extraction — see #238's open question).Non-goals
flock -n, capacity).Pointers
.sandcastle/main.mts(mounts),.sandcastle/Dockerfile(nix section, lines ~44–66),.sandcastle/run-swarm.sh(pnpm-store dir creation),.sandcastle/gate.sh/ #198 (nix develop .#go-ci), ADR 0040 (one pinned toolchain).sandcastle/logs/main-sandcastle-worker-20260730-003838-*,-20260730-033857-*,-20260731-221636-*Landed in
d883076onmain.What shipped
main.mts: bind-mount a persistent host nix store (.sandcastle/nix-store→/nix, writable) beside the pnpm-store precedent, so the.#go-ciclosure survives across worker containers (AC #1). Concurrent writes are fenced by the existing global swarm flock (one heavy worker per host).run-swarm.sh: creates the store dir besidepnpm-store, then seeds it from the freshly built image's own/nixonce — a bare empty mount would hide Nix itself (/nixholds the single-user install, not just a cache), socp -a /nix/. → nix-store; runs as the hostuid:gid, keeping the store agent-owned (AC #2). Then best-effort pre-warms.#go-ciunder a 900s timeout so even the first worker gate is warm (AC #3, thebetterpath). Both docker runs override the imagesleep infinityENTRYPOINT. All steps non-fatal, matching the nix-install posture (failed seed → gate fails closed, main stays green; the first real gate populates the store either way).Dockerfile: corrected thewarms in seconds from the binary cacheclaim the ticket flagged — now accurate only because the store is persisted..gitignore:nix-store/+pnpm-store/(never committed).README.md: documents both persistent stores + the seed-from-image requirement.tests/nix-store-test.sh(new offline seam test, 2 groups, green): pins the empty-dir seed guard and thesandcastle:<basename>image-name replica of @ai-hero/sandcastle'sdefaultImageName(drift there would seed the wrong image and leave every worker cold). Bodies kept byte-identical torun-swarm.shper the debounce-test contract.AC #4 (before/after numbers) — deferred to the first post-merge host run. A worker sandbox has no docker, so the mechanism could not be exercised end-to-end here. On the next Go-slice run on matou-workstation, read the worker log: on the 2nd+ run the gate should enter
nix develop .#go-ciin seconds with no mass substitution. Please note the before/after here once observed.AC #5: no matou-app mirror is due — these files are repo-specific (off
harness-manifest) and matou-app's gate is TS-only, no nix-gated toolchain yet.Verification: all offline
.sandcastle/tests/*green (nix-store-test.shnew); pre-push gate classified the change TS-only and passed.