Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devex): turn on coderabbit reviews and gate the signed-out cli (#99878)

Georges-Antoine Assi380759cef660
diff --git a/.agents/skills/reviewing-with-coderabbit/SKILL.md b/.agents/skills/reviewing-with-coderabbit/SKILL.md
index 5af2325783c3..27d445ac3378 100644
--- a/.agents/skills/reviewing-with-coderabbit/SKILL.md
+++ b/.agents/skills/reviewing-with-coderabbit/SKILL.md
@@ -3,9 +3,11 @@ name: reviewing-with-coderabbit
description: >
Run a CodeRabbit review over the branch from the terminal, with the `coderabbit` CLI, and record the
pass in the PR description. Use before `gh pr create`, and whenever a review of a branch is asked for:
- a local review, a self-review, a CodeRabbit review, or a pre-PR review. Run it once per branch. When the
- CLI is unavailable, the PR opens without a local pass, and no agent review takes its place.
- Trigger terms: coderabbit, cr review, local review, self-review, review my branch, pre-PR review.
+ a local review, a self-review, a CodeRabbit review, or a pre-PR review. Run it once per branch. Checks
+ the sign-in state before the review and asks the person whether to sign in or skip, because a
+ signed-out review opens a browser tab on its own. When the CLI is unavailable, the PR opens without a local pass, and no
+ agent review takes its place. Trigger terms: coderabbit, cr review, local review, self-review, review
+ my branch, pre-PR review.
---
# Reviewing with CodeRabbit
@@ -19,7 +21,7 @@ It still takes time and rate limits still apply, so run it once per branch, afte
## Never substitute an agent review
-If the CLI is absent, signed out, or rate limited, **say so and continue to `gh pr create`**.
+If the CLI is absent or rate limited, or the person chooses to skip the review, **say so and continue to `gh pr create`**.
The PR opens without a local pass.
Do not run `/code-review`, review subagents, or a fan-out over the diff in its place.
@@ -28,7 +30,7 @@ The CodeRabbit run is covered by our plan; an agent review of a large diff bills
## Setup
For a person at the terminal, once per machine.
-An agent never runs these commands: sign-in opens a browser.
+An agent never runs the sign-in command: it opens a browser.
Flox activation installs the pinned CLI and puts `coderabbit` and `cr` on PATH.
Outside flox, install it with `brew install coderabbit`.
@@ -45,7 +47,29 @@ cr auth status # confirms the session and the organization
1. Finish the work and commit.
The review reads the branch, so uncommitted edits need the matching change-scope flag (`cr review --help` lists them).
-2. Run the review, scoped to the branch's base:
+2. Check the sign-in state before any review command:
+
+ ```sh
+ cr auth status --agent
+ ```
+
+ It prints one JSON line and never opens anything.
+ `"status":"authenticated"` means continue to step 3.
+ `"status":"not_authenticated"` means stop here and ask the person.
+
+ Do not run `cr review` while signed out.
+ It starts the OAuth login itself: it opens a browser tab at the CodeRabbit sign-in page and blocks until the person completes the login or the command times out.
+ Ask the person which they want, with `AskUserQuestion` when it is available and a plain question otherwise:
+
+ - **Sign in and run CodeRabbit.**
+ The person runs `cr auth login` themselves (`! cr auth login` in Claude Code), then tells you it is done.
+ Re-run `cr auth status --agent` to confirm, then continue to step 3.
+ - **Skip it this time.**
+ Skip to step 6, which records why, and continue from there.
+
+ When nobody can answer, in an unattended run, skip it and record that.
+
+3. Run the review, scoped to the branch's base:
```sh
cr review --agent --base master
@@ -56,16 +80,21 @@ cr auth status # confirms the session and the organization
`cr review findings` reprints the last run's findings, so re-reading them costs no review.
On a stacked branch, pass the layer's own base rather than `master`, so the review covers this layer alone.
-3. Verify each finding's premise against the code before you act on it.
+4. Verify each finding's premise against the code before you act on it.
Findings can be false positives, and rejecting one with a reason is a valid outcome.
-4. Fix what holds, and commit the fixes.
-5. Record the pass under Agent context in the PR description, as the PR template asks: that the CLI ran, and each finding's disposition.
-6. Continue the normal flow: `hogli ci:preflight`, then `gh pr create`.
+5. Fix what holds, and commit the fixes.
+6. Record the outcome under Agent context in the PR description, as the PR template asks.
+ After a run, that is each finding's disposition.
+ After a skip, that is why: the CLI was absent, signed out, rate limited, or the person chose to skip.
+7. Continue the normal flow: `hogli ci:preflight`, then `gh pr create`.
+
+## After the PR opens
-## After `@coderabbitai review`
+`auto_review` is on in `.coderabbit.yaml`, so a review posts once when the PR opens, drafts included.
+`base_branches` is set to every branch, so a stacked layer gets one too, not only a PR into master.
+It does not re-review a later push, so comment `@coderabbitai review` when you want a second pass over the fixes.
-`auto_review` is off in `.coderabbit.yaml`, so no review posts when a PR opens.
-Comment `@coderabbitai review` on the PR to ask for one, then handle its threads like CLI findings:
+Handle the posted threads like CLI findings:
- List the unresolved, non-outdated threads whose root comment is by `coderabbitai[bot]`.
`gh api graphql` over `pullRequest.reviewThreads` returns `isResolved`, `isOutdated`, `path`, and `line`.
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
index 3d4864cd486e..a7900511641e 100644
--- a/.coderabbit.yaml
+++ b/.coderabbit.yaml
@@ -9,19 +9,30 @@ reviews:
# Surface only the highest-signal feedback.
profile: 'quiet'
- # Keep the trial silent until PostHog is ready to begin the rollout.
+ # The review lands as comments only. These surfaces mirror Greptile's
+ # statusCheck and statusCommentsEnabled, both off, so neither bot adds a
+ # check the merge queue has to wait on.
review_status: false
review_progress: false
commit_status: false
poem: false
auto_review:
- enabled: false
+ enabled: true
+
+ # One review per pull request, as Greptile's triggerOnUpdates does.
+ # Re-review after a fix costs a run and repeats findings already handled.
auto_incremental_review: false
- # Draft PRs will be eligible when automatic reviews are enabled later.
+ # Most agent-authored pull requests open as drafts, which is where the
+ # findings are cheapest to act on.
drafts: true
+ # Without this, only pull requests into the default branch are reviewed,
+ # so every layer of a stack above the first would be skipped.
+ base_branches:
+ - '.*'
+
# Content rules shared with Greptile (.greptile/config.json "instructions"), so the two reviews can be compared.
path_instructions:
- path: '**/*'
diff --git a/.github/scripts/trunk-impacted-targets.js b/.github/scripts/trunk-impacted-targets.js
index aa0e8c346a9e..b8bb9821dd55 100644
--- a/.github/scripts/trunk-impacted-targets.js
+++ b/.github/scripts/trunk-impacted-targets.js
@@ -886,6 +886,7 @@ const REPO_CONFIG_DIRS = [
// .dockerignore and the .env files are deliberately not here. Both are read by
// something that every suite runs inside, and both are tripwires above.
const REPO_CONFIG_FILES = [
+ '.coderabbit.yaml',
'.cursorignore',
'.cursorrules',
'.editorconfig',
diff --git a/.github/scripts/trunk-impacted-targets.test.js b/.github/scripts/trunk-impacted-targets.test.js
index f1984879ea4e..01c44910e82c 100644
--- a/.github/scripts/trunk-impacted-targets.test.js
+++ b/.github/scripts/trunk-impacted-targets.test.js
@@ -1039,6 +1039,7 @@ test('editor and agent configuration shares one lane', () => {
'.trunk/trunk.yaml',
'.trunk/.gitignore',
// The same class of file, one per root path rather than one per tree.
+ '.coderabbit.yaml',
'.cursorignore',
'.editorconfig',
'.gitattributes',
diff --git a/owners.yaml b/owners.yaml
index 17691bc08313..0f7ee970d369 100644
--- a/owners.yaml
+++ b/owners.yaml
@@ -43,6 +43,7 @@ rules:
- tach.toml
- CLAUDE.md
- AGENTS.md
+ - '/.coderabbit.yaml'
- '/.greptile/'
# Every owners.yaml routes to devex (unanchored: matches at any depth)
# unless a nearer file or rule claims it — ownership-policy edits must