rehearsal drive red at consent #597

Closed
opened 2026-08-19 20:24:45 +00:00 by matou-build-agent · 1 comment

(headless diagnosis unparseable — raw stdout saved to logs/reporter-claude.out)

drive 20260819T202246Z red at consent: the terminal join exited N --- transcript --- Warning: Permanently added 'N.N.N.N' (EDN) to the list of known hosts. time=N-N-NTN:N:N.NZ level=ERROR msg="enroll did not reach Pending" component=agent err="enrollwire: POST http://enroll-relay/api/vN/enroll/redeem: Post \"http://enroll-relay/api/vN/enroll/redeem\": di Connection to N.N.N.N closed.
evidence: test-results/…/20260819T202246Z/ on matou-workstation (legs.json, droplet-journal.txt, trace)

(headless diagnosis unparseable — raw stdout saved to logs/reporter-claude.out) drive `20260819T202246Z` red at `consent`: `the terminal join exited N --- transcript --- Warning: Permanently added 'N.N.N.N' (EDN) to the list of known hosts. time=N-N-NTN:N:N.NZ level=ERROR msg="enroll did not reach Pending" component=agent err="enrollwire: POST http://enroll-relay/api/vN/enroll/redeem: Post \"http://enroll-relay/api/vN/enroll/redeem\": di Connection to N.N.N.N closed. ` evidence: `test-results/…/20260819T202246Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) <!-- rehearsal-sig: 28ff46f6d26f -->
Author
Member

Close report — Ruled by agent under ADR 0174 — veto anytime

Root cause found (evidence: test-results/drive-selfhosted/20260819T202246Z on matou-workstation, logs/droplet-journal.txt + artifacts/legs.json/consent-transcript.txt): /run is tmpfs, wiped on every boot, and nothing ever created /run/ourcloud on a fresh droplet. Three independent binds raced that missing directory:

  1. ourcloud-agent.service (agent join) failed its own agent.sock listen — listen unix /run/ourcloud/agent.sock: bind: no such file or directory — and crash-looped past systemd's restart-burst limit within about a second (Start request repeated too quickly).
  2. sshd's remote-forward -R bind for the #594 relay carrier's enroll-relay.sock failed the same way (unix_listener: cannot bind to path /run/ourcloud/enroll-relay.sock: No such file or directory) — sshd refuses to mkdir a missing parent.
  3. The terminal agent enroll <code> consent step's dial onto that same relay socket inherited the failure (enrollwire: ... dial unix /run/ourcloud/enroll-relay.sock: connect: no such file or directory) — this is the exact red the drive reported.

The systemd unit (internal/install/install.go's unitFile()) carries no RuntimeDirectory=, and this gap predates #594 — unchanged since #192 (e3c2f0f). The three prior selfhosted drives on disk (20260815T071449Z, 20260819T163919Z, 20260819T184900Z) all hit the identical signature, earlier in the sequence (inside the install command itself, before the consent leg existed as a separate step) — this was never a flake.

Fix (commit 95c428f, pushed to main): a new listenUnixSocket() in agent/cmd/agent/main.go — the one place in the join path that binds first — MkdirAlls the parent directory before net.Listen. Once agent join is up, /run/ourcloud exists for good (tmpfs persists until reboot, and a reboot re-runs agent join at boot anyway), so both the relay forwarder's next retry and the later agent enroll dial find it already there. No systemd-unit or install-script change needed — both already just re-exec ourcloud-agent join.

Proof:

  • Two new tests reproducing the exact bind semantics from the evidence, red before the fix (compile failure — listenUnixSocket didn't exist), green after: TestListenUnixSocket_CreatesMissingParentDir, TestListenUnixSocket_ClearsStaleSocket (agent/cmd/agent/main_test.go).
  • Full suites green: go test ./agent/... ./internal/fleetwire/... ./internal/install/... ./internal/founding/... (both default and -tags dev builds), go vet ./... clean.

Honest residual — not blocking this ticket, named rather than assumed away: a live re-drive of the actual rehearsal journey needs get.idss.nz (the founding-time agent bootstrap host, ADR 0054) reseeded with a build past 95c428f — it currently serves a pin 7 commits stale as of ticket-filing (75dfba9, predating even #594), independent of this fix. That host has no deploy tooling in this repo and was unreachable from this session (ssh root@get.idss.nz timed out on port 22; no known SSH door). Confirming this exact drive-red signature is gone end-to-end is therefore the standing rehearsal ratchet's job on its next natural re-drive once that pin refreshes, not something this session can force.

Ruling: two-way door throughout — a commit (revertible) proven by an existing/new test (ADR 0174 rule 1). No security-posture widening, no credentials, no data destruction, no live-infra mutation. Veto anytime.

## Close report — Ruled by agent under ADR 0174 — veto anytime **Root cause found** (evidence: `test-results/drive-selfhosted/20260819T202246Z` on matou-workstation, `logs/droplet-journal.txt` + `artifacts/legs.json`/`consent-transcript.txt`): `/run` is tmpfs, wiped on every boot, and **nothing ever created `/run/ourcloud`** on a fresh droplet. Three independent binds raced that missing directory: 1. `ourcloud-agent.service` (`agent join`) failed its own `agent.sock` listen — `listen unix /run/ourcloud/agent.sock: bind: no such file or directory` — and crash-looped past systemd's restart-burst limit within about a second (`Start request repeated too quickly`). 2. sshd's remote-forward `-R` bind for the #594 relay carrier's `enroll-relay.sock` failed the same way (`unix_listener: cannot bind to path /run/ourcloud/enroll-relay.sock: No such file or directory`) — sshd refuses to `mkdir` a missing parent. 3. The terminal `agent enroll <code>` consent step's dial onto that same relay socket inherited the failure (`enrollwire: ... dial unix /run/ourcloud/enroll-relay.sock: connect: no such file or directory`) — this is the exact red the drive reported. The systemd unit (`internal/install/install.go`'s `unitFile()`) carries no `RuntimeDirectory=`, and this gap predates #594 — unchanged since #192 (`e3c2f0f`). The three prior selfhosted drives on disk (`20260815T071449Z`, `20260819T163919Z`, `20260819T184900Z`) all hit the identical signature, earlier in the sequence (inside the install command itself, before the consent leg existed as a separate step) — this was never a flake. **Fix** (commit `95c428f`, pushed to `main`): a new `listenUnixSocket()` in `agent/cmd/agent/main.go` — the one place in the join path that binds first — `MkdirAll`s the parent directory before `net.Listen`. Once `agent join` is up, `/run/ourcloud` exists for good (tmpfs persists until reboot, and a reboot re-runs `agent join` at boot anyway), so both the relay forwarder's next retry and the later `agent enroll` dial find it already there. No systemd-unit or install-script change needed — both already just re-exec `ourcloud-agent join`. **Proof:** - Two new tests reproducing the exact bind semantics from the evidence, red before the fix (compile failure — `listenUnixSocket` didn't exist), green after: `TestListenUnixSocket_CreatesMissingParentDir`, `TestListenUnixSocket_ClearsStaleSocket` (`agent/cmd/agent/main_test.go`). - Full suites green: `go test ./agent/... ./internal/fleetwire/... ./internal/install/... ./internal/founding/...` (both default and `-tags dev` builds), `go vet ./...` clean. **Honest residual — not blocking this ticket, named rather than assumed away:** a live re-drive of the actual rehearsal journey needs `get.idss.nz` (the founding-time agent bootstrap host, ADR 0054) reseeded with a build past `95c428f` — it currently serves a pin 7 commits stale as of ticket-filing (`75dfba9`, predating even #594), independent of this fix. That host has no deploy tooling in this repo and was unreachable from this session (`ssh root@get.idss.nz` timed out on port 22; no known SSH door). Confirming this exact drive-red signature is gone end-to-end is therefore the standing rehearsal ratchet's job on its next natural re-drive once that pin refreshes, not something this session can force. **Ruling:** two-way door throughout — a commit (revertible) proven by an existing/new test (ADR 0174 rule 1). No security-posture widening, no credentials, no data destruction, no live-infra mutation. Veto anytime.
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#597
No description provided.