fix(ios): fail fast when a session's simulator no longer exists

Merged
XI
9d ago
+153-6

Summary

A session keeps booted from its open. After an external pool deletes the simulator, the next runner start skipped every check. xcodebuild then waited out its 20 s destination timeout and returned COMMAND_FAILED with a hint to delete the shared runner cache.

The runner start now runs one simctl list devices -j to confirm that a booted session simulator still exists. If it does not, the start fails with DEVICE_NOT_FOUND, names the UDID, and suggests close. The check follows the shape of refreshSessionDeviceIfNeeded in the daemon and is loaded lazily. It is skipped when this process saw the simulator Booted moments ago (the existing booted memo). A listing that cannot be read never refuses a start (CONSERVATIVE:).

6 files, +158/-6, 77 of them tests.

Fixes #4687.

Validation

Head bfbf2503c on base aa600e980.

  • check:quick passed. apple-runner tests: 984 pass. The new tests fail against base runner-session.ts.
  • check:affected --run --head bfbf2503c (exactCommit): format, lint, typecheck, layering, fallow, build and vitest-related passed. unit failed only in test/repo-guards/android-sdk-setup-action.test.ts (2 tests). They fail the same way on aa600e980 on this host, where a local Android SDK path leaks into the expected path.
  • iOS 27.2 simulator deleted after open. Next snapshot -i: base took 23.3 s and returned COMMAND_FAILED with the cache hint. Head took 0.6–1.0 s and returned DEVICE_NOT_FOUND with details.deviceId. close succeeds. open time is unchanged (12.4 s head, 12.7 s base).

šŸ¤– Generated with Claude Code


Autofix with [code]smith
Open in [code]smith Ā· Need help on this PR? Tag @codesmith-bot with what you need.