Repository navigation
fix(mcp): a tap by text that tapped nothing doesn't claim it had no effect - #149
Merged
Merged
Conversation
…ffect When iphone_tap_element finds nothing (or the index is out of range, or the element is fully covered) it taps nothing. With then, the answer still waited 0.7-0.8 s for the screen to settle and compared it with the tree read before the (absent) tap, so it went on to say "the screen is the same as before the action: it may not have taken effect … don't repeat the same action", as if something had been tapped. The daemon now drops the "before the action" screen when nothing was tapped, and the MCP server skips the settle in that case and lists the elements (or takes the screenshot) right away from the tree the tap just read. A tap that did happen settles and compares as before. On an iPhone 12 mini a missed tap with then=elements answers in 0.8 s instead of 1.3 s, without the misleading clause. Regression case Derrors#153. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cosinec
force-pushed
the
fix/missed-tap-no-change-note
branch
from
November 17, 2026 08:46
2bc21c2 to
e7de4db
Compare
Derrors
added a commit
to cosinec/iphone-control
that referenced
this pull request
Nov 17, 2026
Resolve the conflicts with Derrors#139, Derrors#141 and Derrors#143 by keeping both sides: drag_steps next to tap_sequence_body, the exports of both, the protocol helpers, the MCP tests, CHANGELOG lines and regression rows Derrors#146-Derrors#149 in order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Derrors
added a commit
that referenced
this pull request
Nov 17, 2026
…144) * feat(mcp): iphone_swipe holds before moving with hold, to drag icons Home-screen icons, files and reorderable rows have to be long-pressed before they can be dragged. iphone_swipe moves as soon as the finger is down, so it only scrolls or pages. Holding with a W3C pause before the move doesn't pick them up either; holding with a pointerMove in place does. hold (seconds, default 0) adds that in-place move before the stroke; over HID the finger is held, reporting its position every 100 ms like a long press, and then dragged without lifting. On an iPhone 12 mini, moving the Settings icon to an empty slot worked 5/5 each with hold 0.5, 0.6 and 1 s, and 0/5 without it. A swipe without hold is the same request as before, and seconds + hold is bounded by the existing 10 s gesture limit. Regression case #149. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(daemon): check a swipe's seconds on its own, then seconds plus hold Only the sum was checked, so a negative seconds passed when the hold made up for it (-0.5 + 1), and a sum over the limit said "seconds must be between 0 and 10" although seconds alone was fine. Now seconds keeps its own range, hold can't be negative, and a sum over the limit names both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Derrors <33656531+Derrors@users.noreply.github.com>
13 tasks done
Derrors
added a commit
to cosinec/iphone-control
that referenced
this pull request
Nov 17, 2026
Resolve the conflict in docs/dev/regression-cases.md: rows Derrors#146-Derrors#149 from main, then this branch's Derrors#150. The repeat test's Request::Tap gains the count field Derrors#141 added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 tasks done
Derrors
added a commit
to cosinec/iphone-control
that referenced
this pull request
Nov 17, 2026
Resolve the conflicts with Derrors#141, Derrors#143 and Derrors#144: keep both sides (Tap's count and TapSequence next to TapElement's scroll, the protocol helpers, the MCP tests, CHANGELOG lines, doc rows with iphone_tap's count and iphone_tap_element's scroll, regression rows Derrors#146-Derrors#149 then Derrors#151). The search scroll now builds the Stroke that Derrors#144's swipe takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the conflicts with Derrors#141-Derrors#150: TapElement's dispatch keeps main's scroll search and this branch's clearing of before_action on a miss; CHANGELOG lines after main's; this branch's regression row becomes Derrors#154 (Derrors#152 is Derrors#150's, Derrors#153 is Derrors#148's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bring in Derrors#148: its CHANGELOG line and regression row Derrors#153 come before this branch's line and row Derrors#154. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
When
iphone_tap_elementfinds nothing, or the index is out of range, or the element is fully covered, it taps nothing and says why. Withthen, though, the answer goes on as if something had been tapped. It first waits 0.7–0.8 s for the screen to settle. Then it compares the screen with the tree the tap read beforehand and adds:;但界面和操作前一样:操作可能没生效(点在了空白处、被别的东西挡住,或 App 还没反应过来),先截图看清再决定,不要原样再做一遍("the action may not have taken effect … don't repeat the same action"). That clause is wrong, because there was no action, and it points the agent at the wrong cause.The fix has two parts:
core.rs): when a tap by text tapped nothing, dropbefore_action, so a following settle has nothing to compare and adds no clause. This also covers older MCP servers and the last step of a batch.call_tool→finish): when the answer is a missed tap (tap_missed, i.e.Outcome.tapped_nothingor the old prefixes), skip theSettlecall. The elements are listed right away from the tree the tap just read (it is in the elements cache), or the screenshot is taken right away.finishgets asettleflag; the batch paths passtrue, so they are unchanged.A tap that did happen settles and compares exactly as before.
With
scroll(#147) the search may have scrolled even when it finds nothing, so a missed tap withscrollstill settles and compares as before; only a missed tap withoutscrollskips them. (Added when rebasing onto #147; the device runs below were made before that rebase and don't usescroll.)Tests
1. Unit tests
cargo test --workspace --all-features --locked,cargo clippy --workspace --all-targets --all-features --locked -- -D warningsandcargo fmt --check(per package) pass (Rust 1.99.1, macOS)dispatchaftertap_element, which needs a WDA to read a tree; the daemon tests have no WDA mock for that. The MCP part needs a daemon to call. The decision itself istap_missed, already covered bytap_missed_*tests. It is covered by the device runs below. If you'd like a test seam here, tell me where you prefer it.#[ignore]tests of the changed area run by hand: none apply2. Real-device regression
tests/device/run.pydefault steps pass on this branch (exit code 0): 16 calls, 0 failed, 16.4s in all (this branch's daemon and MCP server). It includes a missediphone_tap_element(nothen) andiphone_tap_elementwiththen: elements.run.py output (this branch)
3. Regression cases (docs/dev/regression-cases.md)
4. Real-device proof of the fix or feature
Steps and results
Settings app; the elements were listed once first (so there is a "before" screen), then three calls: two by text that match nothing (with
then: elementsandthen: screenshot) and one that does tap. The third call matched whatever "通用" was on the page Settings reopened on; that it navigates is all that matters here.The last part runs the v0.2.7 MCP server against this branch's daemon, so it shows the daemon half alone: the screen still settles (the old MCP asks for it), but the wrong clause is gone.
Checklist
then; withthen, a missed tap drops the settle line and the wrong clauseDocs:
CHANGELOG.md,CHANGELOG.zh-CN.md, regression row #153.🤖 Generated with Claude Code