Skip to content

feat(daemon): an action that unlocked the phone first says so - #135

Merged
Derrors merged 3 commits into
mainfrom
feat/unlock-note
Nov 15, 2026
Merged

Derrors merged 3 commits into
mainfrom
feat/unlock-note

Conversation

@Derrors

@Derrors Derrors commented Nov 15, 2026

Copy link
Copy Markdown
Owner

What and why

In the 0.2.7 regression the first action after switching devices was slow (18 s on the iPad, 9–10 s on the iPhone, against 3 s and 0.5 s). It wasn't the switch: with debug logs on, the time went to auto-unlock. The device had sat idle while the other one was tested and locked itself, so the first action unlocked it first. On the iPad: Home to wake, swipe up for the keypad, then six digits each tapped and checked (about 1 s each); natively on the iPhone: 1.5 s for the lock screen to read after closing HID, then about 0.7 s a digit. Without switching, 3 minutes idle on the iPad gave the same 18 s.

The unlock is meant to be there, and checking each digit is the safety rule (one wrong passcode disables auto-unlock), so it stays as it is. But nothing said it happened: Daemon::ensure_unlocked dropped Outcome::Unlocked, so the answer and the event log were silent, and an agent (or a person reading a regression run) saw an unexplained 10–20 s.

  • ensure_unlocked records how long an unlock took (PerDevice::unlocked) and writes 已自动解锁(用时 X 秒) to the event log.
  • dispatch adds it to the answer's first line, like the other notes about what was done: 没找到包含 "…" 的元素,…(手机锁着,先自动解锁了,用时 8.7 秒). A screenshot gets it in its caption, an error after the unlock in its message. No unlock, no change.

Tests

1. Unit tests

  • cargo test -p ictl-daemon --all-features --locked (113 passed), cargo clippy -p ictl-daemon --all-features --locked --tests -- -D warnings (with the two lints the local 1.89 toolchain adds, see CONTRIBUTING) and cargo fmt -p ictl-daemon --check pass in the Rust 1.89 container. Only ictl-daemon changed; CI runs the workspace.
  • New test: an_unlock_first_is_said_on_the_answers_first_line (text with then=elements, image caption, error, nothing unlocked)
  • No existing test removed, ignored or loosened
  • #[ignore] tests: none apply

2. Real-device regression

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

  • iPad mini 5, iPadOS 26.7.3 (WDA), run.py: --- 14 calls, 0 failed, 19.7s in all
  • iPhone 15 Pro Max, iOS 27.2.1 (native), run.py: --- 14 calls, 0 failed, 16.6s in all
  • Neither run unlocked (phones awake), and no note appeared
  • Longer run: not affected (only the answer's text and the event log change)

3. Regression cases

  • Device cases in the area: auto-unlock on both routes, re-run by the lock steps below
  • New row: #144

4. Real-device proof

Same steps on both builds and devices: lock → iphone_tap_element on a missing text → lock → iphone_screenshot → Home.

main (fd759c0) this branch
iPhone, tap after lock 9.14 s, 没找到包含 "不存在的按钮xyz" 的元素,先用 iphone_list_elements 或截图看看屏幕 9.40 s, …截图看看屏幕(手机锁着,先自动解锁了,用时 8.7 秒)
iPhone, screenshot caption 430x932 点,图像像素即点坐标(经 HID) …(经 HID)(手机锁着,先自动解锁了,用时 8.5 秒)
iPad, tap after lock 21.46 s, no note 18.18 s, …(手机锁着,先自动解锁了,用时 15.1 秒)
iPad, screenshot caption 1024x768 点,图像像素即点坐标(经 WDA) …(经 WDA)(手机锁着,先自动解锁了,用时 13.6 秒)
Event log nothing 已自动解锁(用时 8.7 秒), (用时 8.5 秒), (用时 15.1 秒), (用时 13.6 秒)

Checklist

  • MCP tool names, parameters and default outputs stay compatible (one more note on the first line, only after an unlock)
  • No new dependencies
  • Changelog: one line under Unreleased, Improvements
  • No private data in the outputs above

🤖 Generated with Claude Code

Derrors and others added 3 commits November 15, 2026 23:23
With auto-unlock on, the first action after the phone locked itself
unlocked it first: about 14 s on an iPad through WDA (a digit and a check
per second), about 5 s natively. The answer said nothing about it, so the
action just looked slow (the first action after switching devices, it
seemed, since the device switched to had sat idle and locked meanwhile).

The answer now says it on its first line, with how long it took:
`已按 home(手机锁着,先自动解锁了,用时 14.1 秒)`; also a screenshot's
caption and an error after the unlock. The event log gets a line too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s on the iPhone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Derrors
Derrors merged commit 8d3e69d into main Nov 15, 2026
7 checks passed
@Derrors
Derrors deleted the feat/unlock-note 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