Inspiration
Managing repos takes way too much time when you are constantly dealing with incoming issues. You see an issue pop up, you have to stop what you are working on, find the file, write a fix, and open a PR. We wanted to build something that takes care of that loop so it reads the issue, fixes the code, and opens the PR for you.
What it does
Patch is a bot that reads the issue, fixes the code, and opens the PR for you.
You can use it two ways:
- Manual Mode: You paste in a repo, a file path, and a description of the bug. Patch pulls the code straight from GitHub, asks Groq to write a fix as a diff, applies it, commits it to a fork, and opens a real pull request.
- Auto-Track Mode: You register a repo and a background poller keeps an eye on its open issues. Anything new gets run through the same pipeline automatically, so issues you post get a PR within a couple of minutes without you touching anything. It keeps track of what it has already fixed so you do not end up with ten duplicate PRs on the same issue.
How we built it
- Backend: Python with FastAPI and uvicorn running the API and background loop.
- AI: Groq API with Llama 3.3 to generate the patches.
- GitHub: PyGithub for fetching files, forking, pushing branches, and opening PRs.
- Dashboard: Plain HTML, Tailwind, and Alpine.js.
Challenges we ran into
- We kept running into internal server errors a bunch of times while building it. Lazy-loaded objects threw errors, rate limits crashed requests, and invalid diff formats kept breaking git commands. We had to rewrite parts of the error handling and add locks to get it stable.
- The LLM loved adding extra markdown fences or messing up line numbers in the diff headers. We had to write sanitization parsers to clean up the code fences, fix the hunk counts, and add a semantic apply step for when standard git apply failed.
- Figuring out the fork and PR permissions so the bot could push to public repos without direct write access took some trial and error.
Accomplishments that we're proud of
- Getting the whole end-to-end pipeline working smoothly.
- Building a background poller that stays up and does not duplicate PRs.
- Making a dashboard that actually feels like a real tool.
What we learned
- How to handle messy LLM outputs so they do not break background tasks.
- Managing state and background tasks in FastAPI.
- Driving Git workflows through the GitHub API.
What's next for Patch
- Upgrading to better and newer models as they come out so it can handle more complicated codebase logic.
- Turning it into a real GitHub App.
- Letting it handle multi-file changes.
- Running tests before opening the PR
Log in or sign up for Devpost to join the conversation.