What the agent does
The agent reads src/features/feed/feed-screen.tsx, its usePosts hook, the QueryClient provider and src/lib/test-utils.tsx first. The screen took data, isPending and isError from usePosts and replaced the whole list with an error view whenever isError was set.
It adds an isRefreshing state that is true only during a user's pull, and an onRefresh that awaits the existing refetch() and clears the flag in finally, then passes both to the FlashList as refreshing and onRefresh. It skips React Query's isRefetching, since background refetches would show the spinner too. It changes if (isError) to if (isError && !data), so a failed refresh keeps the cached rows.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "A Linear issue labeled agent asks for pull to refresh on the feed screen using the existing React Query data path and native refresh indicator. Read src/features/feed/feed-screen.tsx, its usePosts hook and the QueryClient provider first. Preserve the existing FlashList and query cache. Define which state represents a user refresh, invoke the existing refetch operation and ensure the indicator ends after success or failure without confusing initial loading with refreshing. Add tests using the real query hook and a controlled test service, including updated rows, empty feed and rejected refresh behavior. Run pnpm lint, pnpm type-check and pnpm test --runInBand. Open a pull request linking the Linear issue URL supplied in the input. Distinguish recorded JavaScript checks from any native-device verification; never claim an emulator or device check that did not run.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
Tried on obytes/react-native-template-obytes at fd9b358: 2 files changed, 178 insertions(+), 2 deletions(-), 20 lines in src/features/feed/feed-screen.tsx and a new 160-line feed-screen.test.tsx. pnpm lint and pnpm type-check exited 0 before and after, and pnpm test --runInBand ended Tests: 45 passed, 45 total. With the screen change reverted, the new tests gave Tests: 4 failed, 1 passed, 5 total; only the first-load error test passed without it.
For the reviewer: a failed refresh now shows no message at all, just the stale rows, so decide on a toast or a banner. Only jest ran: no iOS or Android emulator, and the tests drive the RefreshControl props rather than a real gesture. No Linear URL was given, so the pull request it described has no link yet.
Run it on every Linear issue labeled agent
An automation with a linear trigger on linear.issue.labeled and the label agent runs the linear-label-to-pr recipe's prompt when someone in your Rush org labels a screen issue. An issue that names a different list, or asks for an error toast on a failed refresh, reaches the agent with those words.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
The obvious change would have swapped the feed for the error screen the moment a refresh failed. The run caught that with a test that rejects the refetch, and it showed its tests mean something by reverting the screen and watching 4 of 5 fail.
Frequently asked questions
Why not use the repository's test-utils?
Its @shopify/flash-list/jestSetup maps FlashList to a RecyclerView export that flash-list 2.0.2 lacks, so FlashList is undefined there. The new test renders the real FlashList and stubs only native measurement, plus @dev-plugins/react-query and expo-router's Link.
How does the test control the network?
It replaces client.defaults.adapter on the app's real axios client with one that holds each request until the test resolves or rejects it, so usePosts and the QueryClient run unchanged.