Skip to content

close: require proof that open booted an Apple simulator before the implicit stop #4791

Closed

Description

@thymikee

Follow-up to #4539 (#4162), raised by review: #4539 (comment).

Problem

For an Apple simulator, open infers boot ownership from the inventory snapshot: device.booted !== true before open means bootedByOpen. If another actor boots that simulator between the snapshot and open's own boot step (for example a concurrent xcrun simctl boot), the session still records bootedByOpen: true, and plain close shuts the simulator down. The launched-process check answers not-applicable for every non-Android device, and booting a simulator takes no device claim, so nothing verifies the boot.

Android emulators do not have this gap: close stops only the process that open launched.

Expected

Plain close stops an Apple simulator only when open has positive proof that it caused the boot. Options: record that open's own boot step performed the boot (not only that the snapshot said stopped), or record the simulator boot time that DeviceBootObservationService already reads and withhold the stop with a warning when the observed boot is not the one open caused.

Acceptance

  • A routed test: the snapshot says stopped, another actor boots the simulator before open's boot step, open succeeds, plain close keeps the simulator and warns.
  • A live iOS simulator run of cold stop, prebooted retention and the foreign-boot case.

Activity

  1. added this to the 0.22 - lean core milestone on Nov 20, 2026
  2. apex-sentinel-staging commented on Nov 20, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: bug

    The issue reports a concrete race in Apple simulator ownership inference: a simulator can be booted by another actor after the pre-open snapshot, yet open records bootedByOpen and plain close later shuts it down. It gives expected behavior and acceptance criteria for a routed test and iOS simulator run.

    Required sections

    • Steps to reproduce (missing)
    • Expected and actual behavior (missing)
    • Version or environment (missing)
  3. thymikee commented on Nov 20, 2026

    @thymikee
    MemberAuthor

    Status: not started. Sequenced after #4842 (failed open stops the emulator it booted) merges, because both change the launch-ownership path.

  4. thymikee commented on Nov 20, 2026

    @thymikee
    MemberAuthor

    Fixed by #4864, merged into 0.22. Plain close stops an Apple simulator only when open's own boot step reports that it performed the boot. The routed foreign-boot test and the live iOS simulator runs (cold stop, prebooted retention, foreign boot) are on the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions