What the agent does
The agent reads issue #145 through the GitHub API, then src/app/routes/auth/auth.service.ts, auth.controller.ts, src/tests/prisma-mock.ts and the auth tests. The issue's "_id is already taken" error came from the app's old Mongoose code. In the current Prisma code, updateUser never checked uniqueness, so another user's email fell through to Prisma's unique-constraint error and a 500.
Before fixing that it found why 7 of 8 auth tests already failed: auth.service.test.ts imported the service before prisma-mock, so the real Prisma client loaded. It moved the mock import first, wrote two tests, saw both fail, then gave the existing checkUserUniqueness an excludeId instead of adding a second lookup.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Fix the GitHub issue supplied after this prompt in this Express repository. Read the issue and its comments first; if the issue describes code that no longer exists, find the equivalent in the current code and say so. Reproduce it with a failing test in the repository's own test setup, fix the cause in the service that owns it, and run the repository's tests and build before and after. Open a pull request whose description includes Closes #<issue> and explains the cause. If no issue 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 gothinkster/node-express-realworld-example-app at 30b68e1: issue #145, 2 files changed, 59 insertions(+), 21 deletions(-) in src/app/routes/auth/auth.service.ts and src/tests/services/auth.service.test.ts. The baseline ended Tests: 7 failed, 1 todo, 19 passed, 27 total; with only the import fix, the two new tests failed; after the fix, Tests: 1 todo, 28 passed, 29 total and Successfully ran target test for project api. npx nx build passed before and after. updateUser now answers 422 has already been taken for another user's email or username.
For the reviewer: the repo has no Prettier config, so npx prettier --write rewrapped lines the fix never needed; drop those hunks if you prefer. The tests use the repo's Prisma mock, and PUT /user was not run against a real database.
Run it on every GitHub issue labelled agent
An automation with a github trigger on issues.labeled and the label agent runs this prompt when a maintainer labels an issue. The issue's author must be an owner, member or collaborator and whoever labels it needs write access, so a stranger's issue, #145 included, never starts a run, even once labelled.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
The issue was over three years old: its error message came from a Mongoose model the repository no longer has. The run traced the symptom to the Prisma service instead of closing the issue as obsolete, and it repaired a test file that failed without a database (7 failures on a missing DATABASE_URL).
Frequently asked questions
Does keeping my own email still work?
Yes. checkUserUniqueness now takes the caller's id and ignores their own row, and one of the two new tests updates a user with their unchanged email and expects a token back.
Why did the agent touch a test it was not asked to?
The new tests could not run while auth.service.test.ts loaded the real Prisma client. Moving the prisma-mock import to the top turned the 7 baseline failures into passes with no change to the application.