device-add: an approved device never lands — the install one-liner's await dies at the Pending frontier and nothing resumes the join (drive approve, sig c1ac37bc5a0d) #952

Closed
opened 2026-08-28 19:23:37 +00:00 by matou-build-agent · 1 comment

Failure

The 20260828T185311Z device drive reds at the approve leg after burning the full 300s ceiling (artifacts/legs.json, "leg":"approve","status":"red","ms":300382; 23 of 24 legs green, artifacts/verdict.json firstRedLeg: approve). The bare message is a locator miss:

Locator: locator('[data-field="connected-device"]').or(locator('[data-status="pending-device-error"]')).first()
Error: element(s) not found

The Playwright ARIA snapshot in artifacts/journey.device-device-add--809eb-e-standing-rented-community/error-context.md names what the strip actually held for those five minutes:

clan-lab-rehearsal-b3189478 approved — joining now. Waiting for the device to join the community network, install its certificates, and bring its connection up. It will appear as connected when it truly is.

That is data-status="approved-joining" (dashboard/src/components/device-add/PendingDevicesSurface.vue:20-29). So the Approve verb landed cleanly — the control plane minted the grant, the row moved pending → approved, no pending-device-error. The row simply never reached enrolled, and ConnectedScreen only renders at phase === 'enrolled' (PendingDevicesSurface.vue:31-35). The drive's .or() race (app/tests/e2e/fixtures/deviceAdd.ts:202-209) has no third arm for "approved but never confirmed", so it waited out the ceiling and reported "element not found".

Why it never confirmed: the awaiting process was already dead

The device journal shows the join PTY (session-12, which ran the curl … /get | sh -s -- <code> one-liner) exit cleanly, client-initiated, at 19:10:16 — one second before the approve leg began (logs/device-journal.txt):

19:09:30  Started session-12.scope - Session 12 of User root
19:09:31  Reloading requested from client PID 8032 ('systemctl') (unit session-12.scope)
19:09:32  Started idss-agent.service - IDSS agent (ADR 0053)
19:09:32  idss-agent[8119]: msg="join socket listening" path=/run/idss/agent.sock
19:10:10  Reloading requested from client PID 9017 ('systemctl') (unit session-12.scope)   ← netbird install
19:10:11  Started netbird.service - NetBird mesh network client
19:10:16  Received disconnect from 179.65.135.113 port 41253:11: disconnected by user
19:10:16  session-12.scope: Deactivated successfully

The join leg is green at 46315ms, i.e. it broke on the waiting for the operator frontier at ~19:10:15-16 — the same second the process exited. join.RunInstallCommand is supposed to be structurally unable to exit before the decision lands (internal/join/cli.go:296-307, folding in AwaitAndLand at cli.go:227-252, per #939), and AwaitDecision loops forever on an unchanged view. But it returns on the first Poll error with no retry:

  • internal/join/join.go:266-269 — view, err := o.cfg.ControlPlane.Poll(ctx, id, wait); if err != nil { return Decision{}, err }
  • the poll is a live HTTPS long-poll to the community apex through Caddy (internal/enrollwire/client.go:71-80), so one transport blip on a public path ends a wait that is meant to run minutes.

A prompt exit ~1s after the frontier line fits an immediate Poll failure. The exact error is not recoverable from this run — see the evidence gap below.

Nothing resumes a join whose terminal died

This is the part that makes it terminal rather than transient. The standing idss-agent.service was up the whole time (join socket listening, 19:09:32) and logged nothing for the remaining six minutes. join.Orchestrator.Resume (internal/join/resume.go:35) — written for exactly this ("a crash or reboot mid-join must never … strand the device", #68) — has no production caller: grep -rn '\.Resume(' --include=*.go outside _test.go hits founding, clan, backup, monitor and never internal/join. So once the foreground install process is gone, the operator's approval is stranded permanently: the grant is minted, the code is spent, and the strip sits at "approved — joining now" forever with no path to Enrolled and no error. A real operator hits the identical dead end.

Suspected layer

Agent / internal/join (Go), on the device end. Not the dashboard (it rendered the honest Approved→Enrolled split correctly), not the control plane (the approve succeeded, community CA wired at logs/gateway-journal.txt 19:08:54, no refusal), not the drive fixture (its locators are right; it just has no arm for this state).

What plugging it needs

  1. Harvest the evidence that names the death. app/tests/e2e/journey.device.spec.ts:569-571 writes join-transcript.txt only after approvePending returns — so on an approve red the held PTY's transcript and exit code, the single most causative record, are never written. artifacts/join-transcript.txt is absent from this run for exactly that reason. The approve leg should race approvePending against joinPty.done and red at once with the agent's own words and exit code, the way #945 taught it to race the refusal state. Related: app/tests/e2e/fixtures/legframe.ts:48-64 only screenshots app.windows() (Electron), so every dashboard-era leg frame is byte-identical (md5sum artifacts/legs/*-w1.png — one hash across standing, mint, device-create, agent-install, decline-resume, join, approve); the dash CDP page is never captured. Only Playwright's own error-context.md saved this diagnosis.
  2. Harden the await. AwaitDecision (internal/join/join.go:264-282) should survive a transient Poll transport fault — retry with backoff against the caller's context — rather than ending the join on the first one. A permanent/typed enroll error should still fail loud (ADR 0100).
  3. Wire the resume. The standing agent service must pick up a join whose terminal is gone. Resume needs the code, so this requires deciding what the agent persists about an in-flight request — that is the ruling this ticket is blocked on (ADR 0209 territory). Until it exists, a lost terminal = a permanently stranded approval, which is the operator-visible bug here.

Minor, non-causative

artifacts/enrollment-code.txt and artifacts/install-command.txt still hold the first, declined-and-spent code (BL97-SAM7-Z8PJ-JAH9-M2CS, see artifacts/decline-transcript.txt). The decline-resume leg re-mints at journey.device.spec.ts:481-483 but never rewrites those artifacts, so the run's headline evidence names a code the failing legs did not use.

drive 20260828T185311Z red at approve: expect(locator).toBeVisible() failed Locator: locator('[data-field="connected-device"]').or(locator('[data-status="pending-device-error"]')).first() Expected: visible Timeout: 300000ms Error: element(
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T185311Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure The `20260828T185311Z` device drive reds at the `approve` leg after burning the full 300s ceiling (`artifacts/legs.json`, `"leg":"approve","status":"red","ms":300382`; 23 of 24 legs green, `artifacts/verdict.json` `firstRedLeg: approve`). The bare message is a locator miss: ``` Locator: locator('[data-field="connected-device"]').or(locator('[data-status="pending-device-error"]')).first() Error: element(s) not found ``` The Playwright ARIA snapshot in `artifacts/journey.device-device-add--809eb-e-standing-rented-community/error-context.md` names what the strip actually held for those five minutes: > `clan-lab-rehearsal-b3189478 approved — joining now. Waiting for the device to join the community network, install its certificates, and bring its connection up. It will appear as connected when it truly is.` That is `data-status="approved-joining"` (`dashboard/src/components/device-add/PendingDevicesSurface.vue:20-29`). So **the Approve verb landed cleanly** — the control plane minted the grant, the row moved `pending` → `approved`, no `pending-device-error`. The row simply never reached `enrolled`, and `ConnectedScreen` only renders at `phase === 'enrolled'` (`PendingDevicesSurface.vue:31-35`). The drive's `.or()` race (`app/tests/e2e/fixtures/deviceAdd.ts:202-209`) has no third arm for "approved but never confirmed", so it waited out the ceiling and reported "element not found". ## Why it never confirmed: the awaiting process was already dead The device journal shows the join PTY (`session-12`, which ran the `curl … /get | sh -s -- <code>` one-liner) exit **cleanly, client-initiated, at 19:10:16** — one second before the `approve` leg began (`logs/device-journal.txt`): ``` 19:09:30 Started session-12.scope - Session 12 of User root 19:09:31 Reloading requested from client PID 8032 ('systemctl') (unit session-12.scope) 19:09:32 Started idss-agent.service - IDSS agent (ADR 0053) 19:09:32 idss-agent[8119]: msg="join socket listening" path=/run/idss/agent.sock 19:10:10 Reloading requested from client PID 9017 ('systemctl') (unit session-12.scope) ← netbird install 19:10:11 Started netbird.service - NetBird mesh network client 19:10:16 Received disconnect from 179.65.135.113 port 41253:11: disconnected by user 19:10:16 session-12.scope: Deactivated successfully ``` The `join` leg is green at 46315ms, i.e. it broke on the `waiting for the operator` frontier at ~19:10:15-16 — the same second the process exited. `join.RunInstallCommand` is supposed to be structurally unable to exit before the decision lands (`internal/join/cli.go:296-307`, folding in `AwaitAndLand` at `cli.go:227-252`, per #939), and `AwaitDecision` loops forever on an unchanged view. But it returns on the **first** `Poll` error with no retry: - `internal/join/join.go:266-269` — `view, err := o.cfg.ControlPlane.Poll(ctx, id, wait); if err != nil { return Decision{}, err }` - the poll is a live HTTPS long-poll to the community apex through Caddy (`internal/enrollwire/client.go:71-80`), so one transport blip on a public path ends a wait that is meant to run minutes. A prompt exit ~1s after the frontier line fits an immediate `Poll` failure. The exact error is **not recoverable from this run** — see the evidence gap below. ## Nothing resumes a join whose terminal died This is the part that makes it terminal rather than transient. The standing `idss-agent.service` was up the whole time (`join socket listening`, 19:09:32) and logged **nothing** for the remaining six minutes. `join.Orchestrator.Resume` (`internal/join/resume.go:35`) — written for exactly this ("a crash or reboot mid-join must never … strand the device", #68) — **has no production caller**: `grep -rn '\.Resume(' --include=*.go` outside `_test.go` hits `founding`, `clan`, `backup`, `monitor` and never `internal/join`. So once the foreground `install` process is gone, the operator's approval is stranded permanently: the grant is minted, the code is spent, and the strip sits at "approved — joining now" forever with no path to `Enrolled` and no error. A real operator hits the identical dead end. ## Suspected layer Agent / `internal/join` (Go), on the device end. Not the dashboard (it rendered the honest Approved→Enrolled split correctly), not the control plane (the approve succeeded, `community CA wired` at `logs/gateway-journal.txt` 19:08:54, no refusal), not the drive fixture (its locators are right; it just has no arm for this state). ## What plugging it needs 1. **Harvest the evidence that names the death.** `app/tests/e2e/journey.device.spec.ts:569-571` writes `join-transcript.txt` only *after* `approvePending` returns — so on an approve red the held PTY's transcript and exit code, the single most causative record, are never written. `artifacts/join-transcript.txt` is absent from this run for exactly that reason. The `approve` leg should race `approvePending` against `joinPty.done` and red at once with the agent's own words and exit code, the way #945 taught it to race the refusal state. Related: `app/tests/e2e/fixtures/legframe.ts:48-64` only screenshots `app.windows()` (Electron), so every dashboard-era leg frame is byte-identical (`md5sum artifacts/legs/*-w1.png` — one hash across `standing`, `mint`, `device-create`, `agent-install`, `decline-resume`, `join`, `approve`); the `dash` CDP page is never captured. Only Playwright's own `error-context.md` saved this diagnosis. 2. **Harden the await.** `AwaitDecision` (`internal/join/join.go:264-282`) should survive a transient `Poll` transport fault — retry with backoff against the caller's context — rather than ending the join on the first one. A permanent/typed enroll error should still fail loud (ADR 0100). 3. **Wire the resume.** The standing agent service must pick up a join whose terminal is gone. `Resume` needs the code, so this requires deciding what the agent persists about an in-flight request — **that is the ruling this ticket is blocked on** (ADR 0209 territory). Until it exists, a lost terminal = a permanently stranded approval, which is the operator-visible bug here. ## Minor, non-causative `artifacts/enrollment-code.txt` and `artifacts/install-command.txt` still hold the **first, declined-and-spent** code (`BL97-SAM7-Z8PJ-JAH9-M2CS`, see `artifacts/decline-transcript.txt`). The `decline-resume` leg re-mints at `journey.device.spec.ts:481-483` but never rewrites those artifacts, so the run's headline evidence names a code the failing legs did not use. drive `20260828T185311Z` red at `approve`: `expect(locator).toBeVisible() failed Locator: locator('[data-field="connected-device"]').or(locator('[data-status="pending-device-error"]')).first() Expected: visible Timeout: 300000ms Error: element(` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T185311Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: c1ac37bc5a0d -->
Author
Member

Close-report — ruled by agent under ADR 0174 (veto anytime).

What landed (two-way doors, proven offline)

The causative fix — 587ad445 (internal/join/join.go). The reported red was AwaitDecision returning on the first ControlPlane.Poll error. On this drive that first error was a transport blip on the minutes-long HTTPS long-poll to the community apex through Caddy; the install one-liner's foreground process exited ~1s past the waiting-for-operator frontier (matching the 19:10:16 client-initiated session-12.scope deactivation in the device journal), the row stayed approved-joining, and nothing drove it to Enrolled. AwaitDecision now classifies a Poll failure rather than ending on it:

  • the caller's context ending (SIGINT / a network the caller gave up on) still stops — the request stays Pending (Resume territory);
  • a typed enroll verdict (enroll.DeviceScreenFor ok) still fails loud (ADR 0100) — a decision is never retried;
  • a transport fault backs off (Config.PollBackoff floor 2s, doubling to a 30s cap) and re-polls — a blip no longer ends a join the operator may still be deciding.

Proof (red-first): TestAwait_SurvivesTransientPollFault — three transient Poll faults, then the await survives and lands the since-approved request (asserts it polled past the faults); TestAwait_FailsLoudOnTypedEnrollFault — a typed verdict returns at once, exactly one poll, no retry. go build/go vet clean; the internal/join + internal/enroll + internal/enrollwire suites pass.

Diagnostics — 7f0f7875 (the drive's own evidence).

  • legframe.ts: the per-leg capturer now screenshots the dashboard ceremony page (<name>-dash.png), not just the byte-identical Electron shell — the dashboard renders in a CDP-attached page app.windows() never held, which is why only Playwright's error-context.md saved the original diagnosis. Read lazily (the dash page is assigned mid-leg-1, after the capturer is installed); best-effort/swallowed as before. Typecheck (vue-tsc) + the legframe unit test green.
  • journey.device.spec.ts: the decline-resume re-mint now rewrites enrollment-code.txt / install-command.txt to the re-minted code the join/approve legs actually run — the mint-leg copies named the declined-and-spent code.

The prior session's held-PTY harvest on an approve red (81823664) stands — a future approve red now writes join-transcript.txt + join-exit.txt with the agent's own words and exit code before the wait can red.

What is deliberately NOT in this ticket — split to #953

The other root cause the diagnosis named — a join whose terminal truly dies (crash / reboot / lost SSH) has no resumer, because join.Orchestrator.Resume has no production caller — is genuine defense-in-depth but is blocked on a ruling: what does the agent persist about an in-flight request so a standing agent can Resume it (ADR 0209 territory). That is not a cheap two-way door to improvise unattended, so it is filed as #953 (ready-for-session) carrying a concrete proposed default ruling (persist a {code, requestID} anchor beside the durable device key; resume-loop it at agent startup; proven by a seam test) that a future session can adopt under ADR 0174. #952's own reported red — the transient-blip strand — is fixed here and does not wait on #953.

STATUS.md

Updated in 587ad445 (header lead + the #945 demotion).

Closing: the causative await-strand is fixed and proven at the seam, the drive's diagnostics are in place, and the residual resume-resilience is tracked in #953. Integration confirmation is the next standing device drive.

**Close-report — ruled by agent under ADR 0174 (veto anytime).** ## What landed (two-way doors, proven offline) **The causative fix — `587ad445` (`internal/join/join.go`).** The reported red was `AwaitDecision` returning on the *first* `ControlPlane.Poll` error. On this drive that first error was a transport blip on the minutes-long HTTPS long-poll to the community apex through Caddy; the install one-liner's foreground process exited ~1s past the waiting-for-operator frontier (matching the `19:10:16` client-initiated `session-12.scope` deactivation in the device journal), the row stayed `approved-joining`, and nothing drove it to `Enrolled`. `AwaitDecision` now **classifies** a Poll failure rather than ending on it: - the caller's context ending (SIGINT / a network the caller gave up on) still stops — the request stays Pending (Resume territory); - a **typed enroll verdict** (`enroll.DeviceScreenFor` ok) still **fails loud** (ADR 0100) — a decision is never retried; - a **transport fault** backs off (`Config.PollBackoff` floor 2s, doubling to a 30s cap) and **re-polls** — a blip no longer ends a join the operator may still be deciding. Proof (red-first): `TestAwait_SurvivesTransientPollFault` — three transient Poll faults, then the await survives and lands the since-approved request (asserts it polled past the faults); `TestAwait_FailsLoudOnTypedEnrollFault` — a typed verdict returns at once, exactly one poll, no retry. `go build`/`go vet` clean; the `internal/join` + `internal/enroll` + `internal/enrollwire` suites pass. **Diagnostics — `7f0f7875` (the drive's own evidence).** - `legframe.ts`: the per-leg capturer now screenshots the **dashboard ceremony page** (`<name>-dash.png`), not just the byte-identical Electron shell — the dashboard renders in a CDP-attached page `app.windows()` never held, which is why only Playwright's `error-context.md` saved the original diagnosis. Read lazily (the dash page is assigned mid-leg-1, after the capturer is installed); best-effort/swallowed as before. Typecheck (`vue-tsc`) + the `legframe` unit test green. - `journey.device.spec.ts`: the decline-resume re-mint now **rewrites** `enrollment-code.txt` / `install-command.txt` to the re-minted code the join/approve legs actually run — the mint-leg copies named the declined-and-spent code. The prior session's held-PTY harvest on an approve red (`81823664`) stands — a future approve red now writes `join-transcript.txt` + `join-exit.txt` with the agent's own words and exit code before the wait can red. ## What is deliberately NOT in this ticket — split to #953 The other root cause the diagnosis named — a join whose terminal **truly** dies (crash / reboot / lost SSH) has no resumer, because `join.Orchestrator.Resume` has no production caller — is genuine defense-in-depth but is **blocked on a ruling**: what does the agent persist about an in-flight request so a standing agent can `Resume` it (ADR 0209 territory). That is not a cheap two-way door to improvise unattended, so it is filed as **#953** (`ready-for-session`) carrying a concrete **proposed default ruling** (persist a `{code, requestID}` anchor beside the durable device key; resume-loop it at agent startup; proven by a seam test) that a future session can adopt under ADR 0174. #952's own reported red — the transient-blip strand — is fixed here and does not wait on #953. ## STATUS.md Updated in `587ad445` (header lead + the #945 demotion). Closing: the causative await-strand is fixed and proven at the seam, the drive's diagnostics are in place, and the residual resume-resilience is tracked in #953. Integration confirmation is the next standing device drive.
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#952
No description provided.