Inspiration

Pull-request reviews often focus only on the changed lines of code. That can miss the most important question: what else in the repository can this change affect?

I built PR Guardian AI to make AI-assisted reviews more useful for developers by combining the pull-request diff with repository context, dependency relationships, affected callers, and related tests.

What it does

PR Guardian AI is a repository-aware pull-request review tool.

A developer submits a GitHub PR URL through the dashboard. Instead of reviewing only the diff, PR Guardian:

  • Fetches repository context
  • Parses imports, symbols, and code chunks
  • Builds a dependency graph
  • Identifies direct dependencies and affected callers
  • Finds related test files
  • Generates a structured review with risk score, findings, evidence, and suggested tests

The dashboard also shows review history with job IDs, status, timestamps, and completed reports.

How we built it

PR Guardian AI uses an asynchronous distributed architecture:

  • Next.js dashboard for PR submission, review history, and results
  • Express API to accept requests and create review jobs
  • Redis and BullMQ for durable background job processing
  • Separate review worker and repository indexer services
  • PostgreSQL with pgvector to persist repository metadata, code chunks, and dependency relationships
  • A configurable AI review provider with Gemini, Groq, and OpenAI provider support

The API returns immediately while workers build repository context in the background. The dashboard polls job status so users can follow long-running reviews without blocking the browser.

I used Codex with GPT-5.6 as an engineering collaborator to design the system, implement the API/worker/indexer split, create the persistent repository index, add review history, integrate model providers, debug Docker and queue issues, and write automated tests.

Challenges we ran into

The biggest challenge was supporting large repositories. Small repositories can be indexed quickly, but projects such as n8n contain tens of thousands of files.

We learned that a full-repository index requires careful file filtering, size limits, binary-file handling, PostgreSQL batching, and clear progress reporting. We also encountered model-provider configuration issues and Docker networking/CORS problems while connecting the dashboard, API, workers, Redis, and PostgreSQL.

These problems helped shape the fallback behavior: if an AI provider is unavailable, PR Guardian still produces an honestly labelled deterministic review based on the diff and dependency graph.

Accomplishments that we're proud of

  • Built a working asynchronous PR review workflow
  • Created separate API, worker, and indexer services
  • Added persistent repository indexing with PostgreSQL and pgvector
  • Added review history with running, failed, and completed job states
  • Added dependency-aware impact analysis instead of diff-only review
  • Added structured findings, evidence, risk scoring, and suggested tests
  • Added automated API, parser, graph, provider, and repository-index tests
  • Used Codex and GPT-5.6 to accelerate architecture, implementation, debugging, and validation

What we learned

We learned that useful developer AI tools need more than a strong model. They need reliable repository context, clear asynchronous workflows, observable job status, safe fallback behavior, and an architecture that can scale independently across API, indexing, and review workloads.

We also learned that large repositories need incremental clone-based indexing rather than repeatedly downloading and parsing the entire repository for every PR commit.

What's next for PR Guardian AI

Next, we plan to add:

  • Clone-based incremental repository indexing for large repositories
  • Progress reporting such as files fetched, parsed, and indexed
  • GitHub App and webhook integration
  • PR comments directly on GitHub
  • Team authentication and organization-level repository settings
  • Permanent review audit history in PostgreSQL
  • More advanced semantic retrieval and test-impact analysis

Built With

Share this project:

Updates