#712 recurred: enroll-copy's shipped ServerAliveInterval=30/CountMax=10 did not terminate a live stalled nix copy, ran the full 90m ceiling — the fix's synthetic proof does not match live behaviour #716

Closed
opened 2026-08-23 23:18:55 +00:00 by matou-build-agent · 2 comments

Symptom (drive 20260823T213536Z, sig 52ef2766d349): rented drive reds at enroll-copy on the leg's own 5400s (90m) ceiling — test-results/drive-rented/20260823T213536Z/artifacts/journey.rented-.../error-context.md. Last activity, unchanged for the rest of the leg: 717 of 726 store paths · copying path '/nix/store/p9j469zk8vkclpa4rz3lzy4s85qbialc-sops-install-secrets-0.0.1' to 'ssh-ng://root@170.64.170.228'.... This is the same shape as #711 (98.8% done, then silence) and is the first live recurrence #712 was deferred to wait for.

This is not a repeat of #711's root cause — the fix is confirmed present and exercised, and still didn't fire. internal/clan/enrollment.go:857-880 (copy()) and internal/clan/store_count.go's sshNGStore (internal/clan/store_count.go:140-177) both carry ServerAliveInterval=30/ServerAliveCountMax=10 in NIX_SSHOPTS, guarded by TestSSHNGStore_AsksSSHToNoticeADeadPeer — current code, current main. On a live network this should turn a dead peer into a named ssh error within ~300s, and copy()'s failure path (!ok → emit a fallback message → return, enrollment.go:876-880) is a soft continue, not a leg failure — so the leg should have moved on to enroll-activate well inside the 90m ceiling even if the copy itself failed. It did not: the DOM's last-activity line never advanced past 717/726, meaning the underlying nix copy subprocess was genuinely still blocked inside ssh at the 90-minute mark, not killed by the keepalive mechanism that #711/GOTCHAS#67 proved (synthetically) kills it in under a minute.

Provider-side evidence pins the stall and rules out an external destroy (pulled live via doctl/the DO actions API before it aged out further — the run's own droplet-do-forensics.txt lost the race and only recorded "already gone"):

  • Droplet 594627426: create 21:36:32Z→21:37:02Z, next action is destroy 23:08:38Z→23:08:44Z (started ~1s after the leg's own endedAt 23:08:37.460Z) — no power action of any kind in between. The box was up, per DigitalOcean's own record, for the entire 92-minute leg; nothing provider-side power-cycled, migrated, or reaped it early. The destroy is our own teardown, not an external actor — the earlier "dark box got destroyed mid-transfer" theory does not apply here.
  • Hypervisor-side inbound bandwidth for that host_id: ~10 Mbps 21:40–21:44Z (stock-nixpkgs substitute-on-destination fetch), dropping to ~3 Mbps 21:48Z (our unsigned custom paths pushing over ssh-ng), tapering 1.19→0.81→0.88→0.65→0.49→0.22 Mbps through 21:58–22:08Z, then floor (~0.0005 Mbps) from 22:10Z until teardown — the transfer stopped ~34 minutes into the 90-minute ceiling; the remaining ~58 minutes bought nothing. ServerAliveInterval=30×CountMax=10 should have surfaced a named error by ≈22:15Z. It did not fire for 58 more minutes (or never fired at all — the leg only ended because the outer budget did).

One concrete hypothesis was raised and empirically REFUTED, so it can be ruled out: that internal/clan/cli.go:96-121's env layering (cmd.Env = append(append([]string{}, base...), inv.Env...)) lets a stale ambient NIX_SSHOPTS (inherited via os.Environ()/ExecEnv, internal/clan/secrets.go:220, which only dedupes SOPS_AGE_KEY_FILE, not NIX_SSHOPTS) shadow the per-call override. Reproduced off-drive with a minimal Go harness mirroring that exact append pattern and a duplicate-keyed cmd.Env: exec.Cmd deduplicates on Start(), keeping the last occurrence, so the per-call NIX_SSHOPTS does win even with a stale duplicate present. This is not the mechanism. Also checked and ruled out: no ControlMaster/ControlPersist/ServerAlive* override in /etc/ssh/ssh_config or ssh_config.d/*.conf on the executor host (elitebook-distributed-server-03) that could cause ssh connection multiplexing between the leg's path-info probe and its copy invocation.

What's still unexplained, and needs live (not synthetic) reproduction: why ServerAliveInterval=30/CountMax=10, confirmed wired into the exact code path exercised here, did not terminate a real stalled nix copy --substitute-on-destination against a real DigitalOcean network path, when GOTCHAS #67's synthetic relay-freeze reproduction showed termination well inside the window at the same (and stricter) settings. Suggested next steps for whoever picks this up: (1) rent a droplet from the drive's own snapshot/preset, drive the byte-for-byte sshNGStore invocation, and induce a REAL mid-transfer network fault (a firewall DROP rule on the target, not a relay freeze) rather than a proxy freeze, to see whether the live network path behaves differently from the relay; (2) tcpdump the drive host's outbound traffic during a stalled leg to check whether ssh's keepalive probes are actually being sent and whether they're acked; (3) check whether nix's ssh-ng store transport re-execs ssh per-invocation with NIX_SSHOPTS verbatim or reuses/multiplexes a connection across the leg's two ssh-ng calls (the path-info probe in missingOnTarget then the copy) in a way that could drop the keepalive options on the second. No ceiling should be widened (GOTCHAS #62) — the mechanism meant to make silence fail loud is the thing that isn't firing.

Not self-fixed: this needs live reproduction against real DigitalOcean infra to pin down why the proven fix isn't reproducing its effect, which is outside what this checkout can test. One refuted hypothesis is recorded above so it isn't re-walked.

drive 20260823T213536Z red at enroll-copy: journey leg "enroll-copy" went red: budget of 5400s elapsed at "enroll-copy" — last activity: 717 of 726 store paths · copying path '/nix/store/p9j469zk8vkclpa4rz3lzy4s85qbialc-sops-install-secrets
evidence: test-results/…/20260823T213536Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

**Symptom (drive `20260823T213536Z`, sig `52ef2766d349`):** rented drive reds at `enroll-copy` on the leg's own 5400s (90m) ceiling — `test-results/drive-rented/20260823T213536Z/artifacts/journey.rented-.../error-context.md`. Last activity, unchanged for the rest of the leg: `717 of 726 store paths · copying path '/nix/store/p9j469zk8vkclpa4rz3lzy4s85qbialc-sops-install-secrets-0.0.1' to 'ssh-ng://root@170.64.170.228'...`. This is the same shape as #711 (98.8% done, then silence) and is the **first live recurrence** #712 was deferred to wait for. **This is not a repeat of #711's root cause — the fix is confirmed present and exercised, and still didn't fire.** `internal/clan/enrollment.go:857-880` (`copy()`) and `internal/clan/store_count.go`'s `sshNGStore` (`internal/clan/store_count.go:140-177`) both carry `ServerAliveInterval=30`/`ServerAliveCountMax=10` in `NIX_SSHOPTS`, guarded by `TestSSHNGStore_AsksSSHToNoticeADeadPeer` — current code, current `main`. On a live network this should turn a dead peer into a named ssh error within ~300s, and `copy()`'s failure path (`!ok` → emit a fallback message → **return**, `enrollment.go:876-880`) is a soft continue, not a leg failure — so the leg should have moved on to `enroll-activate` well inside the 90m ceiling even if the copy itself failed. It did not: the DOM's last-activity line never advanced past 717/726, meaning the underlying `nix copy` subprocess was genuinely still blocked inside ssh at the 90-minute mark, not killed by the keepalive mechanism that #711/GOTCHAS#67 proved (synthetically) kills it in under a minute. **Provider-side evidence pins the stall and rules out an external destroy** (pulled live via `doctl`/the DO actions API before it aged out further — the run's own `droplet-do-forensics.txt` lost the race and only recorded "already gone"): - Droplet `594627426`: `create` `21:36:32Z`→`21:37:02Z`, next action is `destroy` `23:08:38Z`→`23:08:44Z` (started ~1s after the leg's own `endedAt` `23:08:37.460Z`) — **no power action of any kind in between.** The box was up, per DigitalOcean's own record, for the entire 92-minute leg; nothing provider-side power-cycled, migrated, or reaped it early. The destroy is our own teardown, not an external actor — the earlier "dark box got destroyed mid-transfer" theory does not apply here. - Hypervisor-side inbound bandwidth for that host_id: ~10 Mbps `21:40–21:44Z` (stock-nixpkgs substitute-on-destination fetch), dropping to ~3 Mbps `21:48Z` (our unsigned custom paths pushing over ssh-ng), tapering 1.19→0.81→0.88→0.65→0.49→0.22 Mbps through `21:58–22:08Z`, then **floor (~0.0005 Mbps) from `22:10Z` until teardown** — the transfer stopped ~34 minutes into the 90-minute ceiling; the remaining ~58 minutes bought nothing. `ServerAliveInterval=30`×`CountMax=10` should have surfaced a named error by ≈`22:15Z`. It did not fire for 58 more minutes (or never fired at all — the leg only ended because the outer budget did). **One concrete hypothesis was raised and empirically REFUTED, so it can be ruled out:** that `internal/clan/cli.go:96-121`'s env layering (`cmd.Env = append(append([]string{}, base...), inv.Env...)`) lets a stale ambient `NIX_SSHOPTS` (inherited via `os.Environ()`/`ExecEnv`, `internal/clan/secrets.go:220`, which only dedupes `SOPS_AGE_KEY_FILE`, not `NIX_SSHOPTS`) shadow the per-call override. Reproduced off-drive with a minimal Go harness mirroring that exact append pattern and a duplicate-keyed `cmd.Env`: `exec.Cmd` deduplicates on `Start()`, keeping the **last** occurrence, so the per-call `NIX_SSHOPTS` does win even with a stale duplicate present. This is not the mechanism. Also checked and ruled out: no `ControlMaster`/`ControlPersist`/`ServerAlive*` override in `/etc/ssh/ssh_config` or `ssh_config.d/*.conf` on the executor host (`elitebook-distributed-server-03`) that could cause ssh connection multiplexing between the leg's path-info probe and its copy invocation. **What's still unexplained, and needs live (not synthetic) reproduction:** why `ServerAliveInterval=30`/`CountMax=10`, confirmed wired into the exact code path exercised here, did not terminate a real stalled `nix copy --substitute-on-destination` against a real DigitalOcean network path, when GOTCHAS #67's synthetic relay-freeze reproduction showed termination well inside the window at the same (and stricter) settings. Suggested next steps for whoever picks this up: (1) rent a droplet from the drive's own snapshot/preset, drive the byte-for-byte `sshNGStore` invocation, and induce a REAL mid-transfer network fault (a firewall DROP rule on the target, not a relay freeze) rather than a proxy freeze, to see whether the live network path behaves differently from the relay; (2) `tcpdump` the drive host's outbound traffic during a stalled leg to check whether ssh's keepalive probes are actually being sent and whether they're acked; (3) check whether nix's `ssh-ng` store transport re-execs `ssh` per-invocation with `NIX_SSHOPTS` verbatim or reuses/multiplexes a connection across the leg's two ssh-ng calls (the path-info probe in `missingOnTarget` then the copy) in a way that could drop the keepalive options on the second. No ceiling should be widened (GOTCHAS #62) — the mechanism meant to make silence fail loud is the thing that isn't firing. **Not self-fixed:** this needs live reproduction against real DigitalOcean infra to pin down why the proven fix isn't reproducing its effect, which is outside what this checkout can test. One refuted hypothesis is recorded above so it isn't re-walked. drive `20260823T213536Z` red at `enroll-copy`: `journey leg "enroll-copy" went red: budget of 5400s elapsed at "enroll-copy" — last activity: 717 of 726 store paths · copying path '/nix/store/p9j469zk8vkclpa4rz3lzy4s85qbialc-sops-install-secrets` evidence: `test-results/…/20260823T213536Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: 52ef2766d349 -->
Owner

Interim — the "already gone" box was OUR release, and the reproduction is now the next drive

Ruled by agent under ADR 0174 — veto anytime. Landed c416b78 on main.

Who destroyed droplet 594627426 at 23:08:38Z: not DO, not the broker's TTL (ledger: rented 21:37:06Z, expires +24h), and not oc_rented_teardown (its release answered 400 — already released). It was journey.rented.spec.ts's own test.afterAll, which releases through the broker on every red, inside Playwright — before oc_rented_cleanup → oc_droplet_evidence ever ssh-es in. The "1s after the leg" was two 90-minute clocks coinciding (rent + the #698 ceiling). It never consulted REHEARSAL_KEEP_RED_DROPLET, so #704's keep rail could not keep a rented box. That is why #711, #712 and this red all arrived box-less.

What that changes about the model: with the box provably up for the whole leg (DO action log) and sshd answering, ServerAlive* working exactly as designed is the expected outcome — keepalives only catch a peer that answers nothing. The stall is a live box whose nix-daemon stopped moving at ~98% (bandwidth floor from 22:10Z). Candidates the box-side capture will separate: daemon blocked on a remote substituter fetch with no stalled-download-timeout bite (--substitute-on-destination makes the target fetch stock paths), root-disk/inode exhaustion, memory pressure on the 4GB box, a store-lock wait. No fix attempted — none is warranted without that capture (GOTCHAS #62: no ceiling widening).

Landed so the next red answers this itself:

  • fixtures/rented.ts releaseOnTeardown(records, env) — GREEN always releases; red/hung + REHEARSAL_KEEP_RED_DROPLET=1 keeps the box (broker 24h TTL is the failsafe). afterAll consults it.
  • oc_droplet_evidence writes logs/droplet-stall.txt on every drive: nix/ssh/sops processes with wchan, free, df / /nix, established :22 sockets, temproots, dmesg tail, nix-daemon journal.
  • elitebook-03 rehearsal-env.sh now exports REHEARSAL_KEEP_RED_DROPLET=1.
  • GOTCHAS #69.

Routing: deferred (same as #712) and removed from #652's blockers — the standing drive re-fires and IS the reproduction; a red will now leave a live box for a hands-on look (ssh root@<ip> with the run's state/rent-operator/id_ed25519). A parallel off-drive reproduction script exists (repro716.sh: rents from image 242422012, pushes the run's toplevel with the exact sshNGStore invocation, box-side monitor every 30s) but droplet creation is outside what this session may do — Ben runs it if the drive's own capture is not enough.

## Interim — the "already gone" box was OUR release, and the reproduction is now the next drive Ruled by agent under ADR 0174 — veto anytime. Landed `c416b78` on `main`. **Who destroyed droplet `594627426` at 23:08:38Z:** not DO, not the broker's TTL (ledger: rented `21:37:06Z`, `expires` +24h), and not `oc_rented_teardown` (its release answered **400 — already released**). It was `journey.rented.spec.ts`'s own `test.afterAll`, which releases through the broker on every red, *inside* Playwright — before `oc_rented_cleanup → oc_droplet_evidence` ever ssh-es in. The "1s after the leg" was two 90-minute clocks coinciding (rent + the #698 ceiling). It never consulted `REHEARSAL_KEEP_RED_DROPLET`, so #704's keep rail could not keep a rented box. That is why #711, #712 and this red all arrived box-less. **What that changes about the model:** with the box provably up for the whole leg (DO action log) and sshd answering, `ServerAlive*` working exactly as designed is the *expected* outcome — keepalives only catch a peer that answers nothing. The stall is a live box whose **nix-daemon stopped moving** at ~98% (bandwidth floor from 22:10Z). Candidates the box-side capture will separate: daemon blocked on a remote substituter fetch with no `stalled-download-timeout` bite (`--substitute-on-destination` makes the *target* fetch stock paths), root-disk/inode exhaustion, memory pressure on the 4GB box, a store-lock wait. No fix attempted — none is warranted without that capture (GOTCHAS #62: no ceiling widening). **Landed so the next red answers this itself:** - `fixtures/rented.ts` `releaseOnTeardown(records, env)` — GREEN always releases; red/hung + `REHEARSAL_KEEP_RED_DROPLET=1` keeps the box (broker 24h TTL is the failsafe). `afterAll` consults it. - `oc_droplet_evidence` writes `logs/droplet-stall.txt` on every drive: nix/ssh/sops processes with `wchan`, `free`, `df / /nix`, established `:22` sockets, temproots, `dmesg` tail, nix-daemon journal. - elitebook-03 `rehearsal-env.sh` now exports `REHEARSAL_KEEP_RED_DROPLET=1`. - GOTCHAS #69. **Routing:** `deferred` (same as #712) and removed from #652's blockers — the standing drive re-fires and IS the reproduction; a red will now leave a live box for a hands-on look (`ssh root@<ip>` with the run's `state/rent-operator/id_ed25519`). A parallel off-drive reproduction script exists (`repro716.sh`: rents from image 242422012, pushes the run's toplevel with the exact `sshNGStore` invocation, box-side monitor every 30s) but droplet creation is outside what this session may do — Ben runs it if the drive's own capture is not enough.
Author
Member

Close report — the keepalive did not fail to fire; the CEILING fired and could not be heard

Ruled by agent under ADR 0174 — veto anytime. Landed cf0c1e67 on main, on top of this ticket's other session (c416b78, GOTCHAS #69). Two-way door: a revertible source change in internal/clan/cli.go, proven red-before-green by Go tests plus live probes on throwaway localhost processes. No credentials, no posture widening, no spend, nothing destroyed.

The answer to the question this ticket asked

ServerAliveInterval=30/CountMax=10 is wired into the exercised path, and it is not mistuned. It is a transport-liveness probe being asked to detect an application stall, which it cannot do by construction — and even if it had fired, ExecCLI.Run could not have reported it. Two defects stack, and either alone hid the other.

Cause 1 — the ceiling fired and could not speak. nix copy --to ssh-ng://… spawns ssh as a direct child, and ssh inherits nix's stderr — the very pipe ExecCLI.Run reads for the combined log and the live progress feed. When runPhase's 20m defaultPhaseTimeout cancels the context, os/exec SIGKILLs nix alone; a stalled ssh outlives it holding that pipe, cmd.Wait never sees EOF, and Run blocks forever on a ceiling it already enforced. No error, no Result, no event, no stage transition — which is exactly why "the DOM's last-activity line never advanced past 717/726".

Proven on the real nix process tree (/proc/<pid>/fd/2 read directly — pipe:[524858156] on both nix and ssh, the same object):

when the SIGKILL lands ssh the pipe reader
mid-healthy transfer exits in ~1s (its stdin pipe from nix closed → EOF) gets EOF; Wait returns
mid-stall — remote nix stopped, box still answering (this drive's condition) still alive at t+60s, still holding the pipe never gets EOF — cmd.Wait still blocked

That contrast is why this only ever bit the stalled drives, and why no previous investigation caught it.

And in the repo's own terms (internal/clan/cli_ceiling_test.go — a child that prints one line, forks a grandchild inheriting the pipes, then blocks; 1s ceiling):

cmd.WaitDelay outcome
unset (the shipped behaviour) Run still blocked 30s after a 1s ceiling
2s Run returns at 3.0s, rc 137, log intact

On this drive's timeline it closes: the copy's nix was demonstrably alive at 21:48Z (your own bandwidth series — ~3 Mbps of unsigned custom paths pushing over ssh-ng), so its 20-minute ceiling expired by 22:08Z at the latest. The series floors at 22:10Z — consistent with our own SIGKILL, not a spontaneous stall — and the leg then ran a further 58 minutes producing nothing.

Cause 2 — ServerAlive* was never the instrument for this. The probes ride the ssh protocol and prove the peer answers. A box that is up, whose sshd answers, but whose nix side has stopped, answers every probe and holds the connection open indefinitely. sshNGStore's own doc comment already said this; #67's calibration caveat already warned the bandwidth floor never proves the box was dead; and DO's "no power action" says the box was up.

Proven live — real sshd, real ssh transport, real nix copy to a real ssh-ng store — by SIGSTOPping the remote nix-daemon --stdio while the host stayed up. A fresh ssh login during each stall returned ANSWERING:

NIX_SSHOPTS its own window outcome
the shipped ServerAliveInterval=30 -o ServerAliveCountMax=10 300s nix copy still hanging at 421s — no error, last line copying path '…' to 'ssh-ng://dev@localhost'…, this drive's exact signature
ServerAliveInterval=5 -o ServerAliveCountMax=3 15s still hanging at 120s — 8× its own window

Tightening the probe changes nothing. #711's fix is correct for the fault it was built for (a peer that goes away) and blind to this one by design.

Cause 3, found by the fix's own test — the combined log was racing. stdout and stderr arrive on separate pipes with separate copy goroutines, and both wrote one unguarded bytes.Buffer. -race-proven and not theoretical: an eight-line script came back as four characters. Result.Output is the field Classify, logSaysFailed and excerpt all read — a corrupted log is a corrupted diagnosis, on exactly the runs that need one.

Your open question (3), settled so nobody re-walks it

nix's ssh-ng store re-execs ssh per invocation with NIX_SSHOPTS verbatim and multiplexes nothing. Live argv, captured mid-copy:

ssh dev@localhost -x -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
  -o ServerAliveInterval=30 -o ServerAliveCountMax=10 \
  -oPermitLocalCommand=yes -oLocalCommand=echo started -- nix-daemon --stdio --store …

No ControlMaster, no ControlPersist, nothing shared between the leg's path-info probe and its copy. That joins the env-layering hypothesis you had already refuted.

Questions (1) and (2) — rent a droplet and induce a real network fault; tcpdump the keepalives — are moot: a real network fault is #711's case and already fires correctly; and this stall is not a network fault at all, so there were no unanswered keepalives to capture.

Shipped

internal/clan/cli.go:

  • cmd.WaitDelay set from the new execWaitDelay (10s) — once the process is gone or done, the pipes get that long to drain and are then closed, so a fired ceiling is a Result rather than a silence.
  • the verdict is now read from the process's own ProcessState rather than the returned error, so exec.ErrWaitDelay can never demote a genuine exit code to the "could not start" bucket.
  • the writers the two streams share sit behind one lockedWriter.

Guarded by TestExecCLI_CeilingEndsTheInvocationEvenWhenAGrandchildHoldsTheOutputPipe, TestExecCLI_DrainWindowDoesNotTruncateAnInvocationThatFinishes, TestExecCLI_CombinedLogSurvivesBothStreamsAtOnce, TestExecCLI_ShipsADrainWindow — all red before, green after. Full go test ./... (and ./internal/clan -race) + go vet + gofmt clean.

Written up as GOTCHAS #70, beside this drive's other defect at #69. No ceiling was widened — #62 holds; this makes an existing ceiling audible for the first time.

What this now looks like on the next rented drive

The copy's 20m ceiling becomes enforceable: at ~20 minutes nix copy is killed, Run returns rc 137 within 10s, copy() takes its soft-continue path ("the system could not be copied ahead of the deploy … the deploy will copy it instead"), and the leg walks on to enroll-activate with ~68 minutes of the 90m budget left instead of burning it in silence.

Left open honestly

  • #717 (ready-for-session) — that enforceable 20m ceiling will now cut a cold rented copy: this drive's own was still going at ~28 minutes, at 717 of 726 paths. Cheap by design (copy() is an accelerator), but it is a guess where #68 wants a measurement. #69's keep-on-red + droplet-stall.txt is exactly the rail that measurement should ride.
  • #718 (ready-for-agent) — the SIGKILL still orphans the ssh (proven above: alive at t+60s). The drain window frees Run; it does not reap the tree. Needs its own red-before-green, since process-group signalling touches every invocation in the package including the PTY-driven ones.
  • Not yet re-proven on a rented drive. The mechanism is proven on the real nix process tree and the fix is proven red-before-green, but the next rented drive is the live confirmation.

Closing: the question this ticket asked is answered, and the defect that produced the red is fixed and tested.

## Close report — the keepalive did not fail to fire; the CEILING fired and could not be heard Ruled by agent under ADR 0174 — veto anytime. Landed `cf0c1e67` on `main`, on top of this ticket's other session (`c416b78`, GOTCHAS #69). **Two-way door:** a revertible source change in `internal/clan/cli.go`, proven red-before-green by Go tests plus live probes on throwaway localhost processes. No credentials, no posture widening, no spend, nothing destroyed. ### The answer to the question this ticket asked `ServerAliveInterval=30`/`CountMax=10` **is** wired into the exercised path, and it is not mistuned. It is a **transport**-liveness probe being asked to detect an **application** stall, which it cannot do by construction — and even if it *had* fired, `ExecCLI.Run` could not have reported it. Two defects stack, and either alone hid the other. **Cause 1 — the ceiling fired and could not speak.** `nix copy --to ssh-ng://…` spawns `ssh` as a **direct child**, and ssh **inherits nix's stderr** — the very pipe `ExecCLI.Run` reads for the combined log and the live progress feed. When `runPhase`'s 20m `defaultPhaseTimeout` cancels the context, os/exec SIGKILLs **nix alone**; a *stalled* ssh outlives it holding that pipe, `cmd.Wait` never sees EOF, and `Run` blocks **forever** on a ceiling it already enforced. No error, no `Result`, no event, no stage transition — which is exactly why "the DOM's last-activity line never advanced past 717/726". Proven on the **real nix process tree** (`/proc/<pid>/fd/2` read directly — `pipe:[524858156]` on *both* nix and ssh, the same object): | when the SIGKILL lands | ssh | the pipe reader | |---|---|---| | mid-**healthy** transfer | exits in ~1s (its stdin pipe from nix closed → EOF) | gets EOF; `Wait` returns | | mid-**stall** — remote nix stopped, box still answering (this drive's condition) | **still alive at t+60s**, still holding the pipe | **never gets EOF** — `cmd.Wait` still blocked | That contrast is why this only ever bit the *stalled* drives, and why no previous investigation caught it. And in the repo's own terms (`internal/clan/cli_ceiling_test.go` — a child that prints one line, forks a grandchild inheriting the pipes, then blocks; 1s ceiling): | `cmd.WaitDelay` | outcome | |---|---| | unset (the shipped behaviour) | `Run` **still blocked 30s** after a 1s ceiling | | `2s` | `Run` returns at **3.0s**, rc 137, log intact | **On this drive's timeline it closes:** the copy's `nix` was demonstrably alive at `21:48Z` (your own bandwidth series — ~3 Mbps of unsigned custom paths pushing over ssh-ng), so its 20-minute ceiling expired by `22:08Z` at the latest. The series floors at **`22:10Z`** — consistent with *our own* SIGKILL, not a spontaneous stall — and the leg then ran a further **58 minutes** producing nothing. **Cause 2 — `ServerAlive*` was never the instrument for this.** The probes ride the ssh protocol and prove the **peer** answers. A box that is up, whose sshd answers, but whose nix side has stopped, answers every probe and holds the connection open indefinitely. `sshNGStore`'s own doc comment already said this; #67's calibration caveat already warned the bandwidth floor never proves the box was dead; and DO's "no power action" says the box was up. Proven **live** — real sshd, real ssh transport, real `nix copy` to a real ssh-ng store — by SIGSTOPping the **remote** `nix-daemon --stdio` while the host stayed up. A fresh `ssh` login during each stall returned `ANSWERING`: | `NIX_SSHOPTS` | its own window | outcome | |---|---|---| | the shipped `ServerAliveInterval=30 -o ServerAliveCountMax=10` | 300s | `nix copy` **still hanging at 421s** — no error, last line `copying path '…' to 'ssh-ng://dev@localhost'…`, this drive's exact signature | | `ServerAliveInterval=5 -o ServerAliveCountMax=3` | 15s | **still hanging at 120s** — 8× its own window | Tightening the probe changes nothing. #711's fix is correct for the fault it was built for (a peer that goes away) and blind to this one by design. **Cause 3, found by the fix's own test** — the combined log was **racing**. stdout and stderr arrive on separate pipes with separate copy goroutines, and both wrote one unguarded `bytes.Buffer`. `-race`-proven and not theoretical: an eight-line script came back as **four characters**. `Result.Output` is the field `Classify`, `logSaysFailed` and `excerpt` all read — a corrupted log is a corrupted diagnosis, on exactly the runs that need one. ### Your open question (3), settled so nobody re-walks it nix's ssh-ng store **re-execs `ssh` per invocation with `NIX_SSHOPTS` verbatim and multiplexes nothing**. Live argv, captured mid-copy: ``` ssh dev@localhost -x -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ -o ServerAliveInterval=30 -o ServerAliveCountMax=10 \ -oPermitLocalCommand=yes -oLocalCommand=echo started -- nix-daemon --stdio --store … ``` No `ControlMaster`, no `ControlPersist`, nothing shared between the leg's path-info probe and its copy. That joins the env-layering hypothesis you had already refuted. Questions (1) and (2) — rent a droplet and induce a real network fault; `tcpdump` the keepalives — are **moot**: a real network fault is #711's case and already fires correctly; and this stall is *not* a network fault at all, so there were no unanswered keepalives to capture. ### Shipped `internal/clan/cli.go`: - `cmd.WaitDelay` set from the new `execWaitDelay` (**10s**) — once the process is gone or done, the pipes get that long to drain and are then closed, so a fired ceiling is a `Result` rather than a silence. - the verdict is now read from the process's own `ProcessState` rather than the returned error, so `exec.ErrWaitDelay` can never demote a genuine exit code to the "could not start" bucket. - the writers the two streams share sit behind one `lockedWriter`. Guarded by `TestExecCLI_CeilingEndsTheInvocationEvenWhenAGrandchildHoldsTheOutputPipe`, `TestExecCLI_DrainWindowDoesNotTruncateAnInvocationThatFinishes`, `TestExecCLI_CombinedLogSurvivesBothStreamsAtOnce`, `TestExecCLI_ShipsADrainWindow` — all red before, green after. Full `go test ./...` (and `./internal/clan -race`) + `go vet` + `gofmt` clean. Written up as **GOTCHAS #70**, beside this drive's other defect at **#69**. **No ceiling was widened — #62 holds**; this makes an existing ceiling audible for the first time. ### What this now looks like on the next rented drive The copy's 20m ceiling becomes enforceable: at ~20 minutes `nix copy` is killed, `Run` returns rc 137 within 10s, `copy()` takes its soft-continue path (*"the system could not be copied ahead of the deploy … the deploy will copy it instead"*), and the leg walks on to `enroll-activate` with **~68 minutes of the 90m budget left** instead of burning it in silence. ### Left open honestly - **#717** (`ready-for-session`) — that enforceable 20m ceiling will now **cut** a cold rented copy: this drive's own was still going at ~28 minutes, at 717 of 726 paths. Cheap by design (`copy()` is an accelerator), but it is a guess where #68 wants a measurement. #69's keep-on-red + `droplet-stall.txt` is exactly the rail that measurement should ride. - **#718** (`ready-for-agent`) — the SIGKILL still **orphans** the `ssh` (proven above: alive at t+60s). The drain window frees `Run`; it does not reap the tree. Needs its own red-before-green, since process-group signalling touches every invocation in the package including the PTY-driven ones. - **Not yet re-proven on a rented drive.** The mechanism is proven on the real nix process tree and the fix is proven red-before-green, but the next rented drive is the live confirmation. Closing: the question this ticket asked is answered, and the defect that produced the red is fixed and tested.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#716
No description provided.