Git Reviews — User Guide

Audience: Data platform teams who want AI-assisted code review on GitHub PRs for SQL, dbt, PySpark, YAML, and data contracts—before bad changes merge.

In the docs sidebar this page appears as Git Reviews (AI on PRs). Route: /git-reviews (often under Build in the app).

Related: align review behaviour with org standards using Agent Intelligence & Skills (rules, lessons, SQL style skills).


Why Git Reviews matter

Pipeline Building Pipelines catches failures at run time. Git Reviews add shift-left feedback: every PR touching critical paths can get a structured review comment from a specialist or Super agent, aligned with your custom instructions (style, compliance, performance).


Where to find it

  • Route: /git-reviews
  • Navigation: commonly under Build → Git Reviews
  • Requires connected repositories so configs can target a repo.

Configuration list

UI element Purpose
New Review Config Start the create dialog
Row: status icon Green = active, grey = paused
Row: name + subtitle Human label; repo, events, total reviews
Pause / Activate Flip is_active without deleting history
Delete Removes config + history (confirm)
Click row Opens detail: metadata, Webhook URL, review history

Empty state: Explains the feature with CTA to create first config.


Create configuration (form)

Field Guidance
Name Required; use team-readable id like “dbt-prod-review”
Repository Pick from workspace-connected GitHub repos
Review agent Super Agent (agent_team) for breadth; dbt, metadata_discovery, spark_developer, data_cleaner for focus
Target branches Combobox; defaults often main, dev—add release branches
File patterns Globs: *.sql, *.py, *.yml, *.yaml, etc.
Custom instructions Free-text rules: naming, test coverage, PII, performance
Auto-post comment If on, review text is posted to GitHub automatically

On create, backend stores config and returns webhook id + secretWebhook Info dialog immediately.


Webhook setup (GitHub)

  1. Repo Settings → Webhooks → Add webhook.
  2. Payload URL — copy from Dagen (must match generated id).
  3. Content type: application/json.
  4. Secret — copy from Dagen; GitHub sends X-Hub-Signature-256 HMAC-SHA256.
  5. Events: Pull requests (and only what you need).

Dagen rejects bad signatures, stale replays, and filters by event action, branch, and file patterns before spawning work.


Review pipeline (what happens on each PR)

  1. GitHub POSTs to /api/git-review/webhook/<webhook_id>.
  2. Signature verified; event filtered.
  3. GitReview record created (pendingrunning).
  4. Background work: fetch PR diff + file list from GitHub API.
  5. Filter files by patterns.
  6. Build prompt: PR metadata + diff + custom instructions.
  7. Run get_agent(agent_id).run(prompt).
  8. Parse agent output → summary, issue count, body.
  9. Post PR comment via GitHub API (if auto-post enabled).
  10. UI history row updated; link to GitHub comment.

Review history table

Column Meaning
PR #number + title (link out)
Author GitHub login
Status Chips: completed, running, pending, failed; GitHub icon if comment posted
Issues Count agent reported
Files Count reviewed after pattern filter
Duration Seconds
Time Relative

Detail dialog: markdown-friendly body, View PR, metadata (branch flow, counts).


API surface (for operators)

Method Route Auth Role
POST /api/git-review/webhook/<id> HMAC GitHub only
GET/POST/PUT/DELETE /api/git-review/configs UI session CRUD configs
GET /api/git-review/configs/:id/reviews UI session Paginated history
GET /api/git-review/configs/:id/secret UI session Fetch URL + secret for GitHub UI

These are not the same as External API keys—webhooks use HMAC, not X-API-Key.


Troubleshooting

Symptom Check
No deliveries GitHub webhook Recent Deliveries; URL reachable from internet
401/403 on webhook Secret mismatch; rotate secret in GitHub + Dagen
Reviews wrong scope Branches + file patterns
Agent timeout Large diffs—tighten patterns or use focused agent
Comment not posted Auto-post off? GitHub token scopes?

Related