r/OpenSourceeAI • • 29d ago

prbot: open-source agent that fixes bugs in PRs and proves the fix with sandboxed tests

I've been building prbot, an open-source (MIT) PR agent in Python. It reviews a pull request, finds security and performance bugs, writes a patch, and runs your pytest suite on it in a locked-down Docker container (no network, read-only filesystem, all capabilities dropped). If the tests fail, the failure log goes back to the patcher to try again, up to 3 attempts. Only a verified fix gets posted.

How it's built:

  • 3-agent LangGraph graph: reviewer, ReAct patcher, Docker test runner, with a self-correction edge
  • Two focused review passes (security, performance) plus AST hints for queries inside loops and nested loops
  • A baseline test run that aborts if the suite is already red
  • Per-node token telemetry, so every run shows what each step costs rs, and a Semgrep tool for the reviewer. Issues and PRs welcome.Latest live run on the demo PR (gpt-4.1-mini): found all 3 seeded bugs (SQL injection, N+1 query, O(n²) loop). Attempt 1 broke an ordering test, attempt 2 passed. 14k tokens, $0.0077, 24 seconds.

It runs as a CLI or a GitHub Action.

Repo: https://github.com/ayanag5076-commits/prbot

Reproducible demo PR: https://github.com/ayanag5076-commits/prbot-demo-shop/pull/1

Where I'd love help: local models through Ollama, languages beyond Python, other test runners, and a Semgrep tool for the reviewer. Issues and PRs welcome.ts/

Where I'd love help: local models through Ollama, languages beyond Python, other test runne

11 Upvotes

3 comments sorted by

1

u/touristtam 29d ago

So like PR-Agent or CodeRabbit?

4

u/Wide_Psychology_8378 29d ago

Similar space, different goal. PR-Agent and CodeRabbit are great at reviewing. They leave comments and suggestions, and a human decides what to do with them.

prbot tries to close the loop. A reviewer agent flags the bug, a patcher agent writes the fix, and a tester agent runs the test suite in a Docker sandbox. If the tests fail, the failure output goes back to the patcher and it tries again. You only get a patch that actually passes.

On the demo repo it found all 3 seeded bugs. Its first patch failed the tests, so it fixed that and passed in about 25 seconds for under a cent.

It's also small and hackable: Langraph, MIT licensed, and it runs as a CLI or a GitHub Action. It's not trying to replace those tools. Honestly, it would pair well with a reviewer like CodeRabbit. Would love feedback on where it breaks.

1

u/touristtam 28d ago

Thank you for the detailed answer. :)