What the agent does
The agent reads where the delay lives before it touches a component. In an app like realworld-apps/vue-realworld-example-app, package.json depends on vue 3.5, pinia 3 and vue-router 5 with vite 8, runs on Bun, and tests with Playwright against the RealWorld end-to-end suite vendored as the realworld submodule, which playwright.config.ts starts with bun run serve on port 8080. src/common/api.service.js is a fetch wrapper that resolves with { data } and rejects with an error carrying response.status, and src/common/config.js reads VITE_API_URL with https://api.realworld.show/api as the default.
In src/store/article.js, addFavorite and removeFavorite await FavoriteService and only then assign this.article = data.article and call useHomeStore().updateArticleInList(data.article), which copies favorited and favoritesCount into the matching entry of articles. Until the response arrives the heart in ArticleMeta.vue and ArticleActions.vue shows the old state, and toggleFavorite in both components reads props.article.favorited to decide which action to call. src/store/profile.js does the same for follow and unfollow, with a try that swallows errors and leaves profile as it was.
The agent changes the stores, not the components. addFavorite and removeFavorite first apply the expected state, flipping favorited and adjusting favoritesCount on both this.article and the home list through updateArticleInList, then call the service, replace the guess with the server's data.article on success, and restore the previous values in a catch before rethrowing so the caller can show an error. follow and unfollow in profile.js get the same shape: set following at once, call the API, keep the response or roll back. A second click while a request is in flight is ignored with a per-slug pending set, so a double tap does not send a favourite and an unfavourite out of order. ArticleMeta.vue, ArticleActions.vue and Profile.vue keep their templates, since they already render from store state.
Verification uses what the repository has. The agent runs bun install, bun run lint and bun run format:check as lint.yml does, then bunx playwright install --with-deps chromium and bun run test:e2e, which runs the shared RealWorld specs that favourite and follow through the real UI, as playwright.yml does on every pull request. It also starts bun run serve, throttles the network in the sandbox browser, clicks the heart and records that the count changes before the request completes, and blocks the favourite endpoint to show the rollback.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add optimistic updates for favourite and follow to this Vue app and open a pull request. Read package.json, playwright.config.ts, src/common/api.service.js, src/common/config.js, src/store/article.js, src/store/home.js, src/store/profile.js, src/components/ArticleMeta.vue, src/components/ArticleActions.vue, src/views/Profile.vue and .github/workflows/playwright.yml first. In src/store/article.js make addFavorite and removeFavorite update favorited and favoritesCount on the article and on the home list through updateArticleInList before calling FavoriteService, replace the guess with the server's article on success, and restore the previous values and rethrow on failure; ignore a second call for the same slug while one is pending. In src/store/profile.js do the same for follow and unfollow on profile.following. Do not change the component templates. Run bun install, bun run lint, bun run format:check, bunx playwright install --with-deps chromium and bun run test:e2e. Then start bun run serve, open an article in the browser with network throttling, click the favourite button and record that the count changes before the request finishes, then block the favourite request and record the rollback. Paste the lint and Playwright output and describe both browser checks in the pull request.",
"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
What comes back is a pull request that changes two files, src/store/article.js and src/store/profile.js, and no template. The description pastes the ESLint and Prettier checks and the Playwright run of the shared RealWorld suite, and describes the two browser checks: the heart's count moving before the throttled request returns, and the count returning to its old value when the request is blocked.
The playwright.yml and lint.yml workflows run the same suite and checks on the pull request, so the favourite and follow specs in the vendored suite pass again on GitHub.
A reviewer checks that a failed request restores both the article and the home list entry, that the rollback also covers favoritesCount and not just the flag, that a pending favourite blocks a second click on the same slug but not on another article, and that the error is rethrown so a future caller can show a message rather than failing silently as profile.js did before.
Run it on every responsiveness complaint from users
A team with several Vue front ends starts one run per repository with POST /o/{org}/sessions, this prompt with the actions named for that app, and the repository in resources. The agent reads each app's own stores, so an app on Vuex rather than Pinia gets the same pattern in its mutations, and each run opens its own pull request with its own Playwright output.
The key's webhook_url receives run.completed for each run it starts, with data.session_url for the pull request link.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
Optimistic updates are easy to get half right: the flag flips but the count does not, the rollback restores the article but not the list, a double click sends requests out of order. In a Rush sandbox the agent runs the shared end-to-end suite the repository already vendors, then drives a real browser with a throttled and then a blocked network to show the update and the rollback, and those recordings stay in the transcript with the pull request.
The same request works across every Vue app the team owns, each in its own sandbox, and a reviewer reads two store files against a recording instead of reasoning about timing in their head.
Frequently asked questions
Why change the stores and not the components?
ArticleMeta.vue, ArticleActions.vue and Profile.vue already render from store state, and home.js already has updateArticleInList to keep the list in step. Applying the expected state in the actions updates every component at once and keeps the templates, and the Playwright selectors, unchanged.
What happens when the request fails?
The action restores the values it saved before the call, on the article and on the home list, and rethrows the error. The user sees the heart return to its previous state. The browser check in the pull request blocks the favourite request to show exactly that.
Can a fast double click send requests out of order?
No. Each action keeps a pending set keyed by slug or username and ignores a second call while one is in flight, so a favourite and an unfavourite cannot cross. A click on a different article is not blocked.
Do the end-to-end tests still pass against the public API?
Yes. playwright.config.ts runs the vendored RealWorld specs against bun run serve, which talks to the API in VITE_API_URL, and the specs favourite and follow through the same buttons. The agent runs them in the sandbox and the workflow runs them again on the pull request.
More Vue jobs
The same job on other stacks
- Add Optimistic UI to an Angular App (Angular)
- Add Optimistic Updates to a React App (React)
- Add Optimistic UI to a React Router Form from a Linear Issue (React Router)