What the agent does
The agent checks out hexpm pull request #2093, which then capped README Markdown parsing at 2 MB, and reads lib/hexpm_web/readme/renderer.ex and test/hexpm_web/readme/renderer_test.exs. The PR's own test covers a 600 KB README falling back to plain text. Missing were the new parse_memory option, passed as an existing test passes parse_time, and an ordinary README still rendering as Markdown.
With no Erlang, Elixir, Postgres or root, it installs them with micromamba and runs the file on the untouched head: Result: 22 passed.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "This pull request changes Phoenix application code. Read the diff and the existing ExUnit tests for the modules it changes, and add only the tests the change is missing, beside the existing ones and in their style. Run mix test for those files on the PR head, then against the base commit's version of the changed module, and show which new tests fail there. If a test exposes a surprising limit, report it with numbers rather than weakening the test. Do not change application code. Push the tests to this pull request's branch and comment with the cases covered and the exact results. If no pull request follows this prompt, stop and say so.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}The trial ran this request with its push and comment steps turned off: the tests were not pushed and the comment was reported back, not posted.
- 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 e4ae2f19: then the head of pull request #2093, since raised to 4 MB and merged; 1 file changed, 27 insertions(+) in test/hexpm_web/readme/renderer_test.exs. On the PR head mix test for that file ended Result: 24 passed. With the base commit's renderer.ex and mix.lock swapped in it ended Result: 22/24 passed: the parse_memory test failed with a NimbleOptions.ValidationError ("unknown options [:parse_memory], valid options are: [:parse_time]"), as did the PR's own test.
At that head 2 MB was tight: the probe found 1,000 repeats of a short paragraph (28 KB) render as HTML, while 2,000 (56 KB) fall back to plain text. The run skipped the full suite and mix compile --warnings-as-errors; mix ecto.setup failed in priv/repo/seeds.exs, which the test alias does not need.
Left to the reviewer: applying the two tests, and whether a limit that drops a 56 KB README to plain text is too tight.
Run it on every pull request opened against main
An automation with a github trigger on pull_request.opened and pull_request.synchronize and branch_patterns main saves this request with its push and comment steps replaced by the recipe's: do not push commits, and post one review listing each test, its result and the tests as a patch. Only an owner, member or collaborator fires it, never a fork's pull request like #2093, so the trial started by hand. The event carries no SHAs; the saved prompt must take the head and base from the URL.
The use case this job follows, with its automation and trigger: Review every pull request.
Why run it on Rush?
The useful finding was a failing test: the second test's first draft, a 140 KB README of 5,000 short paragraphs, fell back to plain text under the 2 MB limit. The run measured the threshold instead of shrinking the test.
Frequently asked questions
Why does one new test pass on the base too?
It checks that 1,000 paragraphs still render as Markdown, already true before the PR, guarding against a later, tighter limit.
Did the setup change any tracked files?
No. Rustler's NIF download needed TARGET_ARCH=x86_64 TARGET_VENDOR=unknown TARGET_OS=linux TARGET_ABI=gnu. The base check swapped in, then restored, renderer.ex and mix.lock; the diff is the test file only.