---
title: "Code review"
description: "Enable automated GitHub pull request reviews, configure built-in Review and Security Guardians, write custom charters, and resolve inline findings."
url: "https://www.thecompany.company/docs/code/code-review"
---

# Code review

> Enable automated GitHub pull request reviews, configure built-in Review and Security Guardians, write custom charters, and resolve inline findings.

Automated code review inspects GitHub pull requests before they merge and leaves inline findings directly on the diff. Each enabled **Guardian** runs a focused review charter to catch bugs, regressions, and security issues on every push.

## Repository settings [#repository-settings]

In **Settings → Reviews**, an organization owner or admin chooses which [connected GitHub repositories](/docs/code/repositories) receive automated reviews and when they run:

| Setting | Behavior |
| --- | --- |
| **Auto** | Reviews when a PR is ready for review and again after each new push. |
| **When ready** | Reviews once when a PR opens ready for review or leaves draft. |
| **Off** | No automated review runs for that repository. |

![Settings › Reviews with a review mode for each repository](https://www.thecompany.company/docs/screenshots/light/reviews-settings.webp)

Pick when each repository gets reviewed.

If your organization requires subscription-backed models, the reviewing account needs a connected subscription it can use.

## Guardians [#guardians]

A **Guardian** is a review charter that defines what automated reviews look for and which file paths they cover. Two built-in Guardians ship with every workspace:

- **Review** (enabled by default): Flags correctness bugs, regressions, and edge cases.
- **Security** (off by default): Flags security-sensitive regressions on GitHub pull requests.

You can toggle and configure built-in Guardians, or create custom charters for team-specific invariants such as migration safety, API compatibility, or missing regression tests.

### Create a custom Guardian [#create-a-custom-guardian]

1. ### Open Guardians [#open-guardians]

   In **Settings → Reviews**, find **Guardians** and select **New guardian**.
2. ### Define what to flag [#define-what-to-flag]

   Name the charter and describe concrete failure conditions in **What to flag**, including the evidence each finding should cite (file, line, and breaking behavior).
3. ### Scope paths and model [#scope-paths-and-model]

   Add up to 20 path patterns (one per line) in **Scope**, or leave it empty to cover the whole repository. Optionally override the organization's default review model, then save.

> Review billing migrations for compatibility with the prior app version. Flag only reproducible problems—for each one, name the line, deployment order that triggers it, and behavior that breaks.

### Tune charters [#tune-charters]

Test a new charter on a few real pull requests before broadening it. If a Guardian reports style noise instead of real defects, list what to ignore in **What to flag**; if it misses an invariant, add a concrete example or narrow **Scope**. Keep independent concerns in separate Guardians so you can enable, tune, or pause each one on its own.

## Security review [#security-review]

Turn on the built-in **Security** Guardian in **Settings → Reviews**, or add a custom security charter tailored to your architecture:

| Risk area | What to flag |
| --- | --- |
| **Secrets and credentials** | Hardcoded secrets or code paths that log, return, or serialize secret values (cite the location without quoting the value). |
| **Authentication and authorization** | Routes or handlers missing identity, role, or tenant authorization checks. |
| **Injection and untrusted input** | Unvalidated or unescaped input reaching queries, shell commands, or rendered HTML. |
| **Data flow** | Sensitive data crossing trust boundaries or leaking into logs, responses, or client bundles. |
| **Dependencies** | Dependency changes introducing unnecessary privileges or removing existing protections. |

> Review changes to request handlers for missing tenant authorization. Cite the changed line and missing check—never quote credentials or guess about unverified paths.

Guardians review pull request diffs—they complement, rather than replace, dependency scanning, secret scanning, runtime tests, and GitHub branch protection. If a review flags a committed credential, [rotate or revoke it immediately](/docs/code/secrets#keep-secret-values-out-of-output); removing it from the diff is not enough.

## Inline findings and merge checks [#inline-findings-and-merge-checks]

> Read the unresolved review threads on this PR. Separate required code fixes from questions we can answer without editing. Don't comment or edit yet.

- **Inline threads:** Findings appear on the GitHub diff with line anchors. After pushing a verified fix, reply in the thread with what changed and the verification you ran, and leave unresolved findings open.
- **Merge gates:** Guardian reviews do not submit a GitHub **Request changes** review. Verify the current PR head along with GitHub's separate required checks, approvals, and branch protection rules before merging.

## Next steps [#next-steps]

- [Pull requests](https://www.thecompany.company/docs/code/pull-requests.md): Fix CI checks, respond to review threads, and manage stacked PRs.
- [Repositories](https://www.thecompany.company/docs/code/repositories.md): Connect GitHub repositories and configure Git attribution.
- [Secrets](https://www.thecompany.company/docs/code/secrets.md): Store credentials safely as encrypted environment variables.
- [Automations](https://www.thecompany.company/docs/agent/automations.md): Trigger custom GitHub event workflows alongside reviews.
