PR review
Bayes is Monte Carlo’s AI teammate. It observes your agents and the data that powers them, finds what breaks, proposes and verifies fixes, and gets better at your environment over time.
Bayes reviews pull requests (including dbt changes) for data-reliability risk and posts its findings on the PR. It looks at PRs that modify data models, pipelines, or transformations. Unlike generic code reviewers, it uses Monte Carlo observability data (lineage, active alerts, asset importance, and monitor coverage) to assess the real production impact of code changes.
Bayes' PR review is part of MC Prevent, which also covers the CI merge gate. See that page for full setup. The MC Prevent suite also includes the Code Change skill.
How it works
When a PR is opened in an enabled repository, or someone comments mc review on it, Bayes runs a multi-step analysis:
-
Code risk factor extraction — Analyzes the PR diff to identify column-level changes (added, removed, renamed, modified), upstream reference changes, and potentially risky code patterns. Each finding gets a risk and confidence score.
-
Downstream impact analysis — Traces Monte Carlo lineage to identify which tables, BI reports, and downstream consumers would be affected by the changes.
-
Risk assessment — Assigns a risk tier (Low, Medium, or High) to each affected Monte Carlo asset based on:
- Breaking changes detected in the code
- Active Monte Carlo alerts on modified or upstream assets
- Downstream blast radius
- Write query volume on affected tables
- Monitor coverage gaps
-
PR comment — Posts a structured comment on the PR organized by change group — related changes are merged and sorted by risk and blast radius. Each group includes its own alert breakdown, diff links, and downstream counts. Key assets are marked with a star so your most important tables are impossible to miss. A thumbs-up/down reaction footer lets you give feedback on each review.
Risk scoring
When Bayes reviews a PR, it produces an overall risk score using configurable weight categories:
| Category | Default weight | What it measures |
|---|---|---|
| Code review findings | 40% | Risky code patterns, breaking changes, schema modifications |
| Lineage blast radius | 15% | Number and importance of downstream assets affected |
| Open alerts | 15% | Active Monte Carlo alerts on assets in the change's path |
| Monitoring gaps | 15% | Unmonitored assets in the blast radius |
| Schema/contract changes | 10% | Breaking schema changes or interface contract violations |
| Asset criticality | 5% | Business importance score of affected assets |
Review types
| Review type | What's included | Cost |
|---|---|---|
| Free review | Risk score and high-level summary on every PR | No charge |
| Full review | Specific risky code sections, detailed suggested fixes, auto-generated SQL validation queries, and coverage gap suggestions | Charged |
Turning on PR review
Automatic trigger
Bayes reviews a PR automatically when it is opened in a repository that is in your allowlist, including PRs opened as drafts. Pushing new commits, reopening the PR, or marking a draft ready for review doesn't start another review. Comment mc review to review it again.
Choose the repositories in Settings > PR agent (for GitLab, choose projects). The Auto-review toggle on the same page controls automatic reviews. When it's off, Bayes reviews a PR only when someone comments mc review.
PR review requires the
pr_agentfeature flag to be enabled on your account. Existing GitHub integration customers need to reauthenticate to use this feature.
Manual trigger
Comment mc review on any PR in an enabled repo to have Bayes review it manually. The comment must contain only mc review (spaces around it and capitalization don't matter).
Manual reviews need unrestricted usage. If your account is limited to free usage, mc review doesn't start a review. On GitHub, Bayes replies to the comment that on-demand review isn't available. On GitLab, the comment is ignored.
Limiting reviews to some environments
The allowlist works per repository (per project for GitLab). It can't be limited to particular branches, folders or environments. If your dev, QA and production code live in one repository, Bayes reviews PRs for all of them.
To review only some PRs in such a repository, turn off Auto-review and comment mc review on the PRs you want reviewed. This needs unrestricted usage, because Auto-review can't be turned off while the account is limited to free usage.
Configuration
Configure PR review in Settings > AI Agents:
- Unrestricted — Full reviews on all PRs in enabled repos
- Free-only — Free reviews only (risk score and summary, no detailed findings)
Validation notebooks
When Bayes detects dbt SQL changes in a PR, it can automatically generate a SQL Notebook containing targeted validation queries to verify the change behaved as intended. These queries cover null checks, distribution analysis, before/after row counts, and other verifications specific to the columns and logic modified in the PR.
CI merge gate
The risk assessment from Bayes' PR review feeds into the CI merge gate, which can enforce merge gating based on the risk score. The CI merge gate is available as a GitHub Action (monte-carlo-data/mc-prevent-action) or CircleCI orb (monte-carlo-data/mc-prevent-orb).
Gate policy options:
| Policy | Behavior |
|---|---|
low+ | Block all PRs with any risk |
medium+ | Block medium and high risk (default) |
high+ | Block only high-risk PRs |
none | Show results without blocking |
Teams can add the mc-override label to bypass the gate for a specific PR.
Security & data privacy
When Bayes reviews a PR, it reads code diffs from GitHub and correlates them with Monte Carlo metadata (lineage, alerts, monitor coverage). It does not access the actual data in your tables. For more detail on security and data privacy, see the AI Features and Technical Information documentation.
Updated 4 days ago
