Repository navigation
fix(daemon): restart a stuck axauditd instead of failing until the phone is replugged - #152
Merged
Merged
Conversation
…one is replugged Under native control (iOS 27) the phone's axauditd, the process behind remoteAXService, can get stuck: every read then times out on `deviceAPIVersion`, a new session or tunnel doesn't help, and only replugging the phone brought it back. Seen after automatic unlocks and daemon restarts (iPhone 15 Pro Max, iOS 27.2.1); freezing axauditd with SIGSTOP reproduces it, and ending it brings remoteAXService back at once. remoteAXService not answering is now an error of its own (DeviceError::AxUnanswered, worded as before). Reading the screen or the foreground app then ends axauditd through CoreDevice (launchd starts it on the next connection) and reads once more, at most once a minute per device, and the event log says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 tasks done
Derrors
added a commit
that referenced
this pull request
Nov 18, 2026
…y byte (#153) * test(terminal): a busy runner gets more attempts to send a key byte by byte The fragmented-key check throws away an attempt whose writes took longer than 0.2 s (the script was held up, which proves nothing about the menu) and tries again, five times at most. A busy macOS runner stretched every sleep for longer than that: five attempts in a row took 0.21-0.33 s, and macos-terminal failed twice on 2026-11-18 (#151, #152) with nothing wrong in the menu. It now tries up to 30 times within 20 s, says how many attempts a key took when it needed more than one, and the failure names the count. The budget, the gap between bytes and what is checked are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: what the axauditd stall in regression case #155 was traced to Only right after the lock button with a read following; what was tried and didn't reproduce it; the cause is inside axauditd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 18, 2026
Derrors
added a commit
that referenced
this pull request
Nov 18, 2026
…too (#156) With native control (iOS 27), axauditd also gets stuck without timing out: the frontmost app reads no elements at all, not even its own application element, on a new session too, while SpringBoard reads as usual. Reading the screen, tapping by text and launching apps then failed with "no screen elements read" until axauditd was ended by hand; restarting the daemon didn't help. Seen once on an iPhone19,7 (iOS 27.2.1); ending axauditd brought the reads back at once. Such a read is now reported as the accessibility service not answering (DeviceError::AxUnanswered, worded as before), which the daemon restarts axauditd for (#152), at most once a minute. The lock screen under the HID screen stream reads one element (#126) and is not taken for it. scenarios.py `url`: #131 also passes when the link opens in the browser the answer names. Natively a web link always opens in Safari; through WDA the system opens the default browser, which failed the check on a phone whose default browser is Chrome. 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
Under native control (iOS 27) the phone's
axauditd, the process behind remoteAXService, can get stuck. Every read of the screen then times out (remoteAXService: request, thendeviceAPIVersionon each new handshake), the daemon stays at "准备手机失败,稍后重试", and a new session, a new tunnel or a daemon restart doesn't help. Only replugging the phone brought it back. It happened three times on 2026-11-17/18 on an iPhone 15 Pro Max (iOS 27.2.1): twice right after a deploy restarted the daemon, once during a regression run right after an automatic unlock.Freezing
axauditdwith SIGSTOP (through CoreDevice AppService) reproduces it exactly. Ending it brings remoteAXService back at once: launchd starts it on the next connection, and the next read took 0.3 s.ictl-device: remoteAXService not answering (a handshake, a request or the connection timing out) is nowDeviceError::AxUnanswered, worded exactly likeTimeout.Tunnel::restart_ax_daemonends…/AccessibilityAudit.framework/Support/axauditdwith SIGKILL and gives launchd a second.ictl-daemon: reading the screen (ax_snapshot, so also preparing the phone) or the foreground app, onAxUnanswered, restartsaxauditdand reads once more. At most once a minute per device (AX_RESTART_EVERY); if that doesn't help the error is reported as before. The event log says无障碍服务没有应答(…),已重启手机上的 axauditd.WDA and iOS below 27 are not touched.
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.89 in Docker, Debian 12; clippy with the two lints 1.89 reports and CI's 1.99 doesn't allowed). The one local failure,tasks::tests::the_agent_cant_control_its_own_task, fails onmainthe same way in this container (process parentage); CI runs it.ax::wedge_tests::an_unanswered_accessibility_service_is_told_apart_and_reads_as_a_timeout,ax::wedge_tests::only_axauditd_is_the_accessibility_daemon(process paths as the phone lists them). The restart itself needs a phone; see section 4.#[ignore]tests of the changed area run by hand: none apply2. Real-device regression
tests/device/run.py --repeat 5: 80 calls, 0 failed, 88.1 s (main48b2c6e earlier the same day: 80 calls, 0 failed, 89.8 s)tests/device/scenarios.py --lock --url: 57 checks, 0 failedtests/device/run.pyover the viewer's/mcp: 16 calls, 0 failedtests/device/tasks.py: 71 checks, 0 failed;remote: 23 checks, 0 failed;restart: 4 checks, 0 failed3. Regression cases
statusshows native control instead of asking for WDA #127 (lock scenario)4. Real-device proof of the fix
main, gone with this branch, same device and stepsSteps and results
axauditdfrozen with SIGSTOP through CoreDevice AppService (a scratch example, not part of this PR), theniphone_list_elements:Checklist
🤖 Generated with Claude Code