Repository navigation
iOS agent-device press accepts stale ref after navigation (12-stale-validate-back) #1239
Description
Description
While running negative-scenario QA on iOS simulator via agent-device, pressing a saved element ref from a previous screen succeeds after navigation even though that element no longer exists on the current surface. The same flow on Android correctly rejects the stale ref.
This is scenario 12-stale-validate-back from the Agent-Device Negative Scenarios sign-in suite.
What was observed:
- iOS (FAIL): After saving Verify ref
@e13on the magic-code screen, going Back to Home, and pressing@e13without a fresh snapshot, agent-device reports a successful tap (Tapped @e13 (201, 804)) and exits 0 (STALE_EXIT: 0). - Android (PASS / expected behavior): Same stale press returns
Error (COMMAND_FAILED): Ref @e50 not found or has no boundsand exits 1 (STALE_EXIT: 1). - Cross-platform parity gap: iOS does not reject a ref that is invalid for the current UI tree after screen change.
- Full iOS report: https://app.notion.com/p/callstack/Agent-Device-Negative-Scenarios-iOS-full-report-3985d027c0f881869cdaf60bb00f6ae0
- Android baseline report: https://app.notion.com/p/callstack/Agent-Device-Negative-Scenarios-full-report-3985d027c0f8812a8551eaa94f2bb580
Expected vs. actual behavior
| Expected | After navigation away from the magic-code screen, press @e13 (saved Verify ref) should fail because Verify is not on Home — same as Android: COMMAND_FAILED: Ref @e13 not found or has no bounds, non-zero exit. |
|---|---|
| Actual | iOS accepts the stale ref and performs a tap at cached coordinates (Tapped @e13 (201, 804)), exit code 0. Automation may continue as if Verify was pressed on Home, producing false-positive tool behavior and hiding stale-ref bugs. |
Repro steps
prompt:
Fresh install. Sign in with a new random Gmail until Home. Open **Validate your account** to reach the magic-code screen.
On that screen, note the **Verify** button ref (e.g. `@e13`). Go **Back** to Home.
Without re-checking the screen, press the saved Verify ref again.
Expect fail: Verify does not exist on Home — tool should reject the stale ref.
minimal commands (iOS):
# After reaching magic-code screen and snapshot -i
VERIFY_REF=@e13 # from snapshot: @e13 [button] "Verify"
agent-device press label="Back" --session <session>
agent-device press @e13 --session <session> # stale press on Home
echo $? # observed: 0 (should be 1)key log excerpt (iOS, 2026-07-10):
VERIFY_REF=@e13
Tapped (28, 98) # Back
Tapped @e13 (201, 804) # stale press on Home
STALE_EXIT: 0
RESULT: FAIL
key log excerpt (Android, baseline):
VERIFY_REF=@e50
Error (COMMAND_FAILED): Ref @e50 not found or has no bounds
STALE_EXIT: 1
Environment:
| Field | Value |
|---|---|
| Device | iPhone 16 Pro simulator (UDID 4700A4D2-8FB1-4089-94B0-C2A838E965B1) |
| OS | iOS 18.0 (simulator) |
| App | com.expensify.chat.dev — New Expensify Dev standalone |
| App path | ~/App/ios/build/Build/Products/DebugDevelopment-iphonesimulator/New Expensify Dev.app |
| agent-device | 0.18.3 |
| Android comparison device | Google Pixel 7 (physical), Android 16, org.me.mobiexpensifyg.adhoc |
| Scenario | 12-stale-validate-back |
| Diagnostics (iOS) | mreqf3bf-6dbc7191 (session ios-stale-12-122511) |
Severity / impact
Severity: Medium
Impact: Stale-ref presses that should fail are treated as successful on iOS. Agents and automation can tap wrong coordinates on a new screen without an error, undermining negative-test reliability and cross-platform parity. False passes can mask navigation/ref-management bugs in AI-driven mobile testing flows.
Activity
feat(daemon): wire pre-side-effect frame expiration at the seams (ADR…
feat(daemon): wire pre-side-effect frame expiration at the seams (ADR…
feat(daemon): ADR 0014 session ref-frame lifetime — full implementati…