What the agent does
The agent fetches pull request #4314 and reads its three files: packages/starlight/src/utils/routing/data.ts, which built the edit URL by appending entry.filePath to editLink.baseUrl, a new case in __tests__/edit-url/edit-url.test.ts, and a changeset. It installs with pnpm install --frozen-lockfile, then runs pnpm typecheck and the package's full Vitest suite on the base and on the PR head.
Before judging the fix, it checks what new URL already does: it encodes spaces and non-ASCII characters but leaves #, ? and % alone, so languages/c#.md linked to a fragment. It compares old and new URLs for five paths in node and runs the PR's test against the base data.ts.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Review the pull request this run was started for. Read the diff and the code it touches. Install with the repository's package manager from its lockfile, and run the affected package's tests and type check on the base and on the PR head, comparing the two. Run any test the PR adds against the base version of the changed file to show it catches the bug, and try the case the PR fixes by hand. Post one review with a verdict, findings with file:line and the exact results. Push no commits. If no pull request follows this prompt, stop and say so.",
"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 withastro/starlight at 6a6140d0: the head of pull request #4314, 3 files changed, 20 insertions(+), 1 deletion(-). The review approves, with four findings, none blocking, and a before-and-after table for five file paths. The full package suite went from 643 tests to Tests 644 passed (644), and the PR's test against the base data.ts ended Tests 1 failed | 2 passed (3). pnpm typecheck reported the same 26 errors on base and head, none in files the PR touches.
The review was written but not posted: the trial was told not to, and nothing was pushed or commented. Left to the maintainer: whether to ask for a ? or % fixture, since the test covers only #. The run skipped the e2e suite, pnpm lint and the test:dist build.
Run it on every pull request opened
An automation with a github trigger on pull_request.opened, with branch_patterns set to main, runs this prompt per pull request, except one from a fork, which never fires; #4314 is from a fork. Adding pull_request.synchronize reviews each push again, so a ? fixture added after the first review gets the same base-and-head comparison.
The use case this job follows, with its automation and trigger: Review every pull request.
Why run it on Rush?
A green suite alone would not show this fix works, and a red type check would wrongly blame it: the 26 errors were already on main. Running the new test against the old data.ts proved it catches the bug, and the node comparison showed which two characters the test still leaves uncovered.
Frequently asked questions
Why are 26 typecheck errors acceptable?
They are on main before the PR, in docs/src/components/component-preview.astro and the e2e fixtures under packages/starlight/__e2e__/fixtures/. The run diffed the error locations on base and head and found the same 26.
Does encoding break paths with spaces or accents?
No. a b/ü.md gives a%20b/%C3%BC.md before and after, because new URL already encoded those. Splitting on / keeps the separators, and editLink.baseUrl stays unencoded since the site author sets it.
More Astro jobs
The same job on other stacks
- Review Pull Requests on a Blazor Web App (Blazor)
- Review Pull Requests on a Chrome Extension Project (Chrome Extension)
- Review Pull Requests on a Cloudflare Workers Project (Cloudflare Workers)