Skip to content

fix: stabilize Maestro post-gesture snapshots#681

Open
thymikee wants to merge 12 commits into
mainfrom
codex/maestro-android-post-action-settle
Open

fix: stabilize Maestro post-gesture snapshots#681
thymikee wants to merge 12 commits into
mainfrom
codex/maestro-android-post-action-settle

Conversation

@thymikee
Copy link
Copy Markdown
Member

@thymikee thymikee commented Jun 3, 2026

Summary

Stabilize Maestro replay snapshots after mutating gestures and harden iOS runner lifecycle behavior seen in external QA.

  • Reuse the existing post-gesture snapshot stabilization path for Maestro tap/click and percentage swipe commands.
  • Let native gesture swipe ... commands participate in the same stabilization so Maestro directional swipes do not sample mid-transition.
  • Route Android gesture swipe through the same provider-native touch injection / bundled touch-helper path as pinch, rotate, and transform, with adb input swipe as a fallback.
  • Strip the new internal flag from recorded/public replay actions alongside the existing interaction retry flag.
  • Keep Android optimized/interactive tap snapshots fast while preserving a recent comparison-safe baseline for freshness checks.
  • Stop the iOS XCTest runner host app after sessionless runner-backed commands, so AgentDeviceRunner is not left foregrounded.
  • Reject iOS snapshot/diff when no target app is tracked, returning an open-first error instead of exposing the runner app tree.
  • Move gesture swipe left|right in-page presets to the mid-content lane. The old lower lane could land in blank pager space on Android material top tabs, causing swipes to report success while the page stayed put.
  • Update command help and Android helper errors to describe this as general Android touch-helper behavior rather than Maestro-specific behavior.

Validation

  • pnpm exec vitest run src/platforms/android/__tests__/multitouch-helper.test.ts
  • pnpm exec vitest run src/platforms/android/__tests__/multitouch-helper.test.ts src/core/__tests__/dispatch-interactions.test.ts src/__tests__/runtime-interactions.test.ts src/compat/maestro/__tests__/runtime-interactions.test.ts
  • pnpm test
  • pnpm check:quick
  • pnpm exec vitest run src/compat/maestro/__tests__/runtime-interactions.test.ts src/compat/maestro/__tests__/runtime-targets.test.ts src/__tests__/runtime-interactions.test.ts src/core/__tests__/dispatch-interactions.test.ts
  • pnpm exec vitest run src/platforms/ios/__tests__/open-ios.test.ts src/platforms/ios/__tests__/session-open.test.ts src/platforms/ios/__tests__/runner-client.test.ts src/daemon/__tests__/client-timeout.test.ts src/commands/__tests__/snapshot-command.test.ts src/compat/maestro/__tests__/runtime-interactions.test.ts
  • pnpm check:fallow
  • pnpm build
  • npm pack --pack-destination /private/tmp/agent-device-pack
  • React Navigation local subset with packed build on iOS: bottom-tabs.yml, material-top-tabs.yml, image-crop.yml
  • React Navigation local subset with packed build on Android: bottom-tabs.yml, material-top-tabs.yml, image-crop.yml
  • React Navigation CI with packed build: maestro-ios, maestro-android

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

Size Report

Metric Base Current Diff
JS raw 1.1 MB 1.1 MB +3.9 kB
JS gzip 367.5 kB 368.5 kB +1.1 kB
npm tarball 473.5 kB 474.5 kB +1.0 kB
npm unpacked 1.6 MB 1.6 MB +4.2 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.0 ms 26.9 ms -0.0 ms
CLI --help 42.2 ms 42.6 ms +0.5 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/2415.js +1.5 kB +290 B
dist/src/session.js +1.2 kB +283 B
dist/src/selector-runtime.js +431 B +155 B
dist/src/snapshot.js +276 B +153 B
dist/src/android.js +533 B +148 B

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4392fb09f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

): boolean {
if (flags?.postGestureStabilization === true) return true;
if (action === 'swipe' || action === 'scroll') return true;
return action === 'gesture' && positionals[0] === 'swipe';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Mark rewritten gesture swipes for stabilization

When a Maestro directional swipe (or a direct CLI replay) invokes gesture swipe left, request-generic-dispatch.ts rewrites it to platformCommand === 'swipe-preset' and strips the swipe subcommand before calling markPostGestureStabilization, so this new action === 'gesture' branch is not reached in the real dispatcher path. Because the Maestro directional path intentionally leaves postGestureStabilization unset, those swipes still skip stabilization and can capture the first post-swipe snapshot mid-transition.

Useful? React with 👍 / 👎.

],
flags: {
...params.baseReq.flags,
postGestureStabilization: true,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Strip internal stabilization flag before recording generic swipes

When Maestro percentage swipes add this internal flag and invoke the generic swipe command, request-generic-dispatch.ts records recordedFlags from req.flags unchanged, unlike the touch-interaction path that calls stripInternalInteractionOutcomeFlags. This means recorded/replayed public actions for these swipes persist postGestureStabilization: true, exposing an internal daemon control that the commit otherwise tries to strip from replay actions.

Useful? React with 👍 / 👎.

@thymikee thymikee force-pushed the codex/maestro-android-post-action-settle branch 6 times, most recently from 306a1f7 to 5719192 Compare June 3, 2026 16:38
@thymikee thymikee force-pushed the codex/maestro-android-post-action-settle branch from 5719192 to 90be4d3 Compare June 3, 2026 16:57
@thymikee thymikee force-pushed the codex/maestro-android-post-action-settle branch from aa9221d to 2808792 Compare June 4, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant