What the agent does
The agent checks out the pull request, reads vitest.config.ts, src/test-setup.ts and the existing specs, then diffs against the base branch. In realworld-apps/angular-realworld-example-app all six spec files cover services, so a change to token.interceptor.ts, error.interceptor.ts, the requireAuth guard in app.routes.ts or any component arrives with no spec to extend.
New specs follow src/app/core/auth/services/user.service.spec.ts: explicit imports from vitest, HttpTestingController for API calls, vi.fn() doubles for injected services and firstValueFrom for observables. A component spec uses TestBed.createComponent and asserts on the rendered DOM. The agent runs bun run test and bun run format:check on the result, and leaves the Playwright suite alone.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Check out this pull request and diff it against its base branch. Read vitest.config.ts, src/test-setup.ts and the existing spec files under src/app first. List each new or changed behaviour in services, interceptors, guards, pipes, directives and components that no spec covers, with file and line. For each, write a Vitest spec in the style of src/app/core/auth/services/user.service.spec.ts: explicit imports from vitest, TestBed with HttpTestingController for anything that calls the API, vi.fn() doubles for injected services, firstValueFrom for observables; for a component, TestBed.createComponent, fixture.detectChanges() and assertions on the rendered DOM. Change no application code and do not touch the Playwright tests or the realworld submodule. Run bun install, bun run test and bun run format:check. Do not push commits or open a pull request. Post one review on the pull request listing each untested behaviour with file and line, the specs you wrote, the vitest and format:check results, any spec that fails against the branch's code with its failing assertion, and the specs as a patch. If nothing under src/app changed, say so in the review. If this run names no pull request, in resources or after this prompt, stop and say so.",
"resources": [
{
"url": "https://github.com/your-org/your-app/pull/42"
}
]
}- 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
One review lands on the pull request: each untested behaviour with its file and line, the spec written for it, the vitest summary and the format:check result from the sandbox, and a patch that touches *.spec.ts files only. Nothing is pushed to the branch.
Left to the reviewer: whether to apply the patch, and, for a spec marked failing, whether the interceptor or guard under change is wrong or the spec's expectation is.
Run it on every pull request opened against main
An automation with this request as its prompt and a github trigger on pull_request.opened and pull_request.synchronize, branch_patterns main, reviews each new pull request and each push to one. Only an owner, member or collaborator fires it; a fork's pull request never does. The event text carries the pull request's URL, title, author, labels, base branch and body but no SHAs, so the agent checks out the head from the URL. No trigger filters on paths, so a pull request that only bumps @angular/core still fires, and the review says no behaviour under src/app changed.
The use case this job follows, with its automation and trigger: Review every pull request.
Why run it on Rush?
In this app the code most likely to change without a test is the code with no spec file at all: three interceptors, a guard, two pipes and every component. The agent writes the first spec for such a file in the service specs' shape and runs it under the same jsdom and @analogjs/vite-plugin-angular setup, so the review shows a spec that ran, not a note that one is missing.
Frequently asked questions
Why do the specs come back as a patch, not a commit?
The review recipe never pushes, so the branch holds only what its author wrote. The author applies the patch from the review with git apply, keeping only the specs they want.
Will it write Playwright tests?
No. playwright.config.ts extends a base config from the shared realworld submodule, so end-to-end specs belong there. The agent adds Vitest specs under src/app only.