Repository navigation
fix(scripts): Gate tab and pick on the webview settle, not just dump - #800
Merged
Merged
Conversation
#779 defined webContentSettled inside the dump block. tab and pick walk the same WKWebView subtree and raced its priming. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
5 tasks done
This was referenced Sep 17, 2026
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.
Why
A WKWebView publishes its accessibility subtree only when a client asks for it, and the real children land about 107 ms after the first ask. #779 taught
scripts/ax-settings.swiftto wait for that, but it definedwebContentSettledinside thecase "dump":block, so onlydumpgot the gate.tabandpickwalk the same subtree and had none.Measured on
AI_BUDDY_SETTINGS_WEBVIEW=1, five app launches each, before this change:Both die because
findandscanwalk a window whose content view is still a childlessAXGroup.tab Presenceis the first thingscripts/verify-settings-macos.shdoes after opening Settings, which is why the step 7 run in #706 reportedcould not dump the Presence tab.What changed
webContentSettledmoves out of thedumpblock to file scope, unchanged, and a newsettledWindow(titled:)pairs it with the existingwaitFor.tab,pickanddumpall resolve their window through it.Hoisted rather than copied into each block, so the wait has one definition and one timeout.
openandframekeep the ungatedsettingsWindow():openpresses the tray status item and waits for the window to exist,framereads the window rectangle, and neither descends into web content.opensucceeded on all 40 invocations across these runs, before and after.Out of scope:
scripts/verify-settings-macos.shis untouched, and so are the dump line format, the depth bound, and every other subcommand's behaviour.How to verify
swiftc -O scripts/ax-settings.swiftis clean with no warnings, andpre-commit run --files scripts/ax-settings.swiftpasses.The two reproductions, same trees, after this change:
scripts/verify-settings-macos.shunmodified against the native Settings window holds its baseline: 18 PASS, 2 SKIP, 0 FAIL, exit 0.The same script unmodified with
AI_BUDDY_SETTINGS_WEBVIEW=1moves from 9 PASS / 0 SKIP / 5 FAIL to 10 PASS / 0 SKIP / 4 FAIL, exit 1 either way. Both sides were run here on the same tree, and the before reproduces the step 7 figures on #706 exactly. The after is identical on two consecutive runs.tab Presence dumpedis the check that flipped.Notes
The webview run is still red, and this change was never going to make it green. Two of the three causes in the step 7 comment on #706 are untouched:
should be editablefailures. WebKit publishes<label for=…>as two consecutiveAXStaticTextnodes, so the script's "the control is the next line after the label" rule lands on the duplicate. That is row addressing inverify-settings-macos.sh, which this pull request deliberately does not touch.could not pick Harness · claude. The<select>options are not in the accessibility tree at all, anywhere under the application element. The gate is visible in the failure that moved one stage later:picknow finds and presses the popup and fails on the option search, where before the reopen it never found the popup. The Harness half of the script is still unreached, and this is the same shape as macOS Settings Off pick does not leave the Harness popup #634.One correction to the step 7 write-up. It recorded that accessibility priming is per client process. It is not:
tab AIin one process primed the tree for apickin the next. What does tear the subtree down is the close-and-reopen, which is whypickneeds its own gate rather than inheriting one from an earlier command.— Claude Code agent, on @omesser's behalf.
🤖 Generated with Claude Code