What happened
预期:MCP 客户端连上 Poki 后,look 能读到屏幕,do 能 launch 其他 App 并继续操作。
实际:look 连续失败;do {launch: "com.meituan.imeituan"} 被拒绝(not_sent);约 2 分钟内没有任何一次读屏或动作成功,Poki 的 Activity Log 里 5 条全部是 ✗。同一条 MCP 连接上 status(runner: running、relay: ready)和 routines 都正常,说明中转/MCP 传输层没问题,问题在读屏/操作这一侧。
MCP 工具返回的错误原文(按时间顺序):
read: failed (no element tree: the runner refused GET /source: not sent: the app in front has not answered a lookup of the app in front for 11 s (its main thread is busy), and the phone serves one such request at a time; nothing is read or touched until it answers, so nothing lands late; a second try within the read's time was refused too; no screenshot: the runner did not answer GET /screenshot within 4.0 s; the host's own path gave none either (0 ms))did: {"launch":"com.meituan.imeituan"} (not_sent, 1 ms)
error: action 1 was not sent: launch com.meituan.imeituan was refused by the runner: the runner refused POST /wda/apps/activate: not sent: the app in front has not answered a lookup of the app in front for 28 s (its main thread is busy)…read: failed (no element tree: the runner refused GET /source: not sent: the app in front has not answered GET /wda/activeAppInfo for 3 s (its main thread is busy)…; no screenshot: the runner did not answer GET /screenshot within 4.0 s; the host's own path gave none either (0 ms))期间 look 报的等待时间从 11 s 涨到 50 s;截图侧同时报 "no screenshot: an earlier one has been under way for 39 s"。
环境里非常规的部分(如实说明):这次是同一台 iPhone 上的 MCP 客户端——DeepSeek Harness iOS App(Fish Pocket,bundle id com.wsw.dsh-ios,1.2.1 (104))作为 MCP 客户端,且它就是当时的前台 App;Poki App 和它通过一个本地回环 relay 相连(我按 docs/ios-core.md 的 relay frames v1 自己实现的一个转发器,监听 http://127.0.0.1:8787,不是 Cloudflare Worker;Poki 的「中转地址」接受并连上了它)。我不确定同机客户端是否在支持范围内;但即使如此,"前台 App 的辅助功能查询一直不返回时,后面的 launch 也被一起拒掉"看起来像一个可修的健壮性问题——launch 恰恰是切走当前前台 App 的唯一办法。
Steps to reproduce
- iPhone(iOS 27.0.1)上运行 Poki App;Poki 空闲一段时间后 runner 处于唤醒过程(第一次
status返回runner: starting (starting again after being idle; it takes a few seconds))。 - 在同一台 iPhone 的前台 App(这里是 DeepSeek Harness App:WebKit 聊天界面 + 内嵌 Node 引擎,正在渲染 agent 输出)里,通过 MCP 调用
look。 look返回上面第一段错误;随后do {actions: [{launch: "com.meituan.imeituan"}]}被以 "the app in front has not answered ... for 28 s" 拒绝。- 继续
look,等待时间涨到 50 s;Poki Activity Log 中对应 5 条全部失败(查看屏幕 ×2、打开 Imeituan、查看屏幕 ×2)。
重复观察:1 分钟内多次 look + 1 次 launch,全部失败;Activity Log 5 条一致。未尝试重启 runner 后是否恢复(用户中止了这次测试)。
Area
Automation on the phone (reads, taps, typing)
App version
Poki 0.4.0 Beta(2026-11-14 频道版本;App 内 Settings 的具体 build 号未读取,抱歉)
Installed with
Poki Setup(电脑安装;Setup 版本、电脑系统、免费/付费 Apple 账号类型均未确认)
iPhone and iOS
iPhone(具体型号未读取),iOS 27.0.1
Debug log
未能导出 Settings › Diagnostics › Copy Log;以下为 Poki App 的 Activity Log(2026-11-14 23:57,客户端显示为 "Dsh Mcp Client","通过 MCP"):
× 查看屏幕
× 查看屏幕
× 打开 Imeituan
× 查看屏幕
× 查看屏幕MCP 客户端侧的错误原文见 What happened。
Suspected cause or fix
(推测,未验证)native/ios-app/Poki/Native/InProcess.m 的 PKUnresponsive 设计是:前台 App 不回答辅助功能请求时最多等它一分钟,期间 "nothing more is read or touched"。当前台 App 就是 MCP 客户端本身、且它正忙着渲染 agent 输出时,这个"不回答"会持续整个任务,于是:
launch(POST /wda/apps/activate)也被同一条规则拒绝(LocalRunner.swift的not sent: the app in front has not answered ...),但它是切走前台 App 的唯一手段;- 截图同时报 "an earlier one has been under way for 39 s" / 4.0 s 超时,和注释里 "the picture still shows the screen" 的预期不一致;
- stuck 标记要等前台 App 自己回答才清除,期间客户端没有恢复手段。
建议:launch / button:home 这类不需要读当前前台 App 树的操作在 hung 状态下仍然发送;截图 lane 与前台 App 查询完全解耦;或允许若干秒后主动清除 hung 标记。
参考(当前 main):native/ios-app/Poki/Native/InProcess.m(PKUnresponsive / PKBounded)、native/ios/PokiCore/Sources/PokiCore/LocalRunner.swift("not sent" 拒绝逻辑)、native/ios/PokiCore/Sources/PokiCore/Computer.swift(beginsTask 时读 activeAppInfo)。
Activity
3Thank you for the detailed report, the root cause analysis and the pull request. Your reading matches our review: when the app in front does not answer, the phone serves one such request at a time, so later requests, including launch, are refused until it does.
Status: the fix is in review in #376. It keeps the bounded retry and, when a read still fails because the app in front has not answered, tells the agent that someone at the phone can send that app to the background (Home button or another app). One small change is left in the latest review: base the hint on the final failure, not on the first refusal. The hardcoded app version in the relay hello that you spotted is tracked separately.
中文说明:感谢详细的报告、根因分析和修复。修复在合并请求 #376 中审查,目前还剩一处小修改(提示应依据最后一次失败,而不是第一次被拒)。你提到的中转握手里写死的应用版本号,会另行跟进。
Thanks for spotting the hardcoded app version while investigating this, and for the detailed explanation of the blocked AX request.
I opened #390 for the separate version-reporting gap: relay hello now carries the installed iPhone app version and build instead of 1.0. The WebSocket handshake regression fails with the old value and passes with the fix; all four RelayTests pass locally.
This will help identify the phone build when inspecting relay handshakes. The AX recovery behavior is still being addressed in #376, and this change does not establish that the original hang is resolved. Thanks again for providing enough detail to isolate these two pieces.
已按排查结果提了 PR #376。
根因(从源码推得,并在真机上复现)
in-process 路径里,每次 AX 请求都有自己的 deadline(
InProcess.m的PKBounded),超时后调用方拿到app_unresponsive,但 testmanagerd 仍在处理那个被放弃的请求(最多 60 s),而且它一次只服务一个请求;LocalRunner又用held/unanswered挡住之后所有需要 testmanagerd 的请求(包括POST /wda/apps/activate)。所以只要前台 App 一直忙,读屏就会一直失败、launch也被拒——手机自身没有任何能恢复的动作。同机场景(本 issue 的环境)里,前台 App 正好是 MCP 客户端本身:它在整个 agent 回合里都在渲染输出,所以“等它自己空下来”永远不会发生,重试只会一次次撞同一堵墙。
能结束它的只有机主:按 Home 或切到别的 App,让前台 App 退到后台;它的主线程空出来后,挂起的 AX 请求返回,testmanagerd 释放,下一次 look 就能读屏。PR #376 做的就是把这句话加到失败结果里,并让模型用
{handoff: …}把这一步交给机主,同时不再对同一个被 held 的读做第二次读(那是必被拒的一次多余请求)。另外一个发现:relay hello 的
app字段是写死的"1.0"(native/ios/PokiCore/Sources/PokiCore/Relay.swift的 hello 组装处),所以外部客户端拿不到 iPhone App 的真实版本——这也是本 issue 里 App version 只能填“未确认”的原因,建议一并改成真实版本,方便以后排查。