GitHub issue-to-PR agent
Build an async GitHub App agent that turns a labelled issue into a verified, review-ready PR inside a sandbox, with scoped credentials, budgets and no way to force-push.
The capstone and what it builds on
- 1GitHub Issue-to-PR Autonomous AgentThe capstone brief
- 2The Autonomous Coding Agent Landscape (2026)Phase 15: Autonomous systems
- 3Benchmarks: SWE-bench, GAIA, AgentBenchPhase 14: Agent engineering
- 4Scope Contracts and Task BoundariesPhase 14: Agent engineering
- 5Verification GatesPhase 14: Agent engineering
- 6The Workbench on a Real RepoPhase 14: Agent engineering
- 7Action Budgets, Iteration Caps, and Cost GovernorsPhase 15: Autonomous systems
- 8Security - Secrets, API Key Rotation, Audit Logs, GuardrailsPhase 17: Infrastructure and production
What You'll Build
A background coding agent: label an issue @agent fix this, a webhook enqueues work, a worker infers the build environment, runs an agent loop in a sandbox, verifies tests and coverage, and opens a PR with its rationale. The engineering focus is environment inference, scoped credentials, per-repo budgets, branch protection and secret hygiene.
Requirements
- GitHub App with minimal permissions (issues read and write, pull requests write, contents read and write, workflows read). Branch protection on
mainblocks direct pushes and force-pushes, and the App is not on the bypass list; include the settings as JSON or a description. - Webhook receiver that verifies the signature, filters for the trigger label or PR comment and enqueues the job (SQLite, Redis or a cloud queue).
- Dispatcher enforcing per-repo per-day limits on PR count and spend.
- Environment inference: detect language and package manager (for example uv, pnpm, go mod, cargo) and generate a Dockerfile if the repo has none.
- Agent loop with ripgrep, a repo map, read and edit, run_tests and git tools, with hard limits on cost, wall-clock and turns.
- Verification: run the full test suite in the sandbox; red tests mean no PR; a coverage drop over 2 percentage points opens the PR with a
needs-reviewlabel. - Diff allow-list in the worker that rejects changes under
.github/workflowsand to secret files. - PR body with rationale, diff summary, trace link, cost and turns; an
@agentcomment on the PR triggers a follow-up run. - Credential hygiene: short-lived installation tokens only; logs scrubbed for secrets before archiving, proven with a planted fake secret.
- Evaluation on at least 10 seeded issues across at least 2 repos: pass rate, PR quality (diff size, coverage delta, style), cost and latency per issue.
Constraints
- Model-agnostic: any OpenAI-compatible endpoint (including the KatalockAi API) or a local model (for example via Ollama, llama.cpp or vLLM) may be used. No named commercial model is required; record which model you used in the README.
- Hardware: a laptop with Docker. Use a tunnel (smee.io, cloudflared or ngrok) for webhooks, or run the worker as a GitHub Actions job.
- Substitution: the lesson uses Lambda, SQS, ECS, 30 issues and comparisons with hosted agents. Here a local receiver and queue, 10 or more seeded issues in your own test repos, and an optional comparison are accepted.
- Only install the App on test repos you own. Never give it admin rights or bypass permissions.
Stretch Goals
- Add a flaky-test mode that reruns a test many times and proposes a stabilising change.
- Add a dry-run mode that opens a draft PR with only the plan.
- Build a per-repo cost dashboard with an anomaly alert.
How to Submit
- Public GitHub repo with
app/(manifest and permissions),receiver/,dispatcher/,worker/(env inference, agent loop, verification),eval/(issues, results) andREADME.md, plus links to your test repos with the agent's PRs. - README: architecture, App permissions and branch-protection setup, how to run locally, the eval table, safety measures and limitations.
- Paste the eval table, links to two agent-opened PRs and the output of the secret-scrub and force-push tests.
How It's Reviewed
Professor Katalock reads your repository and the evidence you paste, and scores each criterion out of 100. You pass with a weighted total of 70 or more and no criterion below 40. A copied or padded submission is flagged and fails.
Submit
Push your work to a public GitHub repository with a README that explains how to run it, then paste the evidence below. Up to 3 reviews a day, free.
- Eval table (issue, outcome, diff size, coverage delta, cost, wall-clock)
- Links to two PRs opened by the agent on your test repos
- Output of the planted-secret log scrub test
- Output showing a force-push or workflow-file edit being rejected
- Short reflection on the issue type that most often failed
Reviews are done by AI against the rubric above. They check the evidence in your repository; they are not a substitute for a human code review, and a review can be wrong. If you think it is, improve the README so the evidence is unmistakable and resubmit.