What the agent does
The pull request, hexpm/hexpm #2075, adds priv/repo/migrations/20261021120000_add_release_download_breakdowns_view.exs, a ReleaseDownloadBreakdown schema and a test: 3 files, 91 insertions. The agent reads mix.exs, docker-compose.yaml, the CI workflows, config/test.exs and priv/repo/structure.sql, and notes that CI runs postgres:18.
With no Docker, it installed Postgres 18 and Elixir from conda-forge, built the base with ecto.load and ecto.migrate, seeded 100k releases and 4M downloads rows, and applied only the new migration while a probe inserted into downloads every 0.1 s. It recorded the SQL and tried mix ecto.rollback --step 1 and --to.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Review the Ecto migrations added by the open pull request for the checked-out branch; ask for the PR URL if it is ambiguous. Read mix.exs, mix.lock, the database configuration and CI first. Prepare a fresh disposable Postgres from the base branch's supported structure/setup, then apply only the proposed migrations and record their SQL. Check table rewrites, lock acquisition, dropped or narrowed data, constraint validation and rollback limitations. Run the relevant tests and mix test when possible. Comment on the existing PR with file and changed-line references, evidence and a safer rollout sequence. Distinguish observed sandbox results from production-size risks. Do not edit migrations, open another PR, connect to production or claim unrun checks passed.",
"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 hexpm/hexpm at a229c2ac: pull request #2075, a review with five findings and a five-step rollout, no code change. mix ecto.migrate printed == Migrated 20261021120000 in 4.1s; downloads saw only AccessShareLock, and no concurrent insert took over 59 ms. Full mix test ended Failed: 3 tests on the PR and Failed: 2 tests on the base 461c0708: those two Hexpm.Diff.GeneratorTest failures predate the change, and the third, SSOJITTest, passed on two reruns. The review was not posted.
For the reviewer: whether to re-timestamp the migration after 20261102120000, since mix ecto.rollback --step 1 reverted that newer migration and left the view, and whether to create the view WITH NO DATA and populate it separately, which the run did not try. Timings are synthetic.
Run it on every pull request into main
An automation with this prompt and a github trigger on pull_request.opened and pull_request.synchronize, branch_patterns set to main, reviews every push from a member's branch. A pull request from a fork fires no trigger, and #2075 came from a fork, so this trial was started by hand on a clone checked out at pull/2075/head.
The use case this job follows, with its automation and trigger: Review every pull request.
Why run it on Rush?
The migration itself is cheap; the problems sit around it. Rollback hits the wrong file, and rollback --to also reverted CreateStagedReleases, dropping staged_releases and its data. structure.sql never gains the view. Nothing in downloads_worker.ex refreshes it, so its day and week rows freeze at migration time. A downloads row whose package disagrees with its release breaks the unique index.
Frequently asked questions
What did the run change to get mix test going?
Elixir 1.20.5 on OTP 27 came from conda-forge, where CI uses OTP 29.1. The lumis dependency then failed because no precompiled NIF exists for the conda target x86_64-conda-linux-gnu, so both the base and PR runs set TARGET_ARCH=x86_64 TARGET_OS=linux TARGET_ABI=gnu TARGET_VENDOR=unknown to load the precompiled build.
Is a 4.1 s migration safe in production?
Not on this evidence. Production downloads is likely far larger, so the review expects minutes inside the migration's transaction, holding Ecto's migration lock. It suggests creating the view empty and running the first REFRESH separately.