Repository navigation
fix(mobile): fail an open of an app the device does not have as TEST_SETUP_FAILED - #2286
karolkulesza wants to merge 26 commits into
Conversation
…SETUP_FAILED agent-device reports an iOS simulator launch of a missing bundle as COMMAND_FAILED with only a hint saying why, so the engine surfaced it as ENGINE_FAILURE (exit 3) with agent-device CLI advice, and the open_app tool's INVALID_ARGUMENT repair never matched on iOS. Fixes e2e-inc#2281
…nt restart and clearState
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
|
Correction on the |
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 5 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Reviewed at 6651c12 (main 1642ef2). Issue #2281 is real: agent-device 0.21.42 (and 0.21.43, latest) runs its install check after a failed simctl launch and computes APP_NOT_INSTALLED internally (app-launch.js), then rethrows the original COMMAND_FAILED with only details.hint set. Android (pm path check) and iOS physical devices (devicectl) already throw APP_NOT_INSTALLED. TEST_SETUP_FAILED (configuration, exit 2, blocked: test_setup) is the right code; core has no app-not-installed code, and INVALID_CONFIG would be wrong since the bundle id can be correct and only the install is missing.
Must fix
packages/mobile/src/errors.ts:358-366- the iOS branch classifies byhint.startsWith('The app bundle is not installed on this simulator.'). The project fixes root causes, not text matches: every other classification in this file keys oncodeordetails.reason. Any rewording of that hint upstream silently sends iOS back to ENGINE_FAILURE, and no test here would notice, because the fixtures copy the same string. agent-device already has the classification in hand at the throw site. Suggested fix: send a small agent-device PR that throwsAPP_NOT_INSTALLED(or setsdetails.reason) when its post-launch check finds the bundle missing, bump the pin once it ships, and dropIOS_NOT_INSTALLED_HINT. Until then this PR can land with only theAPP_NOT_INSTALLEDpath: that already covers Android, iOS devices, and clearState/setPermission on iOS simulators, which resolve the app before acting.
Should fix
surface.ts:968(setPermission) andsurface.ts:1939(clearState) wraps are untested: reverting either tothrow errorkeeps the mobile unit suite green. Add a case for each withAPP_NOT_INSTALLEDfromsettings.update.errors.ts:1-27- the translation table at the top of the file is the file's map of codes. Add a row for "APP_NOT_INSTALLEDon an open, clear-state, or app-targeted permission -> TEST_SETUP_FAILED".
Nits
docs/mobile.mdx:878- the reflowed line runs past the paragraph's wrap width.
Verified: mobile unit tests for errors/tools/engine pass (the one failure is the manifest test needing a built e2e dist, and it fails the same way on main). Mutants: disabling the hint branch fails 3 tests (good); dropping the clearState or setPermission wrap fails none. Read agent-device 0.21.38 and 0.21.43 dist for the iOS simulator and Android throw sites. CI is green at this head. No simulator run (shared machine); the throw path is confirmed from agent-device's source.
|
Addressed in 7827e7c:
Mobile unit tests, typecheck and lint pass, apart from |
There was a problem hiding this comment.
0 issues found across 6 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
|
@okwasniewski the requested changes are in, ready for another look when you have time. |
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 2d4ee70 (code at 7827e7c). The hint match is gone, notInstalledCause (errors.ts:354) checks only APP_NOT_INSTALLED, the setPermission and clearState wraps are tested (each of the 4 wraps reverted fails 1 to 2 tests), and the table row is in. Thanks. All cubic threads are addressed.
The catch: with the hint match dropped, this no longer fixes the #2281 repro. In agent-device 0.21.42 (pinned) and 0.21.43, a dotted bundle id skips the install check in the app resolver and goes straight to simctl launch. When the launch fails, app-launch works out APP_NOT_INSTALLED but only sets it as details.hint and rethrows the original COMMAND_FAILED. So app.open() with bundleId: 'dev.e2e.missing' on an iOS simulator is still ENGINE_FAILURE. The changeset and docs/mobile.mdx say so honestly. The PR body and reference docs don't.
Must fix
- PR body: change
Fixes #2281toRefs #2281, and update How and Verified. They still describe the hint match (errors.ts:358) and show the iOS simulator going toTEST_SETUP_FAILED. - Reference docs claim the simulator case:
docs/reference/mobile.mdx:321(the target'sapp.bundleId),docs/reference/errors.mdx:101, and theopen_appparagraph neardocs/reference/mobile.mdx:1250. Scope them to Android, iOS devices, and display names, or add the same simulator caveat as the changeset.
Should fix
docs/mobile.mdx:882quotes agent-device's hint text to users. That can change upstream. Say it fails asENGINE_FAILUREuntil agent-device reports it.- Root cause is upstream: agent-device
app-launchshould throwAPP_NOT_INSTALLEDwhen it detects it, not only set the hint. This PR then picks it up after a pin bump with no further change. You offered to raise it upstream, which would be great.
Nits
errors.ts:369:isAppNotInstalledcould be a type guard and drop the(error as Error)cast. The operation labels read awkwardly ("permission camera grant for Settings failed").- The 4 near-identical
.catch(...)wraps insurface.tscould share one helper. engine.test.ts:3392checks 5 operations in oneit;it.eachwould show every failure.docs/mobile.mdx:877-883lines run 77 to 82 chars; the paragraph wraps near 73.tools.test.tsgains a trailing blank line.
Verified: mobile typecheck clean, unit tests 652/652, CI green. iOS simulator behavior comes from reading agent-device 0.21.42/0.21.43 dist, not a live run.
Maintainer question: land this as a partial fix (Android, iOS devices, display names, clearState, setPermission) under Refs #2281, or hold it for the agent-device change.
|
Pushed 4dadd88 (also merges main, which conflicted in
On the question: I'd land this as the partial fix under |
|
@okwasniewski the requested changes are in, ready for another look when you have time. |
|
Android deterministic failed every test, smoke included, with no change to the open path on success (the wraps only rethrow). Same job passed on other PRs at the same time, so I read it as an emulator flake and pushed an empty commit to rerun it, since I can't rerun jobs. |
okwasniewski
left a comment
There was a problem hiding this comment.
Automated review (AI triage pass), not yet read by a maintainer.
Reviewed cbbedcd47. Re-check after 4dadd88: the PR body now says Refs #2281 and describes the code-only match, isAppNotInstalled is a type guard, and the app.open(), device.openApp() and errors reference rows carry the iOS simulator caveat. Code is unchanged since the last pass apart from the type guard. Two reference rows still claim the simulator case.
Must fix
- docs/reference/mobile.mdx:1376 - the
open_appparagraph flagged last round now saysTEST_SETUP_FAILED"when it names no app and the app under test is not installed", with no simulator caveat. On an iOS simulator with a dottedapp.bundleId(the usual case), agent-device 0.21.43app-launchonly setsdetails.hintand rethrowsCOMMAND_FAILED, so this isENGINE_FAILURE. Add the same caveat as line 321. - docs/reference/mobile.mdx:941 - the new
openLinkrow says "The app the link opens into is not on the device" with no scope. On an iOS simulator, agent-device 0.21.43 sends a custom-scheme link with an app straight tosimctl openurland never checks the install, so this throwsCOMMAND_FAILEDand becomesENGINE_FAILURE. A web link with launch args, or a relaunch, goes through the same hint-only launch path. Scope this row to Android and iOS devices.
Should fix
- The squash merge would close #2281 even though the simulator repro is not fixed. The repo squashes with
COMMIT_MESSAGES, and commit 89d5951 still saysFixes #2281. Whoever merges must edit the squash message (an author force-push would also clear it).
Nits
- docs/reference/mobile.mdx:1377 is 91 chars wide. The paragraph wraps near 73.
packages/mobile/tests/unit/tools.test.tsstill ends with an extra blank line.
CI: all checks are green at 957ce3c, mobile included. The Android failure at a07d5a6 happened during emulator setup (Unable to connect to adb daemon), so it was not caused by this PR, and the empty-commit rerun passed. At cbbedcd (a main merge) the iOS and Android deterministic jobs are still running. Everything else has passed.
Verified: read the PR diff against merge-base c289aff and agent-device 0.21.43 dist/src/app-launch.js (now the pinned version), which has the same hint-only simulator launch path and an openurl path with no install check. No live device run.
For the maintainer
- Land this as a partial fix under
Refs #2281(Android, iOS devices, display names, clearState, app-targeted setPermission), or wait for agent-device to throwAPP_NOT_INSTALLEDfrom its simulator launch. That fix is upstream: nobody has opened it yet. When it ships, this PR covers the simulator after a pin bump with no code change.
|
Pushed fca1410: both reference rows now carry the iOS simulator caveat ( The |
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
Automated review (AI triage pass), not yet read by a maintainer.
Reviewed 79b74e50c. Both must-fixes from the last pass are fixed. The docs now match what the code and agent-device 0.21.43 do. Since cbbedcd the only changes are docs and the removal of a trailing blank line.
Fixed since last review
- docs/reference/mobile.mdx:1377 - the
open_appparagraph now says a dotted bundle id on an iOS simulator isENGINE_FAILURE, likeapp.open(). It is wrapped near 73 columns. - docs/reference/mobile.mdx:941 - the
openLinkrow is limited to Android and iOS devices and names the simulator exception. This matches agent-device 0.21.43app-launch.js. On a simulator, a URL open with an app resolves the app without an install check for a dotted id, then callssimctl openurl, which fails as plainCOMMAND_FAILED. - The PR body says
Refs #2281, and How/Verified describe the code-onlyAPP_NOT_INSTALLEDmatch.tools.test.tsno longer has the trailing blank line.
The errors reference row (errors.mdx:101), the app.open() row (line 321), the changeset, and docs/mobile.mdx all carry the same caveat.
For the maintainer
- When you squash-merge, edit the message. The repo squashes with
COMMIT_MESSAGES, and commit 89d5951 still hasFixes #2281plus a body that describes the old hint match. Left as is, the merge closes #2281 even though the iOS simulator repro is not fixed. The author did not force-push and asked the merger to change it toRefs #2281. - This is a partial fix: Android, iOS devices, display names, clearState, and app-targeted setPermission. The simulator case needs agent-device's
app-launchto throwAPP_NOT_INSTALLEDinstead of only settingdetails.hint. Once it does, a pin bump fixes the simulator with no code change here. Nobody has opened that upstream issue yet.
CI: everything passes except test (26, runner) and spec gate. The failing test is test-step.test.ts > cuts the call running in a step as the timeout cuts any call... (expected 'failed' to be 'timed-out'), which also fails on main. This PR did not cause it.
Superseded by the automated re-review at the new head.
kdy1
left a comment
There was a problem hiding this comment.
Note
This text was drafted with AI and posted after human approval.
- Harness: T3 Code
- AI agents: coordinator: Claude Opus 5.5 (claude-opus-5-5), reviewer: GPT-6.2 Astra (gpt-6.2-astra), reviewer: GPT-6.2 Sol (gpt-6.2-sol), reviewer: Claude Opus 5.5 (claude-opus-5-5), reviewer: Claude Sonnet 5.5 (claude-sonnet-5-5)
Verdict: Request changes
This review requests changes. Fix the P2 items before merge. The P3 items are optional and do not block the merge.
The code maps APP_NOT_INSTALLED correctly on all four wrapped paths. The new tests fail on the base source and pass at this head. The blocking problem is scope: three reference entries, and the What section of the PR body ("iOS devices"), promise TEST_SETUP_FAILED for cases where agent-device 0.21.43 does not throw APP_NOT_INSTALLED, or keep ENGINE_FAILURE for cases that now give TEST_SETUP_FAILED. The CI failure (packages/e2e/tests/integration/test-step.test.ts, a timing test) is in code that this PR does not touch.
Reviewed commit: 79b74e50c719a37f73c0cb8dc3359b04d74104ae
- P2 (fix before merge): 3 (3 inline)
- P3 (non-blocking): 3 (3 inline)
Docs previewThe site runs each docs page as code, so a fork's pull request is previewed only after a maintainer reads it. To preview 426fb01, comment |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
okwasniewski
left a comment
There was a problem hiding this comment.
Automated review (AI triage pass), not yet read by a maintainer.
Reviewed 854b437e9. Re-review of 0a6684de8 (the rest are main merges). It is a docs, changeset and message change that answers kdy1's review. All six points are addressed.
kdy1's findings on this head:
- P2
openApprow (a missing dotted bundle id on a physical iPhone is notAPP_NOT_INSTALLED): fixed at mobile.mdx:792. The row covers only an Android package or display name, and the PR body no longer claims iOS devices. - P2
openLinkrow (an Android link bound to a missing package isCOMMAND_FAILED): fixed at mobile.mdx:822. - P2 errors row (the simulator parenthetical wrongly covered
clearStateandsetPermission): fixed at errors.mdx:112. It names only the two realENGINE_FAILUREexceptions. - P3 install advice: the message now says "Install it on the device first (for the target's own build, device.installApp())" (errors.ts:383). The test regex follows.
- P3 changeset: it names
device.setPermission()and the remainingENGINE_FAILUREcases. - P3
isAppNotInstalledcomment: fixed at errors.ts:367.
kdy1 checked these against agent-device 0.21.43. Since then, main has moved the pin to 0.21.44. I compared the files these paths go through: app-launch, app-lifecycle, app-deployment-resolution, app-resolution, devicectl and physical-device-control are byte-identical. settings.js was refactored but still rethrows APP_NOT_INSTALLED. So the docs still hold at the current pin.
CI
test (22, runner)fails on the testbedexploretests, a known main flake.android deterministicfails on emulator readiness (adberrors at boot), as the main merge queue's mobile run also did today.spec gateandmobile gateonly report those. None of them is caused by this PR.
For the maintainer (unchanged)
- When you squash-merge, edit the message. Commit
89d5951467still saysFixes #2281, while the PR body saysRefs #2281. Left as is, the merge closes #2281, but the iOS simulator repro is not fixed. - This is a partial fix. The simulator case needs agent-device's
app-launchto throwAPP_NOT_INSTALLEDinstead of only settingdetails.hint. Nobody has opened that upstream issue yet.
michal-e2e
left a comment
There was a problem hiding this comment.
Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.
Reviewed 854b437e9 by source inspection.
Must fix
| Where | Issue | Fix |
|---|---|---|
docs/reference/mobile.mdx:822 |
States that a link bound to a missing dotted iOS bundle ID yields ENGINE_FAILURE. On iOS simulator, pinned agent-device 0.21.44 can route a custom URL scheme through OS openurl without launching the named bundle, so another app can still open it; the HTTP(S) path attempts the named bundle launch first. |
Scope the row to actual launch failures and note that custom URL schemes are routed by the OS. |
Optional
docs/reference/mobile.mdx:280: Promises a device name, but on a default cold start the binding is empty and the formatted error names only app and session even though boot returns device identity; use the actual booted device or qualify the documentation.packages/mobile/tests/unit/engine.test.ts:3485: The fake has no prior CLI hint, so the negative assertion can pass without exercising hint removal; setdetails.hintto'Run install before open.'.
The maintainer can decide whether to land the partial fix once the docs are corrected.
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
…hed as the named app
okwasniewski
left a comment
There was a problem hiding this comment.
Automated review (AI triage pass), not yet read by a maintainer.
Reviewed 49f1bc6a0. Since 854b437e9 there are two docs commits (3b2bf4b58, 195f9e1c2) and a main merge. Both commits rewrite the openLink TEST_SETUP_FAILED row for michal-e2e's must-fix and cubic's follow-up. The main merge leaves the PR's own diff unchanged.
Earlier findings
- michal-e2e must-fix (mobile.mdx:822): fixed for simulators. I checked it against agent-device 0.21.45 (main's pin,
dist/src/app-launch.js). On a simulator, an http(s) link resolves the app and launches it beforeopenurl. A custom scheme goes straight tosimctl openurl, with no app lookup and no launch, so a missing app is never reported. The row now says that. - cubic's "launches nothing" wording: fixed in
195f9e1c2.
Nits
- mobile.mdx:822 - "a web link on iOS" and "a custom scheme on iOS is handed to the OS" are true only on a simulator. On a physical iPhone, agent-device resolves the app for every link, custom schemes included (
appBundleId ?? resolve(app)), and launches it with the URL as its payload. So a missing display name there isTEST_SETUP_FAILEDfor any scheme. Say "on an iOS simulator" in both places.
- michal-e2e's two optional points (the device name at mobile.mdx:280, and the fake without a prior
details.hint) are still open. Neither blocks.
CI
ios deterministicfails, andmobile gatefails because of it. The traces show a system alert, "Open in “e2e Benchmark”?", left on screen after theopenLinktest indevice-fixture.e2e.ts. It hides the home list from every later test, and from the--last-failedrerun too. This PR changes only the failure path ofopenLink(.catch→appNotInstalled, which rethrows any other error unchanged). A successful open goes through the same code as on main, so this is the known iOS benchmark flake. The same job passed today on #2569 and #2410 at the same main. Rerun it.
For the maintainer (unchanged)
- When you squash-merge, edit the message: commit
89d5951467still saysFixes #2281, but the simulator repro is not fixed here. - This is a partial fix. The simulator
opencase needs agent-device'sapp-launchto throwAPP_NOT_INSTALLEDinstead of only settingdetails.hint. No upstream issue has been opened yet.
What
TEST_SETUP_FAILED(exit 2) when agent-device reportsAPP_NOT_INSTALLED. That covers Android launches, iOS display names, an iOS simulator'sapp.clearState(), and an app-targeteddevice.setPermission(), plusapp.open(),app.restart(),device.openApp()anddevice.openLink()into that app.device.installApp()for the target's own build) or check the bundle id.ENGINE_FAILURE: a launch of a missing dotted iOS bundle id (simulator or physical device) and an AndroidopenLinkbound to a missing package. agent-device starts these without an install check. A custom-schemeopenLinkon iOS is handed to the OS rather than launched as the named app; the OS routes the URL to whichever app handles the scheme, so it never reports a missing app.Why
Run install before open) points at its own CLI.simctl launch. When that fails it works outAPP_NOT_INSTALLEDbut only setsdetails.hintand rethrowsCOMMAND_FAILED. I dropped the hint text match, since every other classification inerrors.tskeys on a code. The simulator case needs agent-device to throwAPP_NOT_INSTALLED; after a pin bump this PR picks it up unchanged.How it works
notInstalledCause(packages/mobile/src/errors.ts) acceptsAPP_NOT_INSTALLEDonly.appNotInstalledturns that failure into aConfigurationError('TEST_SETUP_FAILED')and keeps the agent-device error ascause.open(),openLink()into a named app,setPermissionandclearStatepass their failures through it.open_appstill readsisAppNotInstalled, so a wrongappreturnsINVALID_ARGUMENTto the model.Issue
Refs #2281
Verified
pnpm --filter @e2e-dev/mobiletypecheck and the engine, tools and errors unit tests pass at 0a6684d.docs:check-errorspasses.APP_NOT_INSTALLED; reverting one fails it.opengoing toTEST_SETUP_FAILEDthrough the hint match, which is gone now. TheAPP_NOT_INSTALLEDpath comes from unit tests and agent-device's source.Checklist
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it..d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures.e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.Summary by CodeRabbit
Bug Fixes
TEST_SETUP_FAILEDwith the app name and installation guidance when the target app isn’t installed. This applies to opening apps, changing app permissions, opening links for a known app, and clearing app state.ENGINE_FAILURE.Documentation