Repository navigation
fix(desktop): restore macOS WebView self-control - #3600
Merged
Merged
Conversation
…ax-deadlock # Conflicts: # src/web-ui/src/app/components/NavPanel/unifiedSessionCreation.test.ts
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.
Summary
Fix macOS Desktop freezing when ComputerUse observes its own OpenBitFun window. The old wrapper ran the entire accessibility walk on main; WebKit accessibility IPC then waited for the same thread. Individual messages now use the element's serving process: same-process AppKit calls run on main, while WebKit/external calls remain on the blocking worker. Observation, cached-node actions, hit testing, text operations and menu discovery share this routing.
Preserve the control token across dispatch and recheck it on the executing thread before native actions or user attribute writes, so Stop rejects stale queued input. Add a real same-process AppKit/WKWebView regression covering reads, geometry, screenshot, exactly one activation per image/node click, exact Unicode text with independent DOM feedback, shortcuts and stopped-input rejection, with an external deadlock watchdog.
Cross-process AX proxies also advertise
AXSelectedTextas writable even when the setter is a no-op. Choose the existing directed-keyboard route before submitting text for these proxies, while native controls retain selection-preserving AX insertion. The new fixture reproduced the empty DOM value before this correction and verifies the actual input afterward.Test-only commits align scripted mock-model HTTP cleanup with the existing streaming fixture: a client disconnect after the completed SSE payload must not panic the server and strand subsequent requests (observed Windows error 10053). Payload writes and test deadlines remain checked.
Type and Areas
Bug fix; macOS desktop ComputerUse adapter, native regression fixtures, and mock-model stream cleanup.
Motivation / Impact
Two reported runs stopped at
get_app_state(OpenBitFun). The macOS hang report showed the main-thread AX call and WebKit's synchronous reply wait. Self-control remains supported without blocking the UI event loop.Verification
PASS: final head
d959e7835740ae2c72f45c9d71b01865f499edffCI run: 11 checks passed; 2 jobs skipped by impact selection.PASS:
pnpm run fmt:rsandgit diff --check.PASS:
node scripts/test-macos-computer-use-self.mjson macOS 15.7.3, including image/node click counts, exact Unicode DOM content and final stale-input rejection. AX-only read ~252 ms; screenshot observation ~411 ms.PASS:
cargo check --locked -p openbitfun-desktop --features devtoolsfor the routing change; final head also covered by CI.PASS:
pnpm run check:core-boundaries.Actual development-app logs also show two completed same-process observations after rebuilding: 46 and 70 nodes in approximately 79 ms and 74 ms. The previously hanging path returned in both cases.
PASS:
pnpm --dir src/web-ui run test:run src/app/components/NavPanel/unifiedSessionCreation.test.ts(9 tests).INCONCLUSIVE: existing
node scripts/test-macos-control-roundtrip.mjsreached observation/click checks, but the foreground changed from its disposable observer to WeChat and its focus invariant failed. The user confirmed they were operating the computer during the run. This is not recorded as a passing cross-app run.PASS:
cargo test --locked -p openbitfun-cli --test terminal_process_contracts scheduled_jobs_(real CLI process restart, persisted job restoration and unattended one-shot execution; 3.04 s on macOS). Windows execution is covered by CI.Native runtime evidence is local macOS only. Remote workspace, remote control, Peer Device Mode and Detached Dispatch were not exercised; no wire or persisted schemas changed.
Reviewer Notes
AI-assisted; locally tested with a real native WebView fixture.
AXUIElementGetPidcan report the presenting app for WebKit proxies, so routing dynamically resolves_AXUIElementGetActualPidwhile authorization keeps the presenting PID. Missing routing SPI returns an explicitAX_DISPATCH_UNAVAILABLEstate. Objective-C exceptions are caught on the executing thread. Enigo/HIToolbox input keeps its main-thread wrapper. WebKit's AX base object declares an empty selected-text setter; fallback is chosen before mutation and never retries an uncertain write.Checklist