Skip to content

fix: improve android snapshot freshness#430

Merged
thymikee merged 3 commits intomainfrom
codex/android-stale-snapshot-recovery
Apr 20, 2026
Merged

fix: improve android snapshot freshness#430
thymikee merged 3 commits intomainfrom
codex/android-stale-snapshot-recovery

Conversation

@thymikee
Copy link
Copy Markdown
Contributor

@thymikee thymikee commented Apr 18, 2026

Summary

Improve Android stale snapshot recovery and bounded UIAutomator failures.

  • Retry suspicious post-navigation Android snapshots until a short freshness deadline, and refresh Android @ref interactions while freshness tracking is active.
  • Keep internal Android @ref refreshes best-effort, preserve comparable freshness baselines after refreshed @ref actions, and avoid treating narrow interactive trees as stale sharp drops.
  • Add settings animations off|on for Android global animation scales.
  • Bound Android UI hierarchy dumps with a targeted timeout hint for looping animation cases.
  • Update docs and agent-device skill guidance for Android stale snapshots and animation-heavy runs.

Touched files: 20. Scope stayed within Android snapshot/settings freshness plus docs/tests.

Validation

  • pnpm format
  • pnpm check:quick
  • pnpm exec vitest run src/daemon/handlers/__tests__/interaction.test.ts
  • pnpm exec vitest run src/daemon/handlers/__tests__/snapshot-handler.test.ts src/daemon/handlers/__tests__/interaction.test.ts src/platforms/android/__tests__/snapshot.test.ts
  • pnpm check:unit
  • pnpm build
  • Manual RNCLI83 Android check on /Users/thymikee/Developer/RNCLI83 with temporary ReactNative.Animated.loop: settings animations off applied successfully, screenshot succeeded, and snapshot -i failed after the bounded 8s UIAutomator timeout with the new targeted hint. Temporary app changes were removed and settings animations on was restored.

@thymikee thymikee force-pushed the codex/android-stale-snapshot-recovery branch from 1efc3d0 to 328a63b Compare April 18, 2026 18:26
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 18, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-430/

Built to branch gh-pages at 2026-04-20 08:56 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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: 1efc3d0b1f

ℹ️ 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".

session: SessionState,
): Promise<void> {
if (!getActiveAndroidSnapshotFreshness(session)) return;
await params.captureSnapshotForSession(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fall back to cached ref when freshness refresh fails

When Android freshness tracking is active, press/fill @ref now blocks on a pre-action snapshot refresh. That refresh can fail (for example, UIAutomator timeout or transient adb issues), and the exception aborts the interaction before the existing @ref target is attempted. This turns a freshness optimization into a hard failure path for otherwise valid interactions during unstable Android transitions.

Useful? React with 👍 / 👎.

params.req.flags,
params.sessionStore,
params.contextFromFlags,
{ interactiveOnly: 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 Preserve comparable baseline after freshness ref refresh

This refresh uses interactiveOnly: true, which stores a compact snapshot in session.snapshot; after the action, freshness is re-marked from that stored snapshot. Compact/interactive snapshots are not route-comparable, so subsequent Android freshness checks lose stuck-route detection and retries. In quick @ref sequences (the exact case this change targets), stale-route recovery becomes weaker than before.

Useful? React with 👍 / 👎.

@thymikee thymikee merged commit bb24567 into main Apr 20, 2026
15 checks passed
@thymikee thymikee deleted the codex/android-stale-snapshot-recovery branch April 20, 2026 09:03
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