Repository navigation
feat(daemon): scope iOS simulator requests to AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET - #3485
Conversation
Size Report
Startup median (7 runs, lower is better):
|
|
|
PR #3485 at a9d1699 has one defect that must be fixed before merge, and the Coverage check failure comes from this diff.
Could The Coverage failure is likely caused by this PR. Not blocking, and you can take or leave these: the new tests stub I did not rerun the live validation, so the PR body is the only evidence that the built daemon scopes listing and open. I also did not check whether a config-file layer outside the remote profile injects |
* origin/main: (79 commits) feat(ios): interpret React Native accessibility value semantics (#3589) fix(android): reinstall and reselect the test IME helper after it disappears (#3606) feat(snapshot): carry provider keyboard observations through acquisition (#3593) chore(web): bump managed agent-browser backend to 0.39.0 (#3591) fix(fold): report a dispatched pose as unverified when devicectl has no hinge-angle stream (#3587) feat(android): expose system-bar membership on snapshot nodes (#3585) fix(android): align ADB and Appium field values (#3584) test(closure): read committed JSON modules on the merge-base side (#3602) fix(ci): preserve manual Android suite timing (#3554) refactor(daemon): make the layer folders the declaration (PR 10) (#3520) refactor(move): extract the daemon server into @agent-device/daemon (11b) (#3546) refactor(daemon): package-local runtime fakes for the remaining daemon ports [11a-4] (#3544) refactor(daemon): cut daemon test edges into root data fixtures and fakes [11a-3] (#3517) refactor(11a-2): package-local fakes at the daemon ports; root-own command-surface composition tests (#3519) test(replay): verify Settings queries and bound scrolling (#3560) feat(snapshot): measure Android Appium viewport (#3586) fix(ios): verify a fill whose unidentified field moved while it kept focus (#3596) refactor(coverage): one fallow config with per-function CRAP ceilings (#3588) test: bound CLI promotion cases and align provider budget (#3590) fix(metro): report what the dev-server stop proved instead of assuming success (#3575) ...
…set applies Move the AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET rule into one kernel owner, resolveRequestAppleSimulatorSetPath in device.ts, which drops macOS and desktop selectors first, leaves non-simulator platforms alone, then applies the operator default or the refusal. Each inventory call site makes one call, device-isolation.ts is a leaf again, and the env is injectable for tests. The refusal compares trimmed path strings the way the session selector does. Document that physical iOS devices are hidden and that a CLI-spawned daemon keeps the first value.
|
New head: ddf9352. Main is merged in (clean merge).
Checks: |
|
Thanks for the update. The resolver move since a9d1699 looks good, but I still can't call this ready at ddf9352 because no device run covers the changed path. The live run in the PR body was done at a9d1699, before the resolver moved, and the refusal now lives in packages/kernel/src/device.ts. Today only unit tests with inventory fakes show that the built daemon scopes listing and open and keeps the host Mac visible. Please start the built daemon with AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET= and show four results. First, The earlier Coverage failure (eager-closure budget from the new AppError import in device-isolation.ts) should be gone, because that file is no longer in the diff and device.ts already imported errors.ts. I inferred this from the diff and have not seen it in a CI log. I ran no tests myself. All 19 CI lanes are queued after the main merge and none has failed yet. Coverage still overlaps this diff through the kernel and device-selection tests, so please read its result once it runs. Before merge, the live run at ddf9352 is needed and CI should be green. |
* origin/main: feat(leasing): proxy CLI names each new lease, daemon keeps a caller-chosen lease id (#3479) feat(remote): name the held lease on upload, artifact download and diagnostics requests (#3594) fix(android): record the launched intent owner from the device (#3600) fix(selectors): type rect-requiring targets as addressable (#3608) feat(snapshot): interpret iOS node facts once at producer seams (#3592) refactor(gates): own the client-only replay rule as daemon-process reachability (R82) (#3604)
|
New head is bff2f9f. Main is merged in (origin/main 562e798). I ran the live check at bff2f9f, using the CLI built from that commit ( 1. {"success": true, "data": {"devices": [
{"platform": "ios", "id": "22E43289-32F6-47BD-A3F3-097BDD804DD3", "name": "PR3485 iPhone",
"kind": "simulator", "osVersion": "26.2", "booted": true}]}}2. The host Mac stays visible {"success": true, "data": {"devices": [
{"platform": "macos", "id": "host-macos-local", "kind": "device", "target": "desktop", "booted": true}]}}
3. "selection": {"reason": "single-booted-local", "candidateCount": 1, "bootOccurred": false},
"device_udid": "22E43289-32F6-47BD-A3F3-097BDD804DD3",
"ios_simulator_device_set": "/private/tmp/claude-501/pr-3485-sims",
"message": "Opened: com.apple.Preferences"4. Another set is refused {"success": false, "error": {"code": "INVALID_ARGS",
"message": "This daemon only reaches iOS simulators in the set \"/private/tmp/claude-501/pr-3485-sims\" (AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET), but the request named --ios-simulator-device-set \"/private/tmp/claude-501/pr-3485-other\".",
"details": {"reason": "ios_simulator_device_set_outside_daemon_set"}}}(exit 1) After the run I closed the session, stopped the daemon with Checks at bff2f9f:
|
|
Thanks for the update. The code looks right at bff2f9f, and the earlier evidence gap is closed by the live device outputs you posted at bff2f9f. I did not rerun the live device check, and I ran no tests locally, so that evidence is yours. CI is still running, with no failed lane: Smoke Tests are queued, and Analyze and Compatibility & Provenance are in progress. Smoke Tests cover iOS device selection, so they matter here. The smoke runners do not set the env var, so they should only confirm that the no-operator-set path keeps base behavior. This needs green CI at bff2f9f, and then the PR needs to come out of draft before merge. One question, and it is not blocking: the repo already has an owner for env-driven device scoping in packages/kernel/src/device-isolation.ts, where resolveAndroidSerialAllowlist reads AGENT_DEVICE_ANDROID_DEVICE_ALLOWLIST. After this change, resolveIosSimulatorDeviceSetPath is a trim-only helper that only simctl.ts uses, and the new env read and refusal sit in kernel/device.ts. Should the operator-set read and the refusal move into device-isolation.ts, for example as resolveIosSimulatorDeviceSetPath(flagValue, env)? device.ts would then keep only the macOS/desktop and simulator-capable platform gate, and both device-scoping env vars would live in one module. |
* origin/main: fix(daemon): end the session and clear its claim when its lease ends (#3480)
|
New head is fc10741. Main is merged in. I did not move the env read into So the env read and the Gates run on this head:
|
There was a problem hiding this comment.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="website/docs/docs/commands.md">
<violation number="1" location="website/docs/docs/commands.md:200">
P3: The “other non-iOS requests ignore the set” clause is incorrect for `--platform apple --target tv`: Apple simulator requests use the daemon set, while only macOS desktop requests bypass it. Update this wording in both documentation pages.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| - If the selected Xcode can't resolve a scoped simulator for the Apple runner, the runner start fails with `details.reason: "simulator_set_destination_not_found"`, naming the set and, when known, the Xcode version. | ||
| - `--android-device-allowlist <serials>` limits Android discovery and selection to comma- or space-separated serials. | ||
| - Set the same scopes with the `iosSimulatorDeviceSet` and `androidDeviceAllowlist` config keys, or `AGENT_DEVICE_ANDROID_DEVICE_ALLOWLIST`. CLI flags override environment values, except under a `strip` session lock, which ignores conflicting per-call selectors. | ||
| - Start the daemon with `AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET=<path>` to scope every iOS simulator request to one simulator set. A request without `--ios-simulator-device-set` uses that set, so iOS physical devices are not listed on that daemon. A request naming a different path string, including the same path with a trailing slash, fails with `INVALID_ARGS` and `details.reason: "ios_simulator_device_set_outside_daemon_set"`. macOS and other non-iOS requests ignore the set, and the host Mac stays listed. A daemon that the CLI starts inherits the CLI's environment, so later CLI calls with a different value still use the first value until the daemon restarts. |
There was a problem hiding this comment.
P3: The “other non-iOS requests ignore the set” clause is incorrect for --platform apple --target tv: Apple simulator requests use the daemon set, while only macOS desktop requests bypass it. Update this wording in both documentation pages.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At website/docs/docs/commands.md, line 200:
<comment>The “other non-iOS requests ignore the set” clause is incorrect for `--platform apple --target tv`: Apple simulator requests use the daemon set, while only macOS desktop requests bypass it. Update this wording in both documentation pages.</comment>
<file context>
@@ -197,6 +197,7 @@ agent-device devices --platform android --android-device-allowlist emulator-5554
- If the selected Xcode can't resolve a scoped simulator for the Apple runner, the runner start fails with `details.reason: "simulator_set_destination_not_found"`, naming the set and, when known, the Xcode version.
- `--android-device-allowlist <serials>` limits Android discovery and selection to comma- or space-separated serials.
- Set the same scopes with the `iosSimulatorDeviceSet` and `androidDeviceAllowlist` config keys, or `AGENT_DEVICE_ANDROID_DEVICE_ALLOWLIST`. CLI flags override environment values, except under a `strip` session lock, which ignores conflicting per-call selectors.
+- Start the daemon with `AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET=<path>` to scope every iOS simulator request to one simulator set. A request without `--ios-simulator-device-set` uses that set, so iOS physical devices are not listed on that daemon. A request naming a different path string, including the same path with a trailing slash, fails with `INVALID_ARGS` and `details.reason: "ios_simulator_device_set_outside_daemon_set"`. macOS and other non-iOS requests ignore the set, and the host Mac stays listed. A daemon that the CLI starts inherits the CLI's environment, so later CLI calls with a different value still use the first value until the daemon restarts.
- Scope applies before `--device`, `--udid`, and `--serial`, so an out-of-scope selector fails with `DEVICE_NOT_FOUND`.
- On macOS, daemon startup removes any symlink at `~/Library/Developer/XCTestDevices`, including one you made yourself (for example to move it to another volume), and restores `XCTestDevices.agent-device-backup` when it exists. A symlinked `XCTestDevices` is not supported. Only the link is removed, never the directory it points to; `daemon.log` records each step and any failed restore, which doesn't stop the daemon.
</file context>
| - Start the daemon with `AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET=<path>` to scope every iOS simulator request to one simulator set. A request without `--ios-simulator-device-set` uses that set, so iOS physical devices are not listed on that daemon. A request naming a different path string, including the same path with a trailing slash, fails with `INVALID_ARGS` and `details.reason: "ios_simulator_device_set_outside_daemon_set"`. macOS and other non-iOS requests ignore the set, and the host Mac stays listed. A daemon that the CLI starts inherits the CLI's environment, so later CLI calls with a different value still use the first value until the daemon restarts. | |
| - Start the daemon with `AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SET=<path>` to scope every Apple simulator request to one simulator set. A request without `--ios-simulator-device-set` uses that set, so iOS physical devices are not listed on that daemon. A request naming a different path string, including the same path with a trailing slash, fails with `INVALID_ARGS` and `details.reason: "ios_simulator_device_set_outside_daemon_set"`. macOS requests and other non-Apple requests ignore the set, and the host Mac stays listed. A daemon that the CLI starts inherits the CLI's environment, so later CLI calls with a different value still use the first value until the daemon restarts. |
|
This PR is ready. I reviewed fc10741 and found no code problems. The earlier review (#3485 (comment)) was waiting on evidence, and that evidence is now in. The live device check outputs from bff2f9f still apply, because the logical patch is unchanged. I did not rerun that check, and I did not run any tests myself. Not blocking: the docs say macOS and other non-iOS requests ignore the set, but at website/docs/docs/commands.md:200 the code applies the set to every Apple simulator request, so Open threads: the Cubic P3 thread on this docs wording still applies and is covered by the note above: #3485 (comment) CI is still pending. 17 lanes are queued or running and none have failed. Coverage, Integration, Typecheck and Repo Guards overlap this diff. Smoke Tests run iOS selection without the env var, so they check that the path without the set is unchanged. Next, CI needs to be green on fc10741, with Coverage and Smoke Tests read once they run. |
Summary
A supervisor starting the daemon (e.g. Simlock, which keeps its own simulator set) could not tell it "use this simulator set for every request": the set came only per request, from
--ios-simulator-device-setor the config key. TheAGENT_DEVICE_IOS_SIMULATOR_DEVICE_SETenv var used to cover this and was removed in #560.The daemon now reads
AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SETfrom its own environment:open, test shards) uses that set;INVALID_ARGS,details.reason: "ios_simulator_device_set_outside_daemon_set"; naming the same set works;8 files: one resolver, its three request-side callers, tests, docs.
Validation
Live run at head bff2f9f (main 562e798 merged in). I used the built CLI and a daemon with its own state dir, started with
AGENT_DEVICE_IOS_SIMULATOR_DEVICE_SETpointing at a private set that held one booted iOS 26.2 simulator. Commands after the first one ran without the variable in the CLI's environment.devices --platform ioslisted only the private set's simulator.devices --platform macos --ios-simulator-device-set /otherand plaindevicesboth listed the host Mac (host-macos-local), with no INVALID_ARGS.open com.apple.Preferences --platform ioswith no set flag returnedios_simulator_device_set: "<private set>".devices --platform ios --ios-simulator-device-set /otherreturnedINVALID_ARGS,details.reason: "ios_simulator_device_set_outside_daemon_set".Commands and output are in #3485 (comment).
Gates at bff2f9f: the targeted
device.test.tsanddispatch-resolve.test.tspassed, and so did the daemon session-lifecycle and daemon-port tests (134 tests).pnpm typecheck,pnpm formatandpnpm lintpassed. The unit tests cover the default, the same-set case, the refusal, and the unset case. The twodispatch-resolvetests fail without the source change. An earlier run at a9d1699 also checked the old path: without the variable, the default set listed and--ios-simulator-device-setstill scoped the listing.