What the agent does
The agent reads the auth, users and tasks routes under src/routes/api/, the authorization, password-manager and tasks-file-manager plugins, the schemas and the existing tests. The baseline already reports 100% line coverage, so the gaps are untested behaviors, not lines.
It writes one file, test/routes/api/errors/error-paths.test.ts, with the repository's build helper and inject: 401 on every /api/tasks route and on PUT /api/users/update-password without a session or with a forged cookie, 403 for a non-admin delete and a non-moderator assign with the task left unchanged, 400 on bad query strings, ids and login bodies, and upload failures.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Find the routes and plugins in this Fastify API whose error paths have no tests and write node:test tests for them using fastify.inject against a real MySQL in the sandbox. Run npm test and open a 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
Tried on fastify/demo at 895908e: 1 file changed, 294 insertions(+). npm test exited 0 before and after, going from # tests 57 to # tests 89 with # fail 0, and npm run lint exited 0 after the change (not run before). The repository has no lockfile, so the agent used npm install --no-package-lock, and the MySQL was MariaDB 10.11 from apt because Docker was unavailable. It wrote a .env from .env.example with the three CAN_* flags changed from 0 to 1 and a COOKIE_SECRET filled in. No pull request was opened.
For the reviewer: two tests lock in a 500 when assigned_user_id or userId names an unknown user, from the foreign-key violation, where a 400 or 404 would be more correct. The non-multipart upload test asserts only a 4xx. npx tsc --noEmit -p test/tsconfig.json fails on a deprecated baseUrl in test/tsconfig.json, a file the change does not touch.
Run it on every night at 2:00 a.m. Pacific
An automation with a schedule trigger, cron 0 2 * * * and timezone America/Los_Angeles, runs this request. Its sandbox needs a MySQL where it can create test_db and test_user, and the same .env, because npm test seeds the database before the suite starts.
The use case this job follows, with its automation and trigger: Write the missing tests.
Why run it on Rush?
Line coverage was already 100%, so a coverage report would have shown nothing to write. Asking for error paths turned up 32 cases no test asserted, including that an unknown user id on POST /api/tasks and POST /api/tasks/:id/assign answers 500 rather than a client error. The tests pin that 500.
Frequently asked questions
Do the new tests share the database with the existing ones?
Yes. The tasks tests use the same test_db, so the new tests create their own rows and delete them in finally. The first draft cleaned up in t.after and failed with Unable to acquire a connection, because build(t) had already closed the app.
What did the run leave untested?
passwordManager.compare with a stored hash that has no . separator. The run thinks login would answer 500 there but did not check it.