You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nuke --delete-devices skips a quarantined device, so a stranded one keeps its capacity slot #1517
`NukeService#resetDevice` (`src/core/nuke-service.ts:176-184`) destroys a device only when it is `shutdown` (`#currentShutdown`, line 191). A `quarantined` device is skipped. The user docs say `--delete-devices` deletes every simulator and emulator Simlock created (`website/src/content/docs/docs/worker/cleanup.mdx:116`).
This matters most for a device left by `device.quarantine-stranded`: the core manual says it keeps its capacity slot and gets no further retry (`src/core/AGENTS.md`, Reclaim and quarantine). Nothing then removes it: nuke skips it, and `ManagedDeviceLifecycle.destroy` accepts only `provisioning` and `shutdown` (`src/core/managed-device-lifecycle.ts:196`).
Found by reading the code while triaging #1487. Not reproduced as a test.
Confirmed. Branch bug/1517-repro, src/core/nuke.test.ts, "with --delete-devices deletes quarantined virtual devices, one waiting for a retry and one stranded". It runs Nuke.run against the real lease engine.
pnpm exec vitest run --project unit src/core/nuke.test.ts
AssertionError: expected [] to deeply equal [ 'dev_1', 'dev_2' ]
❯ src/core/nuke.test.ts:135 expect(result.deletedDevices).toEqual([waitingId, strandedId])
Correction to the body: a daemon restart does retry a stranded device once more (startup-converger.ts:48 → QuarantineCoordinator.restore, quarantine-coordinator.ts:161). Nothing else removes it.
Root cause
Defect. NukeService#currentShutdown (src/core/nuke-service.ts:195) picks only shutdown devices to destroy. ManagedDeviceLifecycle.destroy (src/core/managed-device-lifecycle.ts:196,206) accepts only provisioning and shutdown. So nuke never destroys a quarantined device, even though quarantined → deleted is a legal edge (domain.ts:523) and the user docs promise every device is deleted (cleanup.mdx:116).
Simplest fix
Accept quarantined in destroy's claim and commit states. Have #currentShutdown take shutdown or quarantined. Drop quarantineAttempts, quarantineNextRetryAt and quarantinedAt in transition (domain.ts:585) so the deleted row carries none of them. Change the core manual's Nuke line to match.
3 files, +19 −7
pnpm exec vitest run --project unit src/core/nuke.test.ts src/core/nuke-service.test.ts \
src/core/managed-device-lifecycle.test.ts src/core/domain.test.ts \
src/core/quarantine-coordinator.test.ts src/core/registry.test.ts \
src/core/registry-state-db.test.ts src/core/cleanup-executor.test.ts
Tests 259 passed (259)
pnpm test:changed: 12 failures in src/agent-device/{edge,edge-lease-end,gateway-front}.test.ts, all also failing with the fix removed
Alternatives rejected
Give nuke a destroy through QuarantineCoordinator: a second destroy path; core requires every driver verb to go through ManagedDeviceLifecycle.
Call registry.deleteQuarantined from the lifecycle: ManagedDeviceRegistry would need a new method just to do what transitionDevice already does.
Risk
Other destroy callers (cleanup, failed boot) choose by state before calling it, so none of them passes a quarantined device now. Check that this holds.
A quarantine retry still running holds the reclaim claim, so nuke skips that device and the retry deletes it.
A plain nuke still leaves a quarantined device as it is.
Done: PR #1520 (draft, branch bug/1517, head 3abd48d). nuke --delete-devices now destroys quarantined virtual devices, and transition clears the three quarantine fields on → deleted. Review found R1 (fields stripped twice) and R2 (manual line restated code); both are fixed. origin/main (#1518, provisioning) was merged in, and the conflicts were resolved and reviewed.
Not done: R3, open at the round cap.
Findings: R3, from the code lens at the final fix-check. Fix 17d876d removed the strip from Registry.deleteQuarantined (src/core/registry.ts:460). transitionPhysical (src/core/domain.ts:634) strips nothing, so a physical device unenrolled after its quarantine retries run out keeps quarantineAttempts, quarantineNextRetryAt and quarantinedAt on its deleted row. A probe showed this. Fix: strip on → deleted in transitionPhysical too, and assert it for a physical device.
Blocked on: the maintainer decides whether to approve a fix run for R3 and a new fix-check beyond the cap (rule 14).
Merged: #1520 (#1517)
Decided: #1517 — one more fix run and fix-check for R3 beyond the round cap → taken, as the maintainer re-ran deliver on the parked PR
Activity
V3RON commentedon Nov 10, 2026
Reproduction
Confirmed. Branch
bug/1517-repro,src/core/nuke.test.ts, "with --delete-devices deletes quarantined virtual devices, one waiting for a retry and one stranded". It runsNuke.runagainst the real lease engine.Correction to the body: a daemon restart does retry a stranded device once more (
startup-converger.ts:48→QuarantineCoordinator.restore,quarantine-coordinator.ts:161). Nothing else removes it.Root cause
Defect.
NukeService#currentShutdown(src/core/nuke-service.ts:195) picks onlyshutdowndevices to destroy.ManagedDeviceLifecycle.destroy(src/core/managed-device-lifecycle.ts:196,206) accepts onlyprovisioningandshutdown. So nuke never destroys aquarantineddevice, even thoughquarantined → deletedis a legal edge (domain.ts:523) and the user docs promise every device is deleted (cleanup.mdx:116).Simplest fix
Accept
quarantinedindestroy's claim and commit states. Have#currentShutdowntakeshutdownorquarantined. DropquarantineAttempts,quarantineNextRetryAtandquarantinedAtintransition(domain.ts:585) so the deleted row carries none of them. Change the core manual's Nuke line to match.Alternatives rejected
QuarantineCoordinator: a second destroy path; core requires every driver verb to go throughManagedDeviceLifecycle.registry.deleteQuarantinedfrom the lifecycle:ManagedDeviceRegistrywould need a new method just to do whattransitionDevicealready does.Risk
destroycallers (cleanup, failed boot) choose by state before calling it, so none of them passes aquarantineddevice now. Check that this holds.reclaimclaim, so nuke skips that device and the retry deletes it.nukestill leaves a quarantined device as it is.Fast track
Written by an agent.
fix(core): one strip of quarantine fields on delete, manual line with…
chore(core): merge origin/main into bug/1517 (#1517)
V3RON commentedon Nov 10, 2026
Handoff
Done: PR #1520 (draft, branch
bug/1517, head 3abd48d).nuke --delete-devicesnow destroys quarantined virtual devices, andtransitionclears the three quarantine fields on→ deleted. Review found R1 (fields stripped twice) and R2 (manual line restated code); both are fixed.origin/main(#1518, provisioning) was merged in, and the conflicts were resolved and reviewed.Not done: R3, open at the round cap.
Findings: R3, from the code lens at the final fix-check. Fix 17d876d removed the strip from
Registry.deleteQuarantined(src/core/registry.ts:460).transitionPhysical(src/core/domain.ts:634) strips nothing, so a physical device unenrolled after its quarantine retries run out keepsquarantineAttempts,quarantineNextRetryAtandquarantinedAton itsdeletedrow. A probe showed this. Fix: strip on→ deletedintransitionPhysicaltoo, and assert it for a physical device.Blocked on: the maintainer decides whether to approve a fix run for R3 and a new fix-check beyond the cap (rule 14).
Written by an agent.
V3RON commentedon Nov 10, 2026
Delivery run
Merged: none
Parked: #1517 — R3 open at the review cap: a physical device's
deletedrow keeps its quarantine fields (PR #1520)Written by an agent.
fix(core): a deleted physical device drops its quarantine retry field…
V3RON commentedon Nov 12, 2026
Delivery run
Merged: #1520 (#1517)
Decided: #1517 — one more fix run and fix-check for R3 beyond the round cap → taken, as the maintainer re-ran deliver on the parked PR
Written by an agent.
fix(core): nuke --delete-devices deletes quarantined virtual devices (c…