fix(daemon): run Apple tools with the requesting client's DEVELOPER_DIR

Merged
GE
2mo ago
+793-181

Originally authored by Claude for @GenericJam; follow-up fixes and validation by Codex.

Summary

Local clients now run Apple tools with their own DEVELOPER_DIR, independently of the daemon's startup environment. Unset values inherit the daemon environment; DEVELOPER_DIR="" selects the host's xcode-select toolchain. Remote requests discard the client host path.

Runner artifacts and durable leases carry the existing cache fingerprint, so retained-runner reuse and daemon adoption refuse a different toolchain even with a fixed AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH. External runner artifacts retain their existing reuse behavior. Missing xcrun tools produce actionable diagnostics.

35 files, including installation docs, wire compatibility metadata, regression tests, shared runner fixtures, and one test move to avoid growing an oversized test file.

Validation

Commit 015ad0872fb72f5e2b8edeb3aaaa6c6245f9c879:

  • AGENT_DEVICE_VITEST_MAX_WORKERS=2 pnpm check:affected --run: all runnable gates passed; 7,657 tests across 961 files. Earlier runs exposed a load-sensitive child-process cleanup race; the final run passed without test retries.
  • Regression tests failed before the fix and pass with it.
  • pnpm check:xctest-selection: passed.
  • Fresh iOS 26.2 simulator, fixed derived path: native runner build, forced tree snapshots, explicit/empty toolchain reuse, and graceful handoff/adoption passed with the same runner PID and cache key. Session, daemon, runner, and simulator cleaned up.

Only one Xcode is installed on this host; cross-Xcode invalidation is covered by regression tests. GitHub CI on the updated head remains to be verified.