Repository navigation
Host: keyboard layout read on the main thread; a call cut off mid-action is unknown (#244) - #248
Merged
Merged
Conversation
…-action is unknown (#244) Mac.systemState(), which every desktop_apps inventory and the observation after desktop_open read, called Text Input Sources off the main thread. HIToolbox traps on a queue assertion there, and the host crashed mid-call; the crash reports show it in the release app and the dev app. The agent saw only "The Desktop Tools host closed the connection" although the open had happened. The MCP server now reports a connection lost during an action as outcome unknown (HOST_CONNECTION_LOST, retry_safety unsafe), and during a read as safe to call again. Why: native2/Sources/DesktopMac/System.swift | Text Input Sources (TIS*) calls must run on the main thread: HIToolbox asserts its queue and traps the whole host otherwise, only sometimes, so it passes in tests Why: native2/Sources/desktop-tools-mcp/main.swift | a connection that drops after an action was sent means the action may have run; report unknown, never a plain error an agent reads as nothing happened 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.
Part of #244: the "host closed the connection" report. The partial inventory part is discussed below.
Cause
The host crashed.
~/Library/Logs/DiagnosticReportson this Mac has threedesktop-tools-appcrashes: two from release 0.20.0 (2026-11-07) and one from the dev app (today). All three are anEXC_BREAKPOINTin libdispatch'sdispatch_assert_queue, raised from HIToolboxTSMGetInputSourceProperty, called byMac.systemState()→Mac.apps()(System.swift:63,tisString).systemState()read the keyboard layout through Text Input Sources off the main thread. Every other TIS read in native2 already runs on the main thread. The inventory thatdesktop_openreturns reads it, so the host could crash after the open had already happened. The MCP server then reported only "The Desktop Tools host closed the connection." I hit this myself on the first call after approving the dev app.Changes
System.swift: the keyboard layout is read on the main actor.desktop-tools-mcp: when the host connection drops after a call was sent:Outcome: unknownwithretry_safety: unsafe, errorHOST_CONNECTION_LOST, and advice to observe the target before acting again;Checked
swift test --package-path native2passes.desktop_click(Open Sheet on the sheet fixture) through the MCP server and killed the standalone host 150 ms later. The sheet opened, and the result wasOutcome: unknown … HOST_CONNECTION_LOST. Before this change it was a plain error. Adesktop_appscall sent after the drop got the read message.Not reproduced: partial Xcode inventory
inventory_completeness: partialwith "Accessibility window enrichment was incomplete" is reported when Accessibility gives up partway: a window's batched attribute read, its window number or the focused-window read returns an error other than "no value". That is likely while Xcode is busy distributing. I don't have an archive mid-distribution to reproduce it, so I left it alone. The listing already says it's partial honestly. #247 retries the follow-up observation once when the tree is incomplete, which covers the incomplete tree seen just after a sheet appears.🤖 Generated with Claude Code