Repository navigation
TD-5225: reading a window's accessibility tree no longer crashes TST Desk - #111
Merged
Merged
Conversation
…Desk ui_snapshot through the host's cu-agent.sock aborted the app on macOS for any target app. The host read every AXValue, AXTitle and similar attribute as a CFString, but AXValue is a number on a checkbox or slider and an AXValueRef on a scroll area. CoreFoundation throws on a non-string and Rust aborts on a foreign exception, so the host died, the daemon followed it, and every computer-use client lost its tools until the app was reopened. Children taken out of a CFArray were also used after the array was released. The CF reads move to cu_cf.rs. text() and flag() check the CF type first: strings as-is, numbers and booleans written out, anything else empty. items() retains each array element, and an Owned wrapper releases every reference on drop, so cu_ax.rs no longer pairs CFRelease calls by hand. ui_action keeps the element it found alive while acting on it. The extern signatures for CFStringCreateWithCString and CFNumberGetValue match the existing ones in cu_agent.rs and cu_identity.rs, because clippy rejects clashing declarations. Tests use real CF objects. With the type check removed the test process aborts with the same foreign-exception error; with the retain removed it segfaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUthoCrBcxKu4GVj429dwD
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.
TD-5225 — Reading a window's accessibility tree crashes TST Desk
Done:
ui_snapshotthrough the host no longer aborts the app. Attribute reads check the CF type before reading (strings as-is, numbers and booleans written out, anything else empty), and elements taken out of a CFArray hold their own reference until the walk is done. Before this, the first checkbox, slider or scroll area in any target window killed the host and the daemon, so every computer-use client lost its tools until the app was reopened.Acceptance criteria:
ui_actionkeeps the element it found alive while acting on itui_snapshotof Finder, of TST Desk itself and of an Electron app returns a tree withpath: host, and the app keeps running. Before the fix the same calls killed the app within a second, every time.Decisions: none (Class A: CF helpers split into
cu_cf.rsto keepcu_ax.rsunder the size limit).Files:
shell/src/cu_cf.rs(new),shell/src/cu_ax.rs,shell/src/lib.rs,docs/tst-desk-backlog.mdTests: 6 new unit tests in
cu_cf.rs(macOS only, likecu_ax.rs, so Linux CI compiles them out). Run on macOS:cargo testlib 135 passed;daemon_supervisionfailed once on the first cold run and passed 3/3 on reruns and on main;cargo clippy --all-targets -- -D warningsclean.Also checked live on the same build: the TD-5223 stop-file path works for an outside client through
cu-agent.sock. With the file present,movereturnserr stopped, an acting json op returns{"ok":false,"stopped":true}, andcapturestill works. The daemon logs the outside engage and clear. The TD-5224 shortcut registers at launch.Next: none.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HUthoCrBcxKu4GVj429dwD