Skip to content

fix(daemon): a paste over the same selected text isn't reported as failed - #133

Merged
Derrors merged 2 commits into
mainfrom
fix/native-paste-same-text
Nov 15, 2026
Merged

Derrors merged 2 commits into
mainfrom
fix/native-paste-same-text

Conversation

@Derrors

@Derrors Derrors commented Nov 15, 2026

Copy link
Copy Markdown
Owner

What and why

Found in the 0.2.7 release regression (iPhone 15 Pro Max, iOS 27.2.1, native control). Natively, iphone_type_text pastes and then checks that a field's value changed and holds the text (native.rs, native_paste). Spotlight opens with the last search selected, so pasting the same search again replaces it with itself: the value doesn't change, and the tool said 粘贴了 2 个字符,但 5 秒内输入框里没有这段文字 — and with submit didn't press Return — although the text had gone in (the next wait_for found the Settings result at once). run.py passes on a fresh Spotlight and fails from the second run on.

  • The check is a pure function now, paste_seen → Pasted::{Typed, Unchanged, Unreadable, Missing}.
  • Once the paste prompt was answered, a field that already held the text and stays unchanged for 1.5 s (PASTE_SAME_SETTLE) counts as typed, with a note: (输入框里原来就是这段文字,粘贴后看不出变化,截图确认). Return is pressed with submit.
  • Without an answered prompt it still fails after 5 s, as before: iOS asks for every paste of ours, so an unchanged field then may mean nothing was pasted.
  • Also: select said "WDA takes 10–60 seconds" for a device under native control; it now says native control is ready in seconds (WDA devices unchanged).

The bug is in native control, which ships first in 0.2.7, so there is no changelog line.

Tests

1. Unit tests

  • cargo test -p ictl-daemon --all-features --locked (112 passed), cargo clippy -p ictl-daemon --all-features --locked --tests -- -D warnings (only the known local-toolchain lints allowed, see CONTRIBUTING) and cargo fmt -p ictl-daemon --check pass in the Rust 1.89 container. Only ictl-daemon changed; CI runs the whole workspace.
  • New test: a_paste_that_replaced_the_same_text_is_told_apart_from_one_that_missed
  • No existing test removed, ignored or loosened
  • #[ignore] tests of the changed area: none apply

2. Real-device regression

Linux (Debian 12), this branch deployed (d939572):

  • iPhone 15 Pro Max, iOS 27.2.1 (native), run.py twice in a row: --- 14 calls, 0 failed, 15.5s in all, --- 14 calls, 0 failed, 16.8s in all
  • Same device on main (ad1c497): first run --- 14 calls, 0 failed, 15.0s in all, second run --- 14 calls, 1 failed, 17.2s in all (the type_text step, 5.35 s, ERROR). type_text over the remembered search now takes 3.55–4.27 s (the 1.5 s settle); into an empty field unchanged (2.57 s on main).
  • tasks.py on the iPhone: --- 70 checks, 0 failed, 38.4s in all
  • iPad mini 5, iPadOS 26.7.3 (WDA), run.py: --- 14 calls, 0 failed, 33.5s in all. The first tap_element after switching devices took 17.7 s; it did the same on main (18.2 s) in the same situation, so it isn't from this change.
  • Longer run: not affected (no start-up, recovery, unlocking or picture code changed)

3. Regression cases

4. Real-device proof

  • Bug fix, iPhone 15 Pro Max, iOS 27.2.1, Spotlight holding 设置 from the search before (Home → swipe down → iphone_type_text {"text": "设置"}):
    • main: 粘贴了 2 个字符,但 5 秒内输入框里没有这段文字;截图看看:输入框可能没有焦点,或 App 不接受粘贴 (field still 设置); with a different text (时钟) it passed, so the paste itself works.
    • This branch: 已输入 2 个字符(已替你点了「允许粘贴」)(输入框里原来就是这段文字,粘贴后看不出变化,截图确认); with submit: true also ,并按了回车, and Settings opened.
    • select to the iPhone: …状态:就绪;原生控制几秒就绪,…; to the iPad: …WDA 起来要 10~60 秒,….

Checklist

  • MCP tool names, parameters and default outputs stay compatible (one more note in a result)
  • No new dependencies
  • User-visible changes: none against the last release (native control is unreleased)
  • No private data in the outputs above

🤖 Generated with Claude Code

Derrors and others added 2 commits November 15, 2026 22:35
…iled

Natively, a paste is checked by the fields' values changing to hold the
text. Spotlight opens with the last search selected, so pasting the same
search again replaces it with itself: nothing changes, and `type_text`
said the text never went in (and didn't press Return with `submit`),
although it had. Once the paste prompt was answered, a field that already
held the text and stays unchanged for 1.5 s now counts as typed, with a
note to check with a screenshot. Without an answered prompt it still
fails, since iOS asks for every paste of ours.

`select` no longer says WDA takes 10-60 seconds for a device under
native control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Derrors
Derrors merged commit a5b8106 into main Nov 15, 2026
6 checks passed
@Derrors Derrors mentioned this pull request Nov 15, 2026
@Derrors
Derrors deleted the fix/native-paste-same-text branch November 16, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant