device-add: decline-and-resume — Clean decline teardown and crash-safe resume #68
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.
Depends on
Reference
Matou/idss#68
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?
Parent
Feature spec: #13 (device-add).
What to build
The two ways a join can end without enrolling — an operator changing their mind, and a machine that crashed mid-join — both left honest. On decline (P2-S4 decline / P3-S4x) the request goes terminal, the code is consumed, and the agent is informed so the device holds nothing of the community: a VM-mode join removes its local VM; a full-install join has no VM and the agent removes itself. The declined device's owner (P3-S4x) lands back at Welcome once teardown completes — or, with a fresh code from the operator, joins again as a new request. The decline reaches the owner as an outcome, not an error: when the agent polls it receives the Closure (reason + self-removal directive) and the screen states plainly what happened and what was removed.
Resume makes a crash or reboot mid-join safe. When the agent restarts with its persisted device key and re-redeems the same code, it rejoins its existing request rather than opening a second one — the (code, KeyID) idempotency anchor — so the operator never sees two pending cards for one machine. A re-pair returns the existing Pending, and an approval that was lost in the crash is re-delivered verbatim.
Acceptance criteria
Blocked by
Task manifest
Done in commit
136a094(sandcastle: device-add:decline-and-resume #68).Decline (stories 21/22) — proven at the ADR 0057 seam (
internal/join/resume_test.go, real enroll ledger + clock, fake VM manager / self-remover): the operator's Decline goes terminal, consumes the code, and the agent's poll succeeds carrying the Closure — never a transport error — then runs the directed teardown itself (VM mode removes its local guest; a full install self-removes). The card leaves the pending list; a fresh code joins again as a NEW request; re-typing the spent code shows the honest used-up screen.Resume (story 24) —
enroll.Redeem's (code, KeyID) anchor now outranks the code taxonomy for the bound key (internal/enroll/ledger.go): a code bound to THIS key always rejoins its own request, even after being spent by that request's own approval or decline (other keys still get consumed/revoked/expired). Newjoin.Resume(internal/join/resume.go): a fresh orchestrator over the persisted key + code rejoins the existing request, a re-pair returns the existing Pending (never two pending cards for one machine), a lost approval is re-delivered verbatim (same setup key/cert) and completes to Enrolled, a lost decline delivers its Closure and tears down on restart.Screens —
app/src/components/device-add/DeclinedScreen.vueships P3-S4x to the wireframe contract (checklist ✓/✕, warn copy,data-action="remove-the-vm"→ Welcome,data-action="join-with-a-new-code"→ P3-S2, LOGGED chip), rendered byJoinProgressSurfaceat phasedeclined, plus a teardown line naming exactly what was removed once it ran. The P2-S4 dashboard decline shipped with #60 and needed nothing new.Evidence: 6 new Go seam tests +
TestCrashResend_SpentCodeStillRejoins(enroll) + 6 Vue tests; full Go suite, all four TS workspaces (386 vitest tests), vue-tsc and eslint green.enroll-copy's ceiling to a measured rented copy — with #716's drain fix the shared 20mdefaultPhaseTimeoutnow CUTS a cold copy instead of hanging on it #717enroll-copy's shipped ServerAliveInterval=30/CountMax=10 did not terminate a live stallednix copy, ran the full 90m ceiling — the fix's synthetic proof does not match live behaviour #716enroll-copy's ceiling to a measured rented copy — with #716's drain fix the shared 20mdefaultPhaseTimeoutnow CUTS a cold copy instead of hanging on it #717approve, sig c1ac37bc5a0d) #952