Skip to content

Improve iOS simulator boot and app install reliability#314

Merged
gabrieldonadel merged 3 commits intomainfrom
claude/improve-orbit-resilience-Cyvld
Mar 13, 2026
Merged

Improve iOS simulator boot and app install reliability#314
gabrieldonadel merged 3 commits intomainfrom
claude/improve-orbit-resilience-Cyvld

Conversation

@gabrieldonadel
Copy link
Copy Markdown
Member

@gabrieldonadel gabrieldonadel commented Mar 11, 2026

Summary

This PR enhances the reliability of iOS simulator operations by adding retry logic for app installation. It addresses issues where simulators may not be immediately ready after booting or may be in transitional states during installation.

Key Changes

  • App installation retry logic: Implemented simctlInstallWithRetryAsync() with configurable retry attempts (3 by default) and delays to handle transient simulator states
  • Error handling improvements:
    • Added detection for "Unable to lookup in current state: Shutdown" errors in xcrun error handling
    • Introduced new SIMULATOR_NOT_READY error code for better error categorization
  • Configuration constants: Added timeout and retry configuration constants for better maintainability

Implementation Details

  • Boot polling uses a 1-second interval with a 60-second timeout to balance responsiveness and resource usage
  • Installation retries use a 2-second delay between attempts to allow simulator state transitions
  • Error detection checks for multiple error patterns including CoreSimulator.SimError codes
  • The boot verification is non-blocking if the simulator is already booted

The simulator can be in a Shutdown or transitional state when Orbit
tries to install an app, causing "Unable to lookup in current state:
Shutdown" errors (CoreSimulator.SimError code 405).

Changes:
- ensureSimulatorBootedAsync now polls until simulator reports Booted
  after issuing `simctl boot`, with a 60s timeout
- Handle race condition where simulator gets booted by another process
  ("Unable to boot device in current state: Booted")
- installAppAsync retries up to 3 times on transient simulator state
  errors with 2s delay between attempts
- CLI's installAndLaunchIOSAppAsync now boots the simulator before
  attempting install (was previously missing)
- Add SIMULATOR_NOT_READY error code for clearer error identification

https://claude.ai/code/session_016zo1GKjHDxWfKCmJ7uoB1X
@gabrieldonadel gabrieldonadel force-pushed the claude/improve-orbit-resilience-Cyvld branch from f43b804 to c85c7a2 Compare March 13, 2026 14:02
@gabrieldonadel gabrieldonadel force-pushed the claude/improve-orbit-resilience-Cyvld branch from 76fec00 to ca50f4a Compare March 13, 2026 14:11
@gabrieldonadel gabrieldonadel marked this pull request as ready for review March 13, 2026 14:17
@gabrieldonadel gabrieldonadel merged commit c362cfa into main Mar 13, 2026
1 of 2 checks passed
@gabrieldonadel gabrieldonadel deleted the claude/improve-orbit-resilience-Cyvld branch March 13, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants