Repository navigation
Conversation
After an action, agents guess a sleep before reading state. get_app_state now takes settle_ms: before reading, it fingerprints the target window about every 100 ms with the same bounded AX walk query uses (role, title, description, value and window-relative layout of every visited node; no records, no actions read) and reads once the fingerprint has stayed the same for settle_ms (capped at 2000), for at most 5 seconds. A note after the state says whether the window settled and how long it waited. The wait is read-only: no activation, no capture. The stability check is a pure function with an injectable clock, tested with synthetic digests. Action read-back keeps its fixed short pause. Linux and Windows reject settle_ms.
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
get_app_statetakes an optionalsettle_ms(macOS). Before reading, it polls a fingerprint of the target window about every 100 ms and reads once the fingerprint has stayed the same forsettle_ms(capped at 2000), for at most 5 seconds. The fingerprint uses the same bounded AX walk asquery: role, title, description, value and window-relative layout of every visited node. A note after the state text says whether the window settled and how long it waited. Read-only: no activation, no extra screenshot. JS:app.getAXState({ settleMs }). Linux/Windows rejectsettle_ms.Why
After an action that loads or animates, agents guess a sleep before reading state. A still window now costs about
settle_ms; a loading one is read once it stops changing; one that never stops returns its state after 5 s. The fingerprint uses accessibility data rather than pixels, since carets, video and CSS animation would never settle. The ceiling is fixed and documented, likequery's 2 s deadline. Action read-back keeps its fixed 150 ms pause; using the wait there would change every action's latency.Verification
swift test: 384 tests, 7 skipped, 0 failures. New tests cover the stability check with synthetic fingerprints and a fake clock (still, loading then stopping, a blip, never stopping, a quiet period longer than the ceiling),settle_msvalidation, and the schema.settle_ms: 300: still window settled after 367 ms; a label changing for 2 s settled after 2343 ms; a web page adding rows for 2 s settled after 2127 ms with the loaded content; a never-ending label stopped at 4998 ms with "Not settled"; the same read withoutsettle_mstook 97 ms.Limits
Changes visible only in pixels (canvas, video) don't move the fingerprint, and only the first ~1000 characters of each value are compared.