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
iOS: a clone whose mark or swap fails is deleted once, and a delete that times out or fails is dropped silently #1802
A provision whose simctl clone succeeded but whose mark write, LaunchServices drop or lineage swap then fails deletes the clone once and drops every outcome of that delete:
invoke answers a time-out or a non-zero exit as an outcome rather than throwing, so .catch only covers a spawn failure. A delete that times out (30 s) or exits non-zero is neither retried nor logged. The clone has no registry record, so it is left as an orphan-device (deviceSet: "simlock") or, under deviceSet: "default", as an unmarked simulator that listManaged never lists and nothing deletes (the end state #1546 fixed for a late clone). The request fails, and after a second failure is rejected unresolvable-spec, with no line naming the UDID left behind.
Expected: a failed delete is at least logged with the UDID, as deleteLateSimulator does for a late clone.
Confirmed. src/drivers/ios/index-seed-sources.test.ts, "a clone whose LaunchServices drop fails and whose delete then exits non-zero or times out is logged with its UDID" (branch bug/1802-repro). Cases: a delete that works (no warning), one that exits 1, one that times out.
pnpm exec vitest run --project unit src/drivers/ios/index-seed-sources.test.ts -t "is logged with its UDID"
AssertionError: a delete that exits non-zero: expected [] to deeply equal [ Array(1) ]
- "could not delete simulator 00000000-0000-0000-0000-000000000001 after a failed provision: simctl delete 00000000-0000-0000-0000-000000000001 exited with code 1: Unable to delete"
+ []
Root cause
Defect. src/drivers/ios/seeds.ts:249 calls this.#simctl.invoke(["delete", udid], ...), which returns a time-out or a non-zero exit as an outcome and never throws for them; the result is discarded and .catch(() => undefined) covers only a spawn failure. The comment above it says the clone must not be left behind, yet a failed delete leaves it with no trace. The late-clone path (command-run.ts:80-86) logs the same failure.
Simplest fix
Delete through #deleteIn(udid, undefined) (checks the outcome, treats Invalid device as gone) inside a try, and this.#logger?.warn(could not delete simulator ${udid} after a failed provision: ${errorMessage(deleteError)}) on failure; rethrow the original error.
pnpm exec vitest run --project unit src/drivers/ios # with the fix
Test Files 34 passed (34)
Tests 766 passed | 1 skipped (767)
Alternatives rejected
Retry the delete: a timed-out simctl delete may still be running, and the late-clone path does not retry.
Keep a registry record for the clone so doctor lists it: new state for a rare failure.
Risk
The test asserts an undocumented log line; testing rule 8 tests only documented ones (same file already does at line 88).
An already-gone clone (Invalid device) now logs nothing; check that is wanted.
Fast track
Defect: yes
Fix tried: yes
Nothing public added or broken: yes
No ADR or rule changed: no — the regression test asserts an undocumented log line (testing rule 8)
One fix: no — a retry would leave fewer simulators behind
Activity
V3RON commentedon Nov 22, 2026
Reproduction
Confirmed.
src/drivers/ios/index-seed-sources.test.ts, "a clone whose LaunchServices drop fails and whose delete then exits non-zero or times out is logged with its UDID" (branchbug/1802-repro). Cases: a delete that works (no warning), one that exits 1, one that times out.Root cause
Defect.
src/drivers/ios/seeds.ts:249callsthis.#simctl.invoke(["delete", udid], ...), which returns a time-out or a non-zero exit as an outcome and never throws for them; the result is discarded and.catch(() => undefined)covers only a spawn failure. The comment above it says the clone must not be left behind, yet a failed delete leaves it with no trace. The late-clone path (command-run.ts:80-86) logs the same failure.Simplest fix
Delete through
#deleteIn(udid, undefined)(checks the outcome, treatsInvalid deviceas gone) inside atry, andthis.#logger?.warn(could not delete simulator ${udid} after a failed provision: ${errorMessage(deleteError)})on failure; rethrow the original error.Alternatives rejected
simctl deletemay still be running, and the late-clone path does not retry.doctorlists it: new state for a rare failure.Risk
Invalid device) now logs nothing; check that is wanted.Fast track
Side findings
Written by an agent.