What the agent does
The agent reads what the resources do by hand before replacing it. In a Quarkus service shaped like the hibernate-orm-panache-quickstart module of quarkusio/quarkus-quickstarts, two resources expose the same CRUD twice: FruitEntityResource at entity/fruits on a PanacheEntity, and FruitRepositoryResource at repository/fruits through a PanacheRepository. Both create methods throw a WebApplicationException with status 422 when the body carries an id, both update methods throw 422 when name is null, and nothing checks the 40-character limit that the Column annotation on Fruit and FruitEntity declares, so a longer name fails later in Hibernate as a 500. A nested ErrorMapper class in each resource catches every Exception and answers JSON with exceptionType, code and error, which is the shape any client already parses.
The change is small and has to stay consistent with that shape. The agent adds quarkus-hibernate-validator to the module's pom.xml beside quarkus-rest-jackson, which the platform BOM at version 3.40.1.1 already manages, and annotates name on both entity classes with NotBlank and Size max 40 so the limit matches the column. Create and update parameters get Valid. The repository's own validation-quickstart module shows the house style for this, a Book class with constraints and a resource that takes Valid parameters, and the agent follows it rather than inventing one. The hand-written null check for name goes; the id check on create stays, because no annotation expresses that an id must be absent on one method and present on another.
Status codes need a decision, and the agent makes it visibly. Quarkus answers a violated constraint on a REST parameter with 400 by default, while the resources today answer 422 for a missing name. The agent checks which mapper wins when the resource's catch-all ErrorMapper and the built-in violation handling both apply, then either keeps 422 by mapping the violation exception explicitly or moves to 400 and updates the frontend in src/main/resources/META-INF/resources/index.html, which posts to /entity/fruits. The pull request states the choice and the reason, and the violation list, field and message, lands in the same JSON shape so the Angular page keeps working.
Then it runs what the project runs. FruitsEndpointTest is a QuarkusTest that uses RestAssured against both paths, and FruitsEndpointIT reruns it as a QuarkusIntegrationTest against the packaged app; Dev Services starts PostgreSQL in a container for both, because application.properties only sets a datasource for the prod profile and import.sql seeds Cherry, Apple and Banana. The agent adds tests that post an empty name, a 41-character name and a missing body to both paths and assert the chosen status and the violation JSON, then runs ./mvnw test and ./mvnw verify in the module with the wrapper the module ships. The repository's CI in .github/workflows/build-pr-development.yml builds on JDK 21 and fails on any wildcard import, so the agent writes explicit imports and checks with the same git grep the workflow uses.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add Bean Validation to the REST resources in this Quarkus module. Read pom.xml, src/main/resources/application.properties, src/main/resources/import.sql, src/main/resources/META-INF/resources/index.html, every class under src/main/java and src/test/java, and the sibling validation-quickstart module for the house style, then add quarkus-hibernate-validator to pom.xml, put NotBlank and Size max 40 on the name field of both entity classes to match their Column length, and take Valid parameters in create and update on both resources, removing the hand-written null check for name but keeping the check that rejects an id on create. Decide whether violations answer 422 like the existing name check or 400, check which exception mapper actually handles them given the nested ErrorMapper, keep the JSON error shape with exceptionType, code and error plus a list of violations, and update index.html if the status changes. Add RestAssured tests for an empty name, a 41-character name and a missing body on both paths. Run ./mvnw test and ./mvnw verify in the module, use no wildcard imports, and open a pull request that states the status-code decision and quotes the test summary.",
"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
What comes back is a pull request on its own branch that adds one dependency to pom.xml, annotates the name field in Fruit.java and FruitEntity.java, adds Valid to four resource methods in FruitEntityResource.java and FruitRepositoryResource.java, removes two null checks, adjusts or extends the nested ErrorMapper so violations use the existing JSON shape, and adds test methods to FruitsEndpointTest.java that the integration test inherits. The description states the status code it chose and why, and quotes the Maven test summary from the sandbox.
The session read names the repository and the pull request URL. The transcript at GET /o/{org}/sessions/{id}/messages keeps the files it read, the Dev Services container start, each ./mvnw invocation with its output including the first run where the new tests fail against the old code, and the wildcard-import grep. A reviewer sees exactly which mapper handled the violation without re-running Maven.
Before merging, a reviewer checks that the Size limit equals the Column length on both classes so validation and the database agree, that the id check on create survived, that the Angular page in index.html still shows an error message for a blank name, and that the wrapper build passed on the module alone, since the quickstarts repository builds every module in CI.
Run it on every new resource class
Start one run per module or service that still validates by hand, with this request and the repository in resources, from a script that lists the resource classes and sets a request_id per module so a retried call returns the run already started. Each run gets its own sandbox with its own Maven repository cache and its own PostgreSQL container, so several modules are converted at once without sharing a port.
When a reviewer wants the other status code after all, a follow-up on the same session wakes the parked sandbox with the branch, the downloaded dependencies and the compiled classes still there, and the agent changes the mapper and reruns ./mvnw test. Give the key a webhook URL and Rush POSTs run.completed with data.session_url for each turn the key started; a key runs at most max_concurrent sessions, 4 by default, and a session past that answers 202 with status "queued" and starts when a slot frees, with its webhook arriving like any other.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
The uncertain part of this change is not the annotations, it is which exception mapper answers and what the JSON looks like, and the only way to know is to run the app with Dev Services and send the bad requests. That means a JDK, a Maven download and a PostgreSQL container, several minutes on a laptop for each attempt. The agent runs it in its own sandbox with Docker available, tries both statuses if needed, and keeps the responses.
The proof is the transcript and the tests, not a sentence in a pull request. The failing first run of the new tests, the passing run after the change, and the actual 400 or 422 responses are kept on the session beside the diff. Nothing is pushed to main, only a branch with a pull request a person merges.
Frequently asked questions
Will validation errors still return 422 like before?
The agent decides and says so. Quarkus answers a violated constraint on a REST parameter with 400 by default, while the hand-written check answered 422. It checks whether the nested ErrorMapper intercepts the violation exception, then either maps it explicitly to 422 or moves to 400 and updates the frontend in index.html; the pull request states the choice.
Does it need a database to run the tests?
Yes, and it starts one. application.properties sets a datasource only for the prod profile, so in test mode Quarkus Dev Services starts a PostgreSQL container and import.sql seeds the three fruits. The sandbox has Docker, so ./mvnw test and ./mvnw verify run the same way CI does.
Why keep the manual id check on create?
No standard constraint says an id must be absent in one method and present in another on the same class. The agent keeps that WebApplicationException with 422 and replaces only the null and length checks that Bean Validation expresses directly.
Does it touch the other quickstart modules?
No. The prompt scopes it to one module, and the repository builds every module in CI, so the agent runs the wrapper inside the module only and checks the no-wildcard-import rule that build-pr-development.yml enforces repository-wide.
More Quarkus jobs
The same job on other stacks
- Add Input Validation to a Sequelize and Express API (Sequelize)
- Add Request Validation to a Serverless API (Serverless Framework)
- Add Input Validation to a Slim 4 API (Slim)