Skip to content

MCP: per-display ui.settle to unblock parallel multi-window automation (MCP-115) - #403

Open
marcoslor wants to merge 1 commit into
mainfrom
feat/mcp-115-per-display-settle
Open

marcoslor wants to merge 1 commit into
mainfrom
feat/mcp-115-per-display-settle

Conversation

@marcoslor

Copy link
Copy Markdown
Owner

Outcome

Removes the phone-wide ui.settle serialization bottleneck (MCP-115) so multiple app windows can settle and interact in parallel without starving each other.

  • Phone (android/core + android/app): replaces the single per-session SettleWatch with one watch per display sharing the single UiAutomation event listener (SettleWatches.kt, UiAutomationTree.kt, Session.kt). Concurrent ui.settle calls on distinct displays run in parallel; a second ui.settle on the same display still answers busy. Instantaneous ui.tree/ui.press/ui.type reads no longer block behind another display's settle wait, and the event-listener mask drops back to empty once zero watches remain active across all displays.
  • Mac (ContiguaCore + Contigua): decouples ui.settle from the phone-wide PhoneReadQueue (MCP-9), serializing settles per stream while keeping instantaneous ui.tree/ui.press/ui.type serialized on PhoneReadQueue. All active settles fail cleanly on link loss/session end.
  • Fake phone & docs: updates tools/fakephone/fakephone.py, deckctl.py, test_selfcheck.sh, docs/PROTOCOL.md, docs/specs/mcp.md (MCP-9, MCP-115), and docs/design/mcp.md.

Fixes #391

Checks

  • Tier 0:
    • scripts/check-rules.sh --base $(git merge-base HEAD main): PASS (21 files checked)
    • scripts/check-ratchets.sh --base $(git merge-base HEAD main): PASS
    • scripts/check-format.sh --base $(git merge-base HEAD main): PASS (8 Swift files, 7 Kotlin files)
  • Android K1 (OpenJDK 17):
    • ./gradlew -q :core:test --tests app.contigua.server.UiTreeSessionTest :app:assembleDebug :app:testDebugUnitTest --tests app.contigua.server.SettleWatchTest --tests app.contigua.server.SettleWatchesTest: PASS (full :app:testDebugUnitTest 546/546 passed)
  • Mac K2:
    • swift test --filter "ContiguaCoreTests|MCPCoreTests|MCPToolHostTests": ContiguaCoreTests 433/433, MCPCoreTests + MCPToolHostTests passed, 0 failures
    • swift test --filter "PhoneReadQueueTests|WindowActQueueTests": PhoneReadQueueTests 13/13, WindowActQueueTests 17/17, 0 failures
    • (Unfiltered swift test hits pre-existing teardown stall #161.)
  • Fakephone & MCP eval:
    • bash tools/fakephone/test_selfcheck.sh: SELFCHECK PASS (including concurrent two-display ui.settle + same-display busy + concurrent ui.tree)
    • python3 -m unittest discover -s tools/mcp-eval -p 'test_*.py': Ran 34 tests in 1.158s — OK

Surfaces

  • Wire protocol (docs/PROTOCOL.md "UI tree" §6–§7): updated.
  • Android (:core, :app): updated and verified.
  • Mac (ContiguaCore, Contigua): updated and verified.
  • Fake phone (tools/fakephone): updated and verified.
  • Extensions / UI: n/a.

@marcoslor marcoslor added android Phone app feature New capability internals Refactor, build, tooling; no user-visible change mac Mac app and extensions protocol Wire protocol, `docs/PROTOCOL.md` labels Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

android Phone app feature New capability internals Refactor, build, tooling; no user-visible change mac Mac app and extensions protocol Wire protocol, `docs/PROTOCOL.md`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP: per-display ui.settle to unblock parallel multi-window automation (MCP-115)

1 participant