Repository navigation
Add agent-device-evidence skill for capturing PR/issue mobile evidence - #89475
Conversation
Records iOS Simulator and Android Emulator flows via agent-device, saves MP4 captures locally, and reports file paths for paste into the PR Screenshots/Videos section. Composes preamble macros to set up app state and records only the test flow itself.
Julesssss
left a comment
There was a problem hiding this comment.
I wonder if we'd see better results if we focused on one specific mode for now? I think Mode A would be fine to start with. I'd love to get that working really well and then extending to GitHub Issues to run tests.
Drag and drop each file into the PR's Screenshots/Videos section on GitHub - it auto-uploads and generates the embed URL
Huh, wow that works? I think in the long term we'd prefer to upload to S3 as we currently do for playwright screenshots and Melvin can then do capture and PR creation at the same time. I think for now this is a good place to start testing though
- Drop free-form mode; single PR-driven entry point - Non-interactive end-to-end (target: CI / Melvin) - Parse #### Test case N: h4 headers as flow boundaries - One MP4 (or PNG for verify-only) per flow per platform - JSON manifest with per-flow status, params, warnings - Two-phase architecture: warm-up + deterministic replay - Stills as free side-effect of Phase 1 snapshots - Persistent cache at ~/.cache/agent-device-pr-media/ - Structured exit codes (SKIP, NO_FLOWS, PLATFORM_UNSUPPORTED, NO_BUILD) - Delegate device lifecycle to agent-device parent skill's bring-up - HybridApp-only (drop standalone fallback; inherit parent's gate) - LLM drives setup autonomously, no macro registry / @provides graph
Drop the strict `^####\s` h4-header split rule. Sample of 9 recent merged PRs shows 0/9 use that convention - it's a minority pattern (e.g. PR Expensify#89743), not a default. The only structural anchor authors reliably use is the `### Tests` heading itself. The skill now passes the stripped Tests section to the LLM and asks for a list of `{title, precondition?, steps[]}` flows. The LLM uses whatever signals exist (h4 headers, numbered restarts, prose markers, state-change cues) - no enforced separator. Single-step verify-only classification also moves to LLM judgment (intent-based) rather than a leading-verb regex.
Phase 1 is the LLM-driven exploration loop and the expensive part of
each run. Phase 2 is just `agent-device replay`. When a flow's text
hasn't changed, the prior `.ad` is still valid and we shouldn't pay
the Phase 1 cost again.
Cache layout: ~/.cache/agent-device-pr-media/.ad-cache/<fingerprint>.ad
Fingerprint = sha256(precondition + json(steps) + platform + bundle_id
+ agent_device_version)
Title and PR/SHA are intentionally excluded from the key so common
flows (e.g. "sign in and create an expense") share cache entries
across PRs. Correctness is enforced at replay time, not lookup time.
Self-healing: on Phase 2 replay failure (cache hit path only),
invalidate the entry, re-run Phase 1 fresh, retry Phase 2 once. Cache
miss path failures don't retry - the freshly generated script just
failed on its own first replay, retrying would hit the same problem.
Manifest gains per-flow `cache: hit|miss|invalidated|bypassed` and
`fingerprint` fields. New flags: --no-cache (force fresh Phase 1),
--cache-clear (wipe before run). Soft 30-day TTL prune at run start.
The skill no longer states what the driver must or must not do with macros - whether to look any up, compose them, or ignore them is left entirely to the LLM driver. Removed the Non-goals bullet that banned macro composition, and softened the historical note about why grep was dropped from allowed-tools.
- Drop the runtime-code gate. Test/repro steps are the source of
truth, not the surrounding code diff. The skill no longer fetches
`gh pr diff --name-only` and no longer SKIPs on docs-only inputs.
- Inputs now accept a GitHub URL pointing at a PR (`/pull/N`) or an
issue (`/issues/N`). URL path disambiguates kind. Bare numbers
rejected (PR/issue share the GitHub number namespace).
- Per-source heading anchors with whole-body fallback:
PR -> `### Tests` / `### Test` / `## Tests`
issue -> `## Action Performed:` / `## Repro` / `## Steps to
reproduce` / `## Reproduction Steps`
- Issue platform-checklist used as a real platform-restriction signal
(filled boxes denote where the bug reproduces). Aliases:
`iOS: App` ≡ `iOS: Native`, `Android: App` ≡ `Android: Native`.
- Manifest envelope changed from `pr: <num>` to `source: {kind,
number, url, title}`. New per-flow `expected` field populated from
issue `## Expected Result:` blocks.
- Run-output dir generalized from `<pr-num>/` to
`<source-kind>-<source-num>/` (e.g. `pr-89475/`, `issue-89855/`).
- New exit code `8 BAD_INPUT` for malformed / non-PR-non-issue URLs.
Removed exit `2 SKIP` and the docs-only error-handling row.
- Allowed-tools: dropped `Bash(gh pr diff *)`, added
`Bash(gh issue view *)` and `Bash(gh api *)`.
Skill name `agent-device-pr-media` no longer matches the broadened
scope; rename flagged as a follow-up.
The old name baked in "PR" and "media" - both became misleading once issues entered scope as a valid input source and the skill's output grew beyond MP4s (stills + JSON manifest). `agent-device-evidence` keeps the parent-skill prefix, drops the source-kind specifier, and uses "evidence" to cover all outputs. Cache path moved from ~/.cache/agent-device-pr-media/ to ~/.cache/agent-device-evidence/. Prior caches under the old path are orphaned; users can `rm -rf ~/.cache/agent-device-pr-media` to reclaim disk - no migration script for v1.
bb797d0 to
b31d6b2
Compare
|
@Julesssss @rlinoz - PR is ready for re-review. The skill now does one thing well: record mobile evidence (iOS + Android MP4s, plus a JSON manifest) for the test or repro steps declared in any Expensify PR or issue.
Works for PRs and Issues repro steps
Smarter parsing
Faster on re-runs
Cleaner composition
Renamed
Let me know what you think of those changes. I am testing this in the meantime. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4611ad615a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Julesssss
left a comment
There was a problem hiding this comment.
Do you think it's worth extracting some of these instructions out into files under the skill? It does seem related but there's quite a lot here currently. Maybe instead we can cut down some of the instructions.
Excited to test this.
- Add non-interactive overrides for the parent bring-up (deterministic device pick, forced session reset) so the skill honors its autonomous contract regardless of parent prompts. - Key run directories by source kind (pr-N / issue-N) and rename PR_NUM to SOURCE_NUM/SOURCE_KIND to match the documented output layout and remove PR-vs-issue artifact ambiguity. - Broaden exit code 7 from NO_BUILD to BRING_UP_FAILED so Metro, gate, and simulator-boot failures don't masquerade as install failures. - Rename "Non-goals" to "Out of scope (do not do these)" with an imperative lead-in for clearer prohibition framing.
Move verbose lookup material out of the always-loaded SKILL.md into on-demand reference files. SKILL.md drops from 327 to 242 lines; the load-bearing rules stay inline with short summaries pointing at: - references/steps-parsing.md - anchors, boilerplate strip list, flow segmentation signals, per-flow field semantics. - references/manifest-schema.md - full manifest JSON and field definitions. - references/error-handling.md - per-situation failure matrix. Addresses @Julesssss' review feedback on PR Expensify#89475 asking for shorter SKILL.md and/or extraction into companion files.
The previous commit left 2-3 line summaries above each 'See references/X.md' link. Strip them - the section header plus the link is enough; the recap was just out-of-date duplication waiting to happen.
|
Hi @Julesssss thanks a lot for the feedback - it's all addressed ✅ Let me know if you'd like to see any other improvement here. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.73-0 🚀
Bundle Size Analysis (Sentry): |
|
Hi @kacper-mikolajczak Can I check it off the list if no QA needed?
|
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.73-0 🚀
Bundle Size Analysis (Sentry): |
|
@izarutskaya Sure! |
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.3.73-4 🚀
|
Explanation of Change
Adds a new
agent-device-evidenceskill under.claude/skills/that drives the Expensify App on iOS Simulator and Android Emulator via the existingagent-deviceskill, captures MP4 recordings (or PNG stills for verify-only flows) of test/repro flows declared in a GitHub PR or issue, and writes a JSON manifest plus local file paths.Behaviour:
/pull/Nor issue/issues/N). URL path disambiguates kind. Bare numbers rejected.### Tests(with### Test,## Testsfallbacks); issue bodies anchored on## Action Performed:(with## Repro/## Steps to reproducefallbacks). Whole-body LLM fallback when no anchor matches.#### Test case N:, prose markers, state-change cues)..adscript; Phase 2 replays the script underagent-device recordto produce a clean MP4 with no LLM thinking time on camera.(steps + precondition + platform) → .ad. Cache hit skips Phase 1; cache miss writes a new entry. Skill never deletes or invalidates; external tooling handles hygiene.~/.cache/agent-device-evidence/<source-kind>-<source-num>/<run-ts>/, with a JSON manifest summarizing all artifacts.iOS: NativeandAndroid: Native. DeclinesmWeb/Desktopwith a structured exit code, pointing to a browser-driver skill.SKIP,NO_FLOWS,PLATFORM_UNSUPPORTED,NO_BUILD,BAD_INPUT,PHASE1_TOTAL_FAILURE,PHASE2_TOTAL_FAILURE).agent-deviceskill'sBring-up(bundle ID, Metro, device pick, session, open). HybridApp-only (parent skill's gate).No app code is changed - this PR only adds files under
.claude/skills/agent-device-evidence/.Fixed Issues
$ #89476
PROPOSAL:
Tests
This PR only adds a
.claude/skills/skill, so verification exercises the skill itself.record the flow for https://github.com/Expensify/App/pull/<existing-PR>). Confirm:a. Source kind detected from URL (
/pull/N→ PR fetch).b. Body fetched via
gh pr view --repo Expensify/App --json title,body.c. Tests segmented into one or more flows via the LLM (no
####regex requirement).d. Defaults to both iOS and Android unless title/Tests prose says "iOS only" / "Android only".
a. Source kind detected from URL (
/issues/N→ issue fetch).b.
## Platforms:checklist read; only checked native platforms (iOS: App/Android: App) recorded.c. Issue checking only
MacOS: Chrome / Safariexits4 PLATFORM_UNSUPPORTED.cached: truein manifest) for unchanged flows. Edit a step in the source body, re-run; confirm the fingerprint changed and Phase 1 ran fresh.7 NO_BUILDwith the parent skill's install instructions.https://github.com/Expensify/App/discussions/1or a bare number). Confirm8 BAD_INPUT.--platforms iosagainst a multi-platform source. Confirm only iOS artifacts produced.Offline tests
N/A - changes don't affect app offline behaviour. This PR only adds an agent skill under
.claude/.QA Steps
N/A - files under
.claude/skills/are not shipped to staging or production. There is no QA on staging for this change.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari