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.
Part of the Code Review Engineer epic. Depends on Phase D (
reviewed_prstable). Built last.Goal
Deliver the headline promise — "reviews every PR within 10 minutes of it opening" — with no manual dispatch.
Scope
asynciopoll loop (no webhooks — runs locally on Docker Desktop, no public URL).watched_repostable +POST /agents/{agent_id}/watched-reposso the user picks repos.GatewayService.list_pull_requests(); dedup againstreviewed_prs; on first sight of a PR build a review instruction andDispatcher.dispatch_task(); skip if the agent isbusy.role_contextat dispatch.Files
backend/app/services/pr_watcher.py,backend/app/routers/watched_repos.py,backend/app/models/watched_repo.pybackend/app/main.py(startup task)watched_repostableNotes
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.