Skip to content

An explicit --udid re-reads the simulator inventory on every command (~256 ms) #4643

Closed

Description

@thymikee

Purpose

A command that names its device with --udid (or --serial) pays about 256 ms on every call, because the daemon re-reads the simulator inventory to resolve the device, even when the session is already bound to that device. snapshot skips this cost; other commands do not. Callers that always pass an explicit device, such as Expo Explore against a local simulator, pay it on every command of a run.

Observed (while measuring #4641; iPhone 17e simulator, iOS 27.0, warm daemon, n=8, wall-clock medians)

Command With --udid Session only
keyboard status (branch of #4642) 476 ms 232 ms
snapshot 320 ms 300 ms

The 256 ms comes from resolveCommandDevice (packages/daemon/src/resources/session-device-resolution.ts) re-reading the inventory.

Required behavior

  • When an explicit selector matches the device the session is already bound to, resolve it from the session without an inventory read. This is what snapshot effectively gets today; find out why it differs and use one path.
  • Keep today's refusals: a selector that names a different device than the session's still refuses as it does now, and the device-claim rules stay unchanged.
  • Re-read the inventory only when the selector does not match the bound device, or when there is no session.

Done when

  • Per-command timings with and without --udid are within noise of each other for a bound session, measured on a simulator for at least keyboard status, press and appstate, with before/after numbers in the PR.
  • The tests for selector-mismatch refusals and claims still pass.

Activity

  1. apex-sentinel-staging commented on Nov 17, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: bug

    The report identifies measurable existing behavior where an explicit --udid/--serial triggers a 256 ms simulator inventory re-read via resolveCommandDevice even when the session already matches the device. It specifies the affected code path, required behavior, and acceptance tests, making it actionable.

    Required sections

    • Steps to reproduce (missing)
    • Expected and actual behavior (missing)
    • Version or environment (missing)
  2. added
    bug
    on Nov 18, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions