What the agent does
The agent reads the service first. In an app shaped like the getting-started quickstart in quarkusio/quarkus-quickstarts, pom.xml imports quarkus-bom 3.40.1.1 with quarkus-rest, quarkus-junit and rest-assured, maven.compiler.release 17, maven-surefire-plugin 3.5.4 with java.util.logging.manager set to the JBoss log manager, and a native profile that runs failsafe against the -runner binary. src/main/resources/application.properties holds two comment lines and nothing else. GreetingResource serves GET /hello and GET /hello/greeting/{name} through GreetingService, and GreetingResourceTest checks both with REST Assured under @QuarkusTest. src/main/docker/Dockerfile.jvm runs the quarkus-app layout with run-java.sh from the UBI 9 OpenJDK 21 image as its entrypoint. Nothing configures shutdown, so on SIGTERM the application exits at once and a request in flight gets a closed connection.
Quarkus has the settings built in; what the project lacks is the choice of values and a place for them. quarkus.shutdown.timeout is the time Quarkus waits for running HTTP requests to finish before it stops, and is off until set, so the agent sets it to a duration in application.properties, with a comment that it only tracks HTTP requests and not messaging. quarkus.shutdown.delay-enabled is a build-time property; with it true, the runtime quarkus.shutdown.delay is a pause between the stop signal and the actual shutdown during which the server keeps answering but a readiness probe reports down, giving a load balancer time to drain. That only helps when quarkus-smallrye-health is present and a readiness probe is configured, so the agent adds the delay when the pom has that extension and otherwise explains in the pull request what adding it would buy.
For visibility it adds a ShutdownObserver bean modelled on AppLifecycleBean in the lifecycle-quickstart of the same repository: an @ApplicationScoped class with void onStop(@Observes ShutdownEvent ev) that logs one line through the JBoss logger, so the shutdown sequence appears in the log where the ops team reads it. The guide says ShutdownEvent fires before @Destroyed(ApplicationScoped.class), and the agent keeps the observer to logging rather than closing resources Quarkus already closes.
Then it proves the behaviour instead of describing it. It runs ./mvnw package -DskipTests to get target/quarkus-app/quarkus-run.jar, starts it with java -jar, sends a request to /hello, and in the same second sends kill -TERM to the process, checking that the request still gets its 200 and the log shows the observer line before the JVM exits; it repeats the stop with an idle server to show it exits promptly. It runs ./mvnw test so GreetingResourceTest still passes with the new properties, and pastes the log excerpt and the surefire summary in the pull request, with a note that the container's terminationGracePeriodSeconds must exceed delay plus timeout, since run-java.sh passes the signal to the JVM and Kubernetes kills the pod when the grace period ends.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "codex",
"input": "Add graceful shutdown to this Quarkus service and open a pull request. Read pom.xml, src/main/resources/application.properties, the resources under src/main/java, the tests and src/main/docker/Dockerfile.jvm first. Set quarkus.shutdown.timeout to 30 seconds in application.properties with a comment that it covers HTTP requests only. If the pom includes quarkus-smallrye-health, also set the build-time quarkus.shutdown.delay-enabled to true and quarkus.shutdown.delay to 5 seconds, and explain in the pull request why the readiness probe going down during the delay matters; if it does not, explain what adding the extension would enable and leave the delay out. Add an ApplicationScoped bean with a ShutdownEvent observer that logs one line, modelled on the lifecycle guide. Build the jar with ./mvnw package -DskipTests, start it, send a request to /hello and a SIGTERM in quick succession, and capture that the request completes and the observer line appears before exit; stop an idle server too. Run ./mvnw test. Paste the log excerpts and the test summary, and state that terminationGracePeriodSeconds must exceed delay plus timeout. Change no endpoints.",
"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 with two or three new lines in application.properties, one new class with a ShutdownEvent observer, and nothing else in src/main/java. The description quotes the log from the sandbox: the request answered during the stop, the observer's line, the JVM exit, and the shorter log from stopping an idle server, plus the surefire summary from ./mvnw test.
The quickstarts repository runs its own build workflow on pull requests, build-pr-development.yml, which compiles and tests every quickstart; on a standalone service the team's ./mvnw verify workflow does the same, or the pasted output is the check.
A reviewer checks the timeout against the slowest real request the service handles, decides whether the delay is wanted given how their load balancer drains, and sets terminationGracePeriodSeconds in the deployment above delay plus timeout. If the service consumes messages, they note that the timeout does not wait for those.
Run it on every service deployed to Kubernetes
A platform team sends one POST /o/{org}/sessions per Quarkus repository with this prompt and that repository in resources. Each run reads its own pom.xml, so a service with quarkus-smallrye-health gets the delay and one without gets only the timeout and the explanation, and each opens its own pull request. One repository per run; a request_id in the body makes a retry safe.
Give the API key a webhook_url and Rush POSTs run.completed when each turn ends, with the session_url to read the pull request from, so the chosen timeout in every service can be compared with the grace period in its deployment.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
Shutdown behaviour is only visible at the moment nobody is watching, a rolling deploy, and a wrong setting shows up as a few failed requests per release that are hard to attribute. In a Rush sandbox the agent builds the real jar, sends a request and a SIGTERM within the same second, and keeps the resulting log in the run's record beside the diff, so the reviewer reads the request that finished during shutdown rather than a property name.
The settings are three lines, but knowing which are build-time, what the delay needs to be useful, and how they relate to the pod's grace period is the work, and it repeats for every service. The agent does the whole pass per repository, each in its own sandbox, and the pull requests arrive with the same evidence.
Frequently asked questions
Does Quarkus not do this by default?
No. quarkus.shutdown.timeout is unset by default, and the guide says the application then exits immediately. Setting it enables tracking of active HTTP requests, which the guide notes costs a little performance, and the application waits up to that long for them to finish.
Why is the delay conditional?
During quarkus.shutdown.delay the server keeps serving and only the readiness probe reports down, which is what lets a load balancer stop sending traffic before the server stops. Without quarkus-smallrye-health there is no readiness endpoint to go down, so the delay would just make stops slower. The agent adds it only when the extension is in the pom.
Why is one property build-time?
quarkus.shutdown.delay-enabled is read at build time, so it must be in application.properties when ./mvnw package runs, not injected into the container later. quarkus.shutdown.timeout and quarkus.shutdown.delay are runtime properties and can be overridden with environment variables such as QUARKUS_SHUTDOWN_TIMEOUT.
Does it cover Kafka or other messaging?
No. The guide says only the HTTP extension supports the graceful timeout, so shutdown can still happen while a message is being processed. The pull request says so; making consumers idempotent or draining them is separate work.