iOS input fails in 0.21.34+ when Apple tools resolve past a stale Xcode selection symlink

未关闭
#4,145 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@thymikee 已经在做这个了。

开始于 2026年11月1日。

  • #4146 来自 @thymikee —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
22/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
ios, macos, typescript
领域
mobile-dev

调研方向

Start in packages/platform-apple/src/runner/runner-toolchain-identity.ts, where selectionLinkTarget() throws on a dangling /var/db/xcode_select_link, then read its test at src/runner/tests/runner-toolchain-identity.test.ts lines 68-79, which enforces that assumption. Run that test file to see the current failure. Done means a stale legacy link no longer blocks input when the active developer directory resolves. Open PR #4146 already targets this, so check it before starting.

由索引模型根据 Issue 内容生成。

描述

agent-device 0.21.35 rejects iOS input on a Mac where Apple's tools successfully resolve the current Xcode, because an obsolete /var/db/xcode_select_link still points at a deleted installation. The same interaction succeeds with 0.21.33 on the unchanged machine.

Environment

  • macOS 27.0.1, build 26A434, Apple Silicon
  • Xcode 27.0, build 27A266a, installed at /Applications/Xcode.app
  • iOS Simulator 27.0; tested on an iPhone 18 Pro simulator
  • Node.js 22.20.0
  • DEVELOPER_DIR is unset
  • Tested versions: 0.21.33 passes, 0.21.35 fails

Toolchain state

The obsolete symlink exists, but its target no longer exists:

/var/db/xcode_select_link -> /Applications/Xcode-16.2.0.16C5032a.app/Contents/Developer

Apple's tools resolve the installed Xcode successfully, including with an empty environment:

$ env -i PATH=/usr/bin:/bin /usr/bin/xcode-select -p
/Applications/Xcode.app/Contents/Developer

$ env -i PATH=/usr/bin:/bin /usr/bin/xcrun --find xcodebuild
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild

$ xcodebuild -version
Xcode 27.0
Build version 27A266a

$ xcrun --sdk iphonesimulator --show-sdk-version
27.0

$ xcrun --sdk iphonesimulator --show-sdk-build-version
24A430

Reproduction

On a Mac with the toolchain state above, use agent-device 0.21.35's MCP server and a booted iOS simulator:

  1. Call open with a named session, platform: "ios", the simulator's udid, and app: "com.apple.Preferences".
  2. Call snapshot with that session and interactiveOnly: true.
  3. Call press on the current snapshot ref for General, with settle: true.

open and snapshot succeed. screenshot also succeeds. press fails before dispatch:

code: COMMAND_FAILED
reason: apple_toolchain_unreadable
file: /var/db/xcode_select_link
detail: dangling selection link
dispatched: no

The error says it could not read the Xcode toolchain versions used for the Apple runner cache key, and suggests checking xcode-select -p or DEVELOPER_DIR. xcode-select -p already reports the working installation above.

Version comparison

With 0.21.33, on the same booted simulator and with no DEVELOPER_DIR override or system configuration changes, I verified:

  • Open Settings and read its accessibility snapshot.
  • Press General and verify that About appears on the resulting screen.
  • Navigate back and close the session.

After pinning Mobile Dev to 0.21.33, I repeated the interaction through its packaged Claude server, including a screenshot and a batch command; all passed without an Xcode override.

Regression source

This comes from #3995, first included in 0.21.34. The published 0.21.34 and 0.21.35 packages contain the new identity reader; 0.21.33 does not. The live failing interaction above was tested on 0.21.35.

selectionLinkTarget() in v0.21.35 throws when the legacy symlink cannot be resolved. Its assumption that a dangling link means Apple cannot resolve a working developer directory does not hold on this machine. The corresponding test explicitly enforces that assumption.

I understand the change avoids stalled xcrun probes on hosted runners. The remaining correctness requirement is that the cache fingerprint identify the same Xcode that Apple's tools actually use. A stale legacy symlink should not block device input when the active developer directory resolves successfully.

主要语言
TypeScript
星标
5.2k
派生
359
平均合并
13 小时 31 分钟
30 天内合并 PR
664

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstack/agent-device 的其他 Issue

查看 callstack/agent-device 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。