Skip to content

feat(apple): support watchOS simulators through the XCUITest runner - #4752

Merged
thymikee merged 20 commits into
mainfrom
t3/watchos-simulators
Nov 19, 2026
Merged

thymikee merged 20 commits into
mainfrom
t3/watchos-simulators

Conversation

@thymikee

@thymikee thymikee commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

⌚ agent-device now drives Apple Watch simulators

Same CLI, same runner, same refs and selectors as iOS. Point an agent at a watch and it can open apps, read the screen, tap, swipe, turn the Digital Crown, type, and go back.

Four Apple Watch screens driven by agent-device: Settings, Maps zoomed into Łódź, the text input sheet, and a composed message

Crown scroll, tap, back, edge-swipe back Crown zoom and one-finger pan Typing through the input sheet
Settings: tap Smart Stack, back, crown scroll, open General, edge-swipe back Maps: crown zooms in, pans, crown zooms out Messages: compose, fill types into the input sheet and commits it

Every frame above is the branch-built CLI on an Apple Watch Series 11 (46mm) simulator, watchOS 27.0, real time:

agent-device open com.apple.NanoSettings --platform ios --udid <watch> --session watch
agent-device press 'label="Smart Stack"' --session watch --settle
agent-device back --session watch
agent-device scroll down 0.8 --session watch          # turns the Digital Crown
agent-device gesture swipe right-edge --session watch  # edge-swipe back
agent-device fill 'role=text-field' "On my way, 5 min" --session watch
agent-device gesture pan 140 124 -90 30 600 --session watch

Summary

Adds watchOS simulators as an Apple OS leaf on the shared XCUITest runner. Closes #4738 (spike #4735).

  • The runner's existing targets add the watchOS simulator SDK; a watch-only SwiftUI host replaces the UIKit host there. No new project, scheme, or test identifier.
  • packages/platform-apple/src/os/watchos/facts.ts admits only watch interactions and refuses the rest, in facts and bindings.
  • Digital Crown: scroll up|down rotates it, home presses it. One-finger swipe and gesture swipe|pan|fling, back (the navigation Back button), fill/type, and action-button on Ultra.
  • Refused with typed hints: multi-touch, app-switcher, orientation, keyboard, logs, record, apps, and other non-watch commands. Device discovery does not list physical watches.
  • CI: the PR-time runner build job (ci(apple): compile tvOS and visionOS runners on runner-owning PRs #4755) gains a watchOS leg, so a watchOS-only break fails the PR, not the release.
  • Docs: a watchOS section in the commands reference; ADR 0009 amended.

Validation

Live runs at 25a0267 (default and private set) and 6806bc1 (fill and back): see the evidence comments. Earlier head 8ef3e17 passed all CI checks. Branch CLI on Series 11 and Ultra 4 simulators (Xcode 27.1, watchOS 27.0): every admitted command above, install, screenshot, action-button (Ultra), close --shutdown, and the refusals. pnpm build:xcuitest:watchos and the iOS runner build pass.

Not reachable: the watch face and its overlays (Notification Center, Smart Stack), because commands bring the session app forward first. Media lives on the pr-media/4752 branch and can be deleted after merge.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.41 MB 6.42 MB +12.6 kB
Package (unpacked) 6.41 MB 6.42 MB +12.6 kB
Package (download) 1.95 MB 1.95 MB +3.5 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.2 ms 38.4 ms +12.2 ms
CLI --help 56.2 ms 75.1 ms +18.9 ms

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on 58920c5. The verdict and the full list are in the summary comment.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

The code looks reasonable at 8ef3e17, and all 35 checks pass. CI does not run a live watch simulator, so the device behavior is still unproven at this head. The next step before merge is a live watch run at this commit, plus the private-set run the issue asks for.

The only live run reported is the summary at a4221a2. Three later commits change device-facing paths: 05f7b26 adds bindWatchOsOperations, which now decides which operations are bound for every watch command (runtime.ts:415); 040cd4c removes .watchOS(.v10) from the snapshot-presentation packages that the watch runner compiles; 8ef3e17 changes the runner seam facts (facts.ts:100). The issue also asks for the same flow in a private simulator set with --ios-simulator-device-set, and for a row swipe action and Notification Center from the watch face. The PR reports neither. The docs now say the face and overlays are unreachable, so #4738 needs an amendment for that condition. Please run this at 8ef3e17 with the branch CLI (pnpm build, pnpm build:xcuitest:watchos, pnpm clean:daemon, node bin/agent-device.mjs): open com.apple.NanoSettings --platform ios --udid <watch> --session watch, snapshot -i, press a row, scroll down, scroll up, swipe (horizontal page), gesture swipe from the right edge, back, home, fill into a text field, screenshot, one refusal (orientation must give reason unsupported-platform-leaf), then close --shutdown. Then run open, snapshot -i, press, close --shutdown in a private set with --ios-simulator-device-set <path>. Please post the commands, exit statuses, key output, simulator model, runtime, Xcode version and SHA.

Not blocking, take or leave: commands.md:370 says there is no name lookup without apps, but open still resolves display names and iOS aliases through resolveIosApp, and an alias such as settings points to an iPhone bundle ID, so the doc could say to use watch bundle IDs such as com.apple.NanoSettings; commands.md:366 says the sheet is found by its English Done label, but the runner detects it by the keyboard and only the commit taps Done, so on another locale the text is typed and the command fails with commitNotObserved; performWatchBack (RunnerTests+WatchInteraction.swift:59) discards the tapAt outcome and the edge-swipe branch is unverified, so back can report success on a root screen (iOS answers back_swipe_no_change there), which either needs a non-dispatched outcome mapped to refused or unconfirmed, or a note in commands.md that watch back is unverified; the watch admission now lives at three sites (runtime.ts:197, runtime.ts:415, runner-runtime.ts:125), and it could be one rule if the Apple bind dropped every fact-refused operation for all leaves, or passed admitted: facts.operations to createAppleSystemOperations as navigation does, which would let bindWatchOsOperations go; and the runner-seam wrap at runner-runtime.ts:125 has no test, since removing applyWatchOsOperationFacts there keeps every test green, so one case with a watch device that asserts writeClipboard is refused would cover it, or the wrap could wait until a provider can produce a watch.

Two earlier inline threads no longer apply at this head, so please resolve them: the physical-watch discovery thread (docs now say discovery does not list a physical watch, and the runner seam applies the admission) #4752 (comment), and the action-button description thread (the text now reads "iPhone, iPad, and Apple Watch Ultra simulators", fixed in 05f7b26) #4752 (comment).

thymikee and others added 9 commits November 19, 2026 16:18
The runner's host app and UI-test targets add the watchOS simulator SDK. A
SwiftUI host replaces the UIKit host there. The runner gains watchOS branches:
scroll turns the Digital Crown, back presses the navigation bar back button or
swipes from the left edge, typing goes through the system input sheet, and
one-finger planned gestures use the event synthesizer. Build, clean, and
package scripts learn the watchos platform. Part of #4738.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Discovery classifies watch simulators as appleOs watchos and ranks them last
for --platform ios. The interactor sentinel is gone. os/watchos/facts.ts
admits only operations with a watch meaning (lifecycle, snapshot, touch,
swipe and pan, the Digital Crown, back, typing, screenshots, the Action
Button) and refuses the rest, so the per-module watchOS checks are removed.
A physical watch is refused. Closes #4738.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fixes: the input sheet's text view is read only when it exists, a
planned gesture resolves the app window before synthesizing, a crown scroll
waits for its deceleration, back presses only an unambiguous back button, and
a screen-edge swipe starts on the edge as a coordinate drag. Watch simulators
are classified from simctl identifiers only, never a user-chosen name, and
rank below every other Apple device. The packaged SwiftPM manifest gets the
same watchOS minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chOS default

The explicit watchOS minimum made the two package manifests a new native
clone. The runner builds for watchOS without it. The ADR cites the watch
leaf by its repository path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The always-loaded MCP scroll description has a byte budget, so the Digital
Crown note moves to the CLI detail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The watch fact leaf narrowed facts but the binding still carried clipboard,
alert, settings, and log operations from the modules' own facts. The binding
now drops every operation the watch refuses, and a test pins facts and
bindings together. The action-button CLI detail names Apple Watch Ultra.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the physical-watch docs

createAppleRunnerRuntime reports the same watch facts as the platform
runtime. Device discovery never lists a physical Apple Watch, so the docs say
that instead of promising a refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The PR-time runner build job gains a watchOS leg beside tvOS and visionOS,
with its own swift-runner-watchos gate, so a watchOS-only build break fails
the PR instead of the release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the t3/watchos-simulators branch from 8ef3e17 to e852f0b Compare November 19, 2026 15:21
thymikee and others added 2 commits November 19, 2026 16:23
… seam watch facts

A back-button tap the runner could not dispatch now refuses instead of
reporting success; the edge-swipe fallback stays unverified and the docs say
so. The runner seam has a watch-device test. The watchOS docs name watch
bundle IDs and describe the input sheet detection and its locale limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A screen-edge swipe and the back fallback ran a coordinate drag that first
waited for the app to idle, so on an animating screen the command hit the
runner's main-thread watchdog even though the swipe landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on e852f0b. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

Live run at head 4141dd9ada

Branch CLI (node bin/agent-device.mjs) after pnpm build (exit 0), pnpm build:xcuitest:watchos (exit 0), and pnpm clean:daemon (exit 0). Xcode 27.1 (27A9275), watchOS 27.0 simulator runtime (24R362). Simulators I created and deleted: Apple Watch Series 11 (46mm) in the default set, and Apple Watch Series 11 (42mm) in a private set. The managed runner build was used; no --ios-xctestrun-file.

Default set: Series 11 (46mm)

Command Exit Key output
open com.apple.NanoSettings --platform ios --udid <watch> --session watch 0 Building Apple runner... Opened: com.apple.NanoSettings
snapshot -i 0 13 nodes: Notifications, Smart Stack, Control Center, General
press 'label="Smart Stack"' --settle 0 Tapped label="Smart Stack" (104, 150); next snapshot shows [button] "Back", [text] "Smart Stack"
gesture swipe right-edge 0 Flung; next snapshot is the Settings root (13 nodes)
press 'label="Smart Stack"' --settle, then back --settle 0, 0 Back, settled after 1586ms: +12 -9
scroll down --settle / scroll up --settle (Digital Crown) 0 / 0 +4 -2 (Focus appears) / +2 -4
gesture swipe left-edge (contact from the right edge) 0 Flung
open com.apple.NanoMaps, then swipe 170 124 40 124 0, 0 Flung; map labels change: after the swipe the snapshot shows Voronezh, Kharkiv, Dnipro
home (crown press) 0 Home
open com.apple.MobileSMS, press Compose, press Create Message 0, 0, 0 New Message screen with [text-field] "Create Message"
fill 'role=text-field' "On my way, 5 min" 0 Filled 16 chars; next snapshot shows [cell] "On my way, 5 min"
screenshot final.png 0 208x248, shows the committed message
orientation landscape-left 1 UNSUPPORTED_OPERATION, details.reason: "unsupported-platform-leaf", hint watchOS has no device orientation. Not dispatched.
close --session watch --shutdown 0 Closed: watch; the simulator reads Shutdown

Private set: Series 11 (42mm), --ios-simulator-device-set /private/tmp/ad-cos-watch-set

Command Exit Key output
open com.apple.NanoSettings --platform ios --udid <watch> --ios-simulator-device-set <set> --session watch-set 0 Opened: com.apple.NanoSettings
snapshot -i 0 13 nodes
press 'label="Smart Stack"' --settle 0 Tapped label="Smart Stack" (94, 137); next snapshot shows the Smart Stack screen
close --session watch-set --shutdown 0 Closed: watch-set

Found and fixed during this run

The first pass, at 7a133ca65c, showed that gesture swipe right-edge went back but returned MAIN_THREAD_TIMEOUT. The watchOS screen-edge drag, and the back edge-swipe fallback, waited for the app to idle before dragging, which an animating screen does not do inside the watchdog. 4141dd9ada bounds that wait. The run above is a full rerun at that head.

Review notes

  • Applied: the docs name watch bundle IDs (aliases such as settings resolve to com.apple.Preferences). They say the input sheet is detected by its keyboard, with Done found by its English label, and that other system languages fail with TEXT_INPUT_COMMIT_NOT_OBSERVED. They also say the back edge-swipe fallback is unverified.
  • Applied: performWatchBack maps an undispatched Back-button tap to a refusal.
  • Applied: runner-runtime.test.ts asserts that a watch device refuses writeClipboard and admits tapPoint on the runner seam.
  • Not applied: collapsing the admission into consumers. bind builds its operations in about ten modules, and four of them (system, deployment, logs, network dump) recompute their own facts, so every future module would have to remember the watch rule. bindWatchOsOperations applies the same leaf rule by construction, and os/watchos/facts.test.ts pins facts and bindings together for every operation. The leaf module is the one rule; inspectFacts, bind, and the runner seam call it.
  • feat(apple): support watchOS simulators through the XCUITest runner #4738 is amended: the watch face and its overlays are out of scope, and the completion condition that opened Notification Center from the face is removed. Row swipe actions were verified with the spike's fixture app (SPIKE.md, gesture research); the system apps on the simulator have no row swipe actions to exercise.

The back edge-swipe fallback compares the screen before and after, and
answers back_swipe_no_change when nothing popped. Typing waits for the input
sheet to close after Done and reports TEXT_INPUT_COMMIT_NOT_OBSERVED when it
stays open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Live run at head 25a0267f19

This supersedes the run posted at 4141dd9ada: the two Apex findings on that head changed back and the input-sheet commit, so the whole sequence was rerun on new simulators.

Branch CLI (node bin/agent-device.mjs) after pnpm build (exit 0), pnpm build:xcuitest:watchos (exit 0), and pnpm clean:daemon (exit 0). Xcode 27.1 (27A9275), watchOS 27.0 simulator runtime (24R362). Simulators I created and deleted: Apple Watch Series 11 (46mm) in the default set, and Apple Watch Series 11 (42mm) in a private set. The managed runner build was used; no --ios-xctestrun-file.

Default set: Series 11 (46mm)

Command Exit Key output
open com.apple.NanoSettings --platform ios --udid <watch> --session watch 0 Building Apple runner... Opened: com.apple.NanoSettings
snapshot -i 0 13 nodes: Notifications, Smart Stack, Control Center, General
back (root screen, no back button) 1 COMMAND_FAILED: The back swipe changed nothing. (back_swipe_no_change, may have reached the device)
press 'label="Smart Stack"' --settle 0 Tapped label="Smart Stack" (104, 150); next snapshot shows [button] "Back", [text] "Smart Stack"
gesture swipe right-edge 0 Flung; next snapshot is the Settings root (13 nodes)
press 'label="Smart Stack"' --settle, then back --settle 0, 0 settled after 1555ms: +12 -9 (Settings root)
scroll down --settle / scroll up --settle (Digital Crown) 0 / 0 +4 -2 (Focus appears) / +2 -4
gesture swipe left-edge (contact from the right edge) 0 Flung
open com.apple.NanoMaps, scroll down 3 and press 104 178 (location prompt), then swipe 170 124 40 124 0, 0, 0, 0 Flung; before the swipe the map shows Warsaw and Poland (27 nodes); after it neither is present (18 nodes)
home (crown press) 0 Home
open com.apple.MobileSMS, press Compose, press Create Message 0, 0, 0 New Message screen with [text-field] "Create Message"
fill 'role=text-field' "On my way, 5 min" 0 Filled 16 chars after the sheet closed; the next snapshot shows the composed "On my way, 5 min"
screenshot final.png 0 208x248, shows the committed message
orientation landscape-left 1 UNSUPPORTED_OPERATION, details.reason: "unsupported-platform-leaf", hint watchOS has no device orientation. Not dispatched.
close --session watch --shutdown 0 Closed: watch; the simulator reads Shutdown

Private set: Series 11 (42mm), --ios-simulator-device-set /private/tmp/ad-cos-watch-set

Command Exit Key output
open com.apple.NanoSettings --platform ios --udid <watch> --ios-simulator-device-set <set> --session watch-set 0 Opened: com.apple.NanoSettings
snapshot -i 0 13 nodes
press 'label="Smart Stack"' --settle 0 Tapped label="Smart Stack" (94, 137); next snapshot shows [text] "Smart Stack" (10 nodes)
close --session watch-set --shutdown 0 Closed: watch-set

Found and fixed during the runs

The first pass, at 7a133ca65c, showed that gesture swipe right-edge went back but returned MAIN_THREAD_TIMEOUT. The watchOS screen-edge drag, and the back edge-swipe fallback, waited for the app to idle before dragging, which an animating screen does not do inside the watchdog. 4141dd9ada bounds that wait. 25a0267f19 then made the back fallback compare the screen before and after (back_swipe_no_change when nothing popped, as in the root-screen row), and made typing wait for the input sheet to close after Done. The tables above are a full rerun at 25a0267f19: 30 commands exit 0, and the two exit-1 rows are the expected refusals.

Review notes

  • Applied: the docs name watch bundle IDs (aliases such as settings resolve to com.apple.Preferences). They say the input sheet is detected by its keyboard, with Done found by its English label, and that other system languages fail with TEXT_INPUT_COMMIT_NOT_OBSERVED. They also describe the back_swipe_no_change and sheet-commit behavior.
  • Applied: performWatchBack maps an undispatched Back-button tap or drag to a refusal and verifies the edge swipe (Apex, r4630958923).
  • Applied: typing confirms the input sheet closed after Done (Apex, r4630958936). Done is still matched by its English label: the sheet exposes no identifier or trait that names its commit button, and the docs state the locale limit.
  • Applied: runner-runtime.test.ts asserts that a watch device refuses writeClipboard and admits tapPoint on the runner seam.
  • Not applied: collapsing the admission into consumers. bind builds its operations in about ten modules, and four of them (system, deployment, logs, network dump) recompute their own facts, so every future module would have to remember the watch rule. bindWatchOsOperations applies the same leaf rule by construction, and os/watchos/facts.test.ts pins facts and bindings together for every operation. The leaf module is the one rule; inspectFacts, bind, and the runner seam call it.
  • feat(apple): support watchOS simulators through the XCUITest runner #4738 is amended: the watch face and its overlays are out of scope, and the completion condition that opened Notification Center from the face is removed. Row swipe actions were verified with the spike's fixture app (SPIKE.md, gesture research); the system apps on the simulator have no row swipe actions to exercise.

@thymikee

Copy link
Copy Markdown
Member Author

The code looks right at 25a0267, but two device paths it changed have no live run yet. Compared with the earlier review at 8ef3e17 (#4752 (comment)), the back wording and the missing-Done and commit checks are now in place. The live evidence is still missing.

25a0267 changes two runner paths after the live run at 4141dd9. First, fill now also waits up to 3 s for app.keyboards.firstMatch to disappear after Done and fails with TEXT_INPUT_COMMIT_NOT_OBSERVED if it does not. If the watch input sheet's keyboard element stays in the tree after the commit, a fill that worked at 4141dd9 now exits 1. Second, the back edge-swipe fallback now succeeds only when watchScreenSignature differs before and after a 0.6 s settle. The live back at 4141dd9 used the Back-button branch, so this fallback has never run on a device. The documented fill could now fail falsely, and back could report back_swipe_no_change after a real pop or succeed on a root screen. Please rerun at 25a0267 with the branch CLI after pnpm build, pnpm build:xcuitest:watchos and pnpm clean:daemon. (1) Run open com.apple.MobileSMS, press Compose, press Create Message, then fill 'role=text-field' "On my way". It must exit 0 with Filled, and the next snapshot must show the committed text. (2) On the Settings root (open com.apple.NanoSettings, no Back button), run back. It must exit 1 with details.reason back_swipe_no_change. (3) On a pushed screen whose Back button is absent or not hittable, run back. It must exit 0, and the next snapshot must show the parent screen. If no system app has such a screen, use the spike fixture app and say so. Please post the SHA, commands, exit codes and key output.

Not blocking: watchScreenSignature uses only the first 8 navigationBar/staticText labels, so a live-updating label such as a timer could make back on a root screen look like a success, and a parent with the same first 8 labels as the child could read as back_swipe_no_change. If the rerun shows a misread, consider reusing the iOS swipe verifier's comparison (verifiedBackSwipe in RunnerTests+Navigation.swift) instead of a second, smaller signature. You can take or leave this.

The two threads from the earlier commits no longer apply, so please resolve them: performWatchBack now refuses an undispatched tap and answers back_swipe_no_change or back_swipe_unverified, and the missing-Done thread is covered by TEXT_INPUT_COMMIT_NOT_OBSERVED and the documented English-label limit. The physical-watch discovery and Action-button description threads are fixed at this head and can be resolved too.

CI is still running: all 13 checks are queued or in progress, and none has failed. 'Runner Build (tvOS + visionOS + watchOS)' matters most here because it compiles the new watchOS leg and the Swift in 25a0267. Before merge, please post the live run at 25a0267 and get green CI, including the watchOS runner-build leg.

The back fallback compared the first eight labels, so a ticking clock or
timer could read as a navigation on a root screen. It now compares each
element's type, identifier, and child count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on 25a0267. The verdict and the full list are in the summary comment.

On watchOS the interactive pop works only while the navigation back button
is shown: hiding it (navigationBarBackButtonHidden or a hidden navigation
bar) disables the edge swipe too. The fallback could never succeed, so back
now presses the button or refuses with back_swipe_not_dispatched, sending
nothing. gesture swipe right-edge stays available.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Live run at head 6806bc1f63

Branch CLI (node bin/agent-device.mjs) after pnpm build (exit 0), pnpm build:xcuitest:watchos (exit 0), and pnpm clean:daemon (exit 0). Xcode 27.1 (27A9275), watchOS 27.0 runtime (24R362), on an Apple Watch Series 11 (46mm) simulator I created and then deleted. The managed runner build was used.

What changed since 25a0267f19, and why

Case 3 could not pass as specified. On watchOS the interactive pop works only while the navigation back button is shown. I built a two-screen SwiftUI fixture app in a scratchpad (not part of this PR). It pushes one screen with navigationBarBackButtonHidden(true) and one with .toolbar(.hidden, for: .navigationBar). On both, the left-edge swipe at 9591e883d3 changed nothing, and back returned back_swipe_no_change. On system screens the Back button stayed hittable, including Settings > General after scroll down 2.

So the edge-swipe fallback could never succeed on any screen I found. 6806bc1f63 removes it, along with watchScreenSignature and its structural comparison, which 9591e883d3 had added for the timer-label recommendation. back now presses the Back button, or refuses with back_swipe_not_dispatched (dispatched: no) and sends nothing. gesture swipe right-edge is still available as an explicit swipe.

Results

Case Command Exit Key output
1 open com.apple.MobileSMS --relaunch, press @e6 (Compose), press @e10 (Create Message) 0, 0, 0 New Message, then the input field
1 fill 'role=text-field' "On my way" 0 Filled 9 chars; next snapshot -i shows [cell] "On my way"
2 open com.apple.NanoSettings --relaunch, snapshot -i 0, 0 Settings root, 13 nodes, no Back button
2 back --json 1 COMMAND_FAILED, This screen has no navigation back button., details.reason: back_swipe_not_dispatched, dispatched: no
Back button shown press 'label="Smart Stack"' --settle, then back 0, 0 [button] "Back" before; Back; next snapshot is the Settings root (13 nodes)
3 (fixture) press @e5 ("Hidden back"), then back --json 0, 1 Pushed screen (3 nodes, no Back button); back_swipe_not_dispatched, dispatched: no; the screen is unchanged
3 (fixture) press @e6 ("Hidden toolbar"), then back --json 0, 1 Pushed screen (2 nodes, no navigation bar); back_swipe_not_dispatched, dispatched: no
close --session watch --shutdown 0 Closed: watch

The full log also has failed attempts that came from my script, not the CLI. Two press calls ran with empty refs, because a shell variable was not word-split and because Messages reopened on an earlier draft. Two press calls used refs that a relaunch had expired. Each was rerun with a fresh snapshot, and the rows above are the reruns.

The default-set and private-set runs at 25a0267f19 cover the other commands. Since then only back, the edge-swipe helper's fallback, and docs have changed.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 6806bc1. The verdict and the full list are in the summary comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Live fill at head 03b1dbb293

03b1dbb293 changes only the watch type path: a field tap that was not dispatched now refuses. Run after pnpm build (exit 0), pnpm build:xcuitest:watchos (exit 0), and pnpm clean:daemon (exit 0). Xcode 27.1, watchOS 27.0, on an Apple Watch Series 11 (46mm) simulator I created and then deleted.

Command Exit Key output
open com.apple.MobileSMS --platform ios --udid <watch> --session watch 0 Opened: com.apple.MobileSMS
snapshot -i 1, then 0 The first call on the just-booted simulator hit the daemon request timeout. The retry returned 10 nodes with [button] "Compose".
press @e6 (Compose), press @e10 (Create Message) 0, 0 New Message, then the input field
fill 'role=text-field' "On my way" 0 Filled 9 chars; next snapshot -i shows [cell] "On my way"
close --session watch --shutdown 0 Closed: watch

The back evidence at 6806bc1f63 still applies: back has not changed since.

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

Thanks for the update. At 03b1dbb, the input-sheet handling for unsupported and not-dispatched results and the text-free back pop are fixed. One defect remains in home. The earlier review is at #4752 (comment).

Run home in an open watch app session while the watch face is foreground, for example right after a first home. interactor.ts:162 sends the session app bundle ID, and RunnerTests+Models.swift:341 classifies home as an app mutation with mayLaunch. So RunnerTests+CommandDispatch.swift:577-583 and :623-625 reactivate the background session app before RunnerTests+CommandExecution.swift:567-569 presses the Crown. The watchOS route has no bypass. A second home then presses the Crown from the reactivated app and returns to the face, so it cannot open the app grid from the face as the help and watchOS docs promise. The posted Home output is the daemon's fixed success message and does not show which screen results. Please give watchOS home a no-app launch policy while keeping the XCTest recorded-failure conversion. Then show two consecutive home presses reaching the watch face and then the app grid, with the observed screen after each.

Could RunnerTests+SynthesizedInteraction.swift own the common sampled-gesture dispatch and result mapping for iOS and watchOS, with the watch leaf supplying its coordinate samples and handling the existing screen-edge marker for its coordinate drag?

Of the earlier inline threads, #4752 (comment) and #4752 (comment) are fixed at this head, so please resolve them. #4752 (comment) is withdrawn: XCUIDevice.press(.home) is the only Crown press available on watchOS, and like iOS home it reports dispatch only, so please resolve it too.

The face and app-grid outcomes of home are not in those tables, only exit 0 and Home. The back-pop finding rests on the author's two fixture screens and the Settings screens, so a third-party app with a custom pop gesture now gets a refusal, which the docs state.

The Runner Build (tvOS + visionOS + watchOS) job failed in Restore and build watchOS XCTest runner while downloading actions/cache/restore, before any compile ran. The tvOS and visionOS legs use the same action and passed, and the same job passed at 25a0267. The change touches no workflow file, so this looks like an action-download flake, not the Swift. It also means the watchOS delta has not compiled in CI at this head. Build 0.21.41-nightly was still running. No conflicts.

Please fix home, then rerun Runner Build (tvOS + visionOS + watchOS) and wait for green checks.

…he session app forward

home on watchOS was an app mutation that may launch, so the runner
reactivated the session app before every press and a second home returned to
the face instead of opening the app grid. watchOS home now takes a no-app
launch policy and keeps the recorded-failure conversion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

watchOS home at head f1b279198a

home on watchOS now has a no-app launch policy (watchCrownPress: .noApp, still convertsRecordedFailure: true), so the runner no longer brings the session app forward before pressing the Digital Crown. iOS home keeps .appMutation.

Run after pnpm build (exit 0), pnpm build:xcuitest:watchos (exit 0), and pnpm clean:daemon (exit 0). Xcode 27.1, watchOS 27.0, on an Apple Watch Series 11 (46mm) simulator I created and then deleted.

Command Exit Observed screen
open com.apple.NanoSettings --platform ios --udid <watch> --session watch, snapshot -i 0, 0 Settings, 13 nodes
home 0 Home
screenshot home1.png 0 Watch face
home 0 Home
screenshot home2.png 0 App grid (still zooming in)
close --session watch --shutdown 0 Closed: watch

After the first home: the watch face After the second home: the app grid

The screenshot between the presses did not bring Settings back either. The optional refactor (sampled-gesture dispatch shared by iOS and watchOS) is not taken here: the watch arm differs in surface resolution and edge-contact routing, so I kept it as a separate leaf function.

@thymikee

Copy link
Copy Markdown
Member Author

Thanks for the update. At f1b2791, the home launch policy from the earlier review (#4752 (comment)) is fixed, but the same rule is still broken for action-button.

The rule: on watchOS a hardware press acts on the screen that is in the foreground, and never brings the session app forward first. .actionButton (and .volumeUp/.volumeDown) declare .presentedSurfaceMutation (https://github.com/callstack/agent-device/blob/f1b2791/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift#L347-L348). In the .presentedSurface arm, only #if os(iOS) skips activation. The #else arm calls prepareActivatedTarget, and activateTarget runs whenever the session app is not foreground (https://github.com/callstack/agent-device/blob/f1b2791/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandDispatch.swift#L552). watchOS admits actionButton (https://github.com/callstack/agent-device/blob/f1b2791/packages/platform-apple/src/os/watchos/facts.ts#L43), so after home the press first reactivates the session app and lands on the app, not on the watch face. The comment at that line ("off iOS this route is reached only by the tvOS and visionOS runners") is now wrong, and the action-button help (https://github.com/callstack/agent-device/blob/f1b2791/packages/command-surface/src/system/index.ts#L326) promises "dispatched without activating the session app".

Please make the rule hold in one place: no hardware press activates the session app on watchOS. The smallest change is to add watchOS to the no-activation branch of the .presentedSurface arm. Then home and action-button can share the .presentedSurfaceMutation declaration, and watchCrownPress can go. Please also fix that comment and qualify the "Commands act on the session app and bring it back to the foreground first" line in commands.md to exempt hardware presses.

The refocus is inferred from the activation path; there is no live watchOS action-button run yet. Please run it on an Apple Watch Ultra simulator in an open app session: home, screenshot (the face), action-button, screenshot. The output should show the session app was not brought forward before the press. On a non-Ultra model, please show the hardware_control_unavailable refusal with dispatched: no.

The home evidence is satisfied. The face and app-grid outcomes rest on your table and captions. No unit test pins the watchOS home row, because the model tests run on the iOS host and the watchOS arm only compiles in the watchOS runner build.

Checks so far: Smoke Tests (ios), Smoke Tests (macos), Coverage, Integration Tests and Runner Build (tvOS + visionOS + watchOS) have passed, and the watchOS leg ended in TEST BUILD SUCCEEDED. Build 0.21.41-nightly and one Smoke Tests job are still pending, and none has failed. There are no conflicts.

On the open inline threads: the threads at #4752 (comment) and #4752 (comment) are fixed, so please resolve them. The thread at #4752 (comment) does not apply, because XCUIDevice.press(.home) is the only Crown press available on watchOS, so please resolve it too.

Before merge, route watchOS action-button and home through a no-activation path and show the live Ultra run above.

…face

action-button (and home before it) reactivated the session app on watchOS,
because only iOS skipped activation for presented-surface commands. watchOS
now takes the same no-activation route, so home shares
presentedSurfaceMutation with action-button and watchCrownPress is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

…n refusal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

thymikee commented Nov 19, 2026 •

Copy link
Copy Markdown
Member Author

watchOS hardware presses at head ac8d720d83

485ab86445 adds watchOS to the no-activation branch of the .presentedSurface launch policy. home on watchOS now shares .presentedSurfaceMutation with action-button and the volume keys, and watchCrownPress is removed. The stale "off iOS" comment is corrected, and commands.md now exempts home and action-button from "bring it back to the foreground first". ac8d720d83 gives the watchOS refusal its own hint.

Run after pnpm build (exit 0), pnpm build:xcuitest:watchos (exit 0), and pnpm clean:daemon (exit 0). Xcode 27.1, watchOS 27.0. The simulators were created and then deleted.

Apple Watch Ultra 4 (49mm)

Command Exit Observed
open com.apple.NanoSettings --platform ios --udid <ultra> --session ultra, snapshot -i 0, 0 Settings, 13 nodes
home 0 Home
screenshot 0 Watch face
action-button 0 Pressed Action Button
screenshot 0 The system Action Button sheet: "Choose what you'd like the Action button to do." Settings is not in front.
appstate 0 com.apple.NanoSettings: runningBackgroundSuspended (not brought forward)
close --session ultra --shutdown 0 Closed: ultra

After home: the watch face After action-button: the Action Button sheet over the face

Apple Watch Series 11 (46mm)

Command Exit Key output
open com.apple.NanoSettings --platform ios --udid <series 11> --session series 0 Opened
action-button --json 1 UNSUPPORTED_OPERATION, details.reason: hardware_control_unavailable, dispatched: no, hint The Action Button is on Apple Watch Ultra. Open an Apple Watch Ultra simulator.
close --session series --shutdown 0 Closed: series

At 485ab86445 the same Ultra sequence ran with one more home after action-button: it closed the Action Button sheet and showed the watch face, and appstate still read Settings as runningBackgroundSuspended. The face-then-app-grid pair from two consecutive home presses is the f1b279198a evidence above. Since then home has moved from .noApp to .presentedSurface, which also activates nothing on watchOS, as the appstate rows show.

…navigation bar

A back-button tap that dispatched but did not pop reported success. back now
waits up to 1 s for the navigation bar (its identity or the back button's
presence) to change and otherwise answers back_swipe_unverified, as iOS does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

watchOS back confirmation at head 47676bfe89

Addresses the Apex finding on f1b279198a (r4630958923): after the Back-button tap, back now waits up to 1 s for the navigation bar to change, and otherwise answers back_swipe_unverified (dispatched: unknown), as iOS does. A change means the bar's identity changes, or the back button leaves at the root. Free text is not compared.

Run after pnpm build (exit 0), pnpm build:xcuitest:watchos (exit 0), and pnpm clean:daemon (exit 0). Xcode 27.1, watchOS 27.0, on an Apple Watch Series 11 (46mm) simulator I created and then deleted.

Command Exit Key output
open com.apple.NanoSettings ..., press @e12 (General), press @e7 (About) 0, 0, 0 About: 16 nodes, [button] "Back"
back 0 Back; next snapshot is General (14 nodes, Back button still shown, bar title changed)
back 0 Back; next snapshot is the Settings root (13 nodes)
back --json on the root 1 This screen has no navigation back button., back_swipe_not_dispatched, dispatched: no
close --session watch --shutdown 0 Closed: watch

The Ultra home and action-button evidence at ac8d720d83 still applies: those paths have not changed since.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 47676bf

Since the review of f1b2791: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

Reviewed with this repository's own Sentinel configuration (eeff795f47df).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

…d fold the watch polls

The iOS and watchOS sampled gesture paths now hand their pointer samples to
one dispatchSynthesizedPointerSamples helper, and the watch's three polling
loops (input sheet open, sheet closed, back confirmation) share one helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Simplification at head 4ae2e5663c

  • The iOS and watchOS sampled gesture paths now share one dispatchSynthesizedPointerSamples helper in RunnerTests+SynthesizedInteraction.swift. The watch arm keeps only what differs: it builds samples from plan points (no rotation, and the app fills the screen), and it starts screen-edge contacts on the edge.
  • The watch's three polling loops (input sheet open, input sheet closed, back confirmation) share one helper.
  • Behavior is unchanged. pnpm build:xcuitest:watchos and pnpm build:xcuitest:ios both pass.

Live sanity run at 4ae2e5663c (Series 11 46mm, watchOS 27.0, branch CLI after pnpm build and pnpm clean:daemon): all 14 commands exited 0. gesture pan scrolled General (14 → 16 nodes), gesture swipe right-edge returned to the Settings root, back popped Smart Stack, and fill 'role=text-field' "On my way" committed (Filled 9 chars, and the next snapshot shows the text).

Left as is: the watch back, text entry, and crown scroll stay in the watch leaf. Their iOS counterparts are built on the iOS-only synthesized coordinate context and digitizer geometry, which watchOS does not have.

@thymikee

thymikee commented Nov 19, 2026 •

Copy link
Copy Markdown
Member Author

This PR is ready. The back confirmation from the earlier review (#4752 (comment)) is fixed at 47676bf: a watch back now reports success only when the navigation bar changed, and otherwise answers back_swipe_unverified.

Not blocking, and you can take or leave it: watchNavigationBarIdentity includes each bar's label (RunnerTests+WatchInteraction.swift:96), which on watchOS is the title text, while the comment at :89-91 says free text is left out. On a screen whose title updates by itself, a tap that does not pop would still read as a pop. Either reword the comment to say titles are compared, or compare only the bar count, the bar identifiers and the back button.

The earlier inline thread on back success (#4752 (comment)) no longer applies and can be resolved, because the confirmation now checks for a navigation bar change.

CI is green: 36 checks, none failing, including the Runner Build leg that compiles the watchOS Swift. There are no conflicts. Nothing else needs to happen before merge.

For the record, no unit test pins the watchOS trait rows or performWatchBack, so that behavior rests on the code and your live runs. The home and action-button run was taken at an earlier head; the press and launch-policy paths have not changed since. A same-title push/pop pair, which would answer unverified, was not exercised.

Update: 4ae2e56 landed while this was being posted. It refactors the shared synthesized-sample dispatch for iOS and watchOS, so I removed ready-for-human until that delta is reviewed.

@thymikee thymikee added ready-for-human Valid work that needs human implementation, judgment, or maintainer merge and removed ready-for-human Valid work that needs human implementation, judgment, or maintainer merge labels Nov 19, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Ready again at 4ae2e56. The refactor only moves the shared synthesized-sample dispatch into one helper: the iOS path still runs the native planned gesture, returns its refusals, and passes the same app, resolved window, orientation and samples into the helper, which makes the same XCTest call with the same dispatch flag, outcome mapping and refusal hint. The helper has exactly two callers, the iOS branch and the watch leaf, and the watch poll folding keeps the navigation-bar back confirmation. CI is green, including the watchOS runner build. The label is back on.

The non-blocking note from the 47676bf review still applies: watchNavigationBarIdentity compares the bar title, so either say so in the comment or compare only bar count, identifiers and the back button.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 19, 2026
@thymikee
thymikee merged commit 0ba31d8 into main Nov 19, 2026
35 of 36 checks passed
@thymikee
thymikee deleted the t3/watchos-simulators branch November 19, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(apple): support watchOS simulators through the XCUITest runner

1 participant