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
baseline remove of a baseline whose device is still reclaiming fails with INTERNAL #1476
What happens.simlock baseline remove <name> --yes run right after releasing a lease made from that baseline fails with INTERNAL (exit 1). A retry a few seconds later works. The device is busy only because its reclaim still holds the claim, so the caller should get a named, retryable error, not INTERNAL.
Where.src/core/baselines.ts:435 throws a plain Error (Device ${device.id} made from baseline ${name} is busy) when claims.tryClaim(device.id, "cleanup") fails, and a plain error maps to INTERNAL. errors.mdx:69 has BASELINE_IN_USE (409) for a baseline a lease still uses, but a device that is still reclaiming has no code. The code is wrong; the docs do not list this state.
Seen.main at 30f8fad9: simlock baseline remove t6base --yes right after simlock release: {"error":{"code":"INTERNAL","message":"Device dev_... made from baseline t6base is busy"}}, exit 1. A retry a few seconds later removed it.
Found during the pre-release e2e pass after v0.6.0.
Confirmed on 30f8fad9. Branch bug/1476-repro, src/daemon/dispatcher.test.ts, "Dispatcher: baseline.remove while a copy is reclaiming > refuses the remove with DEVICE_BUSY naming the reclaiming device, and removes the baseline once its reclaim ends". It holds the reclaim's shutdown on the fake clock, removes, then lets the reclaim end and removes again.
pnpm exec vitest run --project unit src/daemon/dispatcher.test.ts -t "while a copy is reclaiming"
AssertionError: expected Error: Device dev_3 made from baseline ch… to match object { code: 'DEVICE_BUSY', …(1) }
- { "code": "DEVICE_BUSY", "details": { "id": "dev_3", "reason": "reclaiming" } }
+ Error { "message": "Device dev_3 made from baseline checkout is busy" }
Root cause
Defect. src/core/baselines.ts:435 (#claimIdleDevices) throws a plain Error when tryClaim(device.id, "cleanup") fails. The reclaim's reclaim claim is held until the copy is deleted, so every remove during that window fails there. The handler at src/daemon/dispatcher.ts:1058 maps only BaselineInUseError and UnknownBaselineError, and passes the rest on, so classifyError answers INTERNAL ("something unexpected failed"). The state is expected and passes on its own. DEVICE_BUSY (exit 11, reason reclaiming) already names it.
Add DEVICE_BUSY to the route's 409 list (src/http/admin-declarations.ts:202). Name baseline remove in the DEVICE_BUSY row of errors.mdx, in cli.mdx:658 and in baselines.mdx:88/99.
Activity
V3RON commentedon Nov 9, 2026
Reproduction
Confirmed on
30f8fad9. Branchbug/1476-repro,src/daemon/dispatcher.test.ts, "Dispatcher: baseline.remove while a copy is reclaiming > refuses the remove with DEVICE_BUSY naming the reclaiming device, and removes the baseline once its reclaim ends". It holds the reclaim'sshutdownon the fake clock, removes, then lets the reclaim end and removes again.Root cause
Defect.
src/core/baselines.ts:435(#claimIdleDevices) throws a plainErrorwhentryClaim(device.id, "cleanup")fails. The reclaim'sreclaimclaim is held until the copy isdeleted, so every remove during that window fails there. The handler atsrc/daemon/dispatcher.ts:1058maps onlyBaselineInUseErrorandUnknownBaselineError, and passes the rest on, soclassifyErroranswersINTERNAL("something unexpected failed"). The state is expected and passes on its own.DEVICE_BUSY(exit 11, reasonreclaiming) already names it.Simplest fix
Add
DEVICE_BUSYto the route's 409 list (src/http/admin-declarations.ts:202). Namebaseline removein theDEVICE_BUSYrow oferrors.mdx, incli.mdx:658and inbaselines.mdx:88/99.Alternatives rejected
BASELINE_IN_USE: its details need aleaseId, and the lease has already ended.Risk
BASELINE_IN_USE(gateway/dispatcher.test.ts:1923). CheckDEVICE_BUSYreaches a fleet caller.idis the registry id (dev_…) here, but the enrolled device's id indevice add/remove.Fast track
Written by an agent.
fix(core): baseline remove's busy reason reads the device state; test…
fix(daemon): keep dispatcher files within the size limit; baseline re…
V3RON commentedon Nov 10, 2026
Delivery run
Merged: #1490 (#1476)
Parked: none
Waiting: none
Decided: none
Written by an agent.
fix(core): baseline remove while a copy is reclaiming answers DEVICE_…