What the agent does
The agent checks out the pull request and diffs it against the base branch. In dotnet/eShop a change usually lands in src/Ordering.API/Apis/OrdersApi.cs, the ordering domain, or src/Basket.API/Grpc/BasketService.cs; for each changed method it looks for a test that reaches the new branch and lists the behavior that has none, with file and line.
eShop tests with two frameworks, and global.json pins MSTest.Sdk 4.0.2 on Microsoft.Testing.Platform. A domain or gRPC rule gets an MSTest [TestMethod] like those in BasketServiceTests.cs, which substitutes IBasketRepository with NSubstitute, or uses Builders.cs for orders. A new HTTP behavior gets an xUnit [Fact] in OrderingApiTests.cs over the WebApplicationFactory in OrderingApiFixture.cs, sending the x-requestid header those tests already send.
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. List the new or changed behavior in src/Ordering.API, src/Ordering.Domain and src/Basket.API that no existing test covers, with file and line. Write tests for each item in the test project that already covers its neighbor: MSTest with NSubstitute in tests/Ordering.UnitTests and tests/Basket.UnitTests, reusing Builders.cs and the existing helpers; xUnit with the existing fixtures in tests/Ordering.FunctionalTests and tests/Basket.FunctionalTests. Change no application code. Run dotnet test on each project you changed; the functional projects need Docker for Aspire, so if their containers cannot start, say which tests you wrote but could not run. Do not push commits or open a pull request. Post one review on the pull request listing each untested behavior with file and line, the tests you wrote, the dotnet test result per project, any test that fails against the branch's code with its failing assertion, and the tests as a patch. 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/123"
}
]
}- 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 behavior with its file and line, the [TestMethod] or [Fact] written for it, the dotnet test result for every project run, and a patch that touches files under tests/ only. The branch is unchanged.
Left to the reviewer: whether to apply the patch, and, for a test marked failing, whether the handler or the expected rule is wrong.
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 names the pull request's URL, title, author, labels, base branch and body but no commit SHAs, so the agent fetches the head from the URL. A push that only edits Directory.Packages.props still fires, since no trigger filters on paths.
The use case this job follows, with its automation and trigger: Review every pull request.
Why run it on Rush?
eShop's split between MSTest unit projects and xUnit v3 functional projects is the trap: a test written in the wrong framework compiles into nothing the runner finds, or pulls a second framework into a project. The agent places each test by its neighbor, runs dotnet test on that project under the pinned SDK, and says plainly when an Aspire functional test could not start its Redis or Postgres container.
Frequently asked questions
Why a patch in a review instead of a commit on the branch?
The review recipe does not push, so the diff the author asked to have reviewed stays exactly theirs. Applying the patch from the review adds the tests, and CI runs them on the next push.
Do the Aspire functional tests run in the sandbox?
They need Docker, as eShop's tests/README.md says. If they cannot start, the review lists the functional tests written but not run.