Skip to content

Phase C — Autonomous PR review #9

@michaelzwang13

Description

@michaelzwang13

Part of the Code Review Engineer epic. Depends on Phase D (reviewed_prs table). Built last.

Goal

Deliver the headline promise — "reviews every PR within 10 minutes of it opening" — with no manual dispatch.

Scope

  • A FastAPI startup asyncio poll loop (no webhooks — runs locally on Docker Desktop, no public URL).
  • New watched_repos table + POST /agents/{agent_id}/watched-repos so the user picks repos.
  • Poll every 120s via GatewayService.list_pull_requests(); dedup against reviewed_prs; on first sight of a PR build a review instruction and Dispatcher.dispatch_task(); skip if the agent is busy.
  • On startup, only consider PRs opened in the last ~30 min (avoid back-reviewing history).
  • Inject the agent's stored memory/preferences into role_context at dispatch.

Files

  • New: backend/app/services/pr_watcher.py, backend/app/routers/watched_repos.py, backend/app/models/watched_repo.py
  • Modify: backend/app/main.py (startup task)
  • Migration: watched_repos table

Notes

Run uvicorn single-worker so the loop runs once.

Done when

Opening a PR on a watched repo produces a review within ~2 min; a later poll does not re-review it.

Estimate: ~1.5 days.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions