CodePanel
Merge gate

Merge gate

Block merges while findings are unanswered: the CodePanel commit status, gate levels, and a GitHub Actions alternative with a CI token.

On this page›

CodePanel posts a CodePanel commit status on each pull request it reviews. The status fails until every finding at or above the repository's gate level is fixed or answered, so a coding agent or a person can see the work is not finished. Make it a required check to block merging.

Answered findings

A gated finding stops blocking once a round resolves it, it is dismissed, or it has a verdict (fixed, deferred, or a rebuttal) given after the last round that reported it. Below critical, a deferred or a decided dispute also stands when a later round reports the finding again; a fixed does not. An agent's rebuttal counts only once the orchestrator withdraws or revises the finding. On a critical finding, an agent's fixed or deferred does not answer it on its own: fixed counts once the next round confirms it by not reporting the finding again, and deferred needs a person with write access. Comments answer findings only from people with write access (who may give commands). The full rule is in What counts as answered.

Gate levels

Set the level per repository under Settings → Review gate, or with gate in the API, MCP's update_repo_settings or codepanel repos set --gate. An API token, which is what those three run on, can raise the level but not lower it; see Who can loosen the gate.

Level Must be answered
critical Critical findings
warning_high Critical findings, and warnings the orchestrator rated high confidence
warning (default) Critical findings, and every warning not rated low confidence
all Every finding, suggestions and low-confidence warnings too
off Nothing. CodePanel stops posting the status, after one last pass that clears any failure

At warning, a warning the orchestrator rated low confidence does not hold the merge. The review comment still shows it, with "low confidence" in its heading, and nextAction asks the agent to verify and rate it, not to fix it. Low-confidence warnings turned out to be wrong most of the time: of the 72 that got a verdict CodePanel could check, on its busiest repository in the 14 days to 2026-10-23, 66 were false positives. To have them block, set the level to all. A critical always blocks, whatever its confidence.

At warning_high, a warning blocks only at high confidence; medium and low confidence warnings still post, with a Not blocking: line, and nextAction asks the agent to verify and rate them. Use it when agents spend rounds on warnings that turn out wrong. A critical blocks at every level but off.

A finding at the gate level that does not hold the merge carries notBlocking in the review payload, one sentence saying why, and the review comment prints Not blocking: <reason> under its heading. Nothing is hidden: it is posted, rated and answered like any other.

Status behaviour

Situation CodePanel status
A round is reviewing this commit Pending
Reviewed, a gated finding has no answer Failure, naming the findings, for example "2 findings need a fix or /feedback: F1, F4"
Reviewed, every gated finding is answered Success
Every gated finding is answered, but an agent rated one below critical fixed before pushing the fix Pending, "Waiting for the pushed fix (or 3 min) before a fixed counts: F2", until a newer commit arrives or 3 minutes pass. Then success, unless the round on the new commit finds more
An answer or dismissal arrives later Updated within seconds on the last commit CodePanel judged
The review of this commit failed or was refused (credits, plan, a spending limit, keys) Judged on the findings the pull request already has, with reviews paused
A pull request CodePanel does not track and will not review (a bot author, the triggers, automatic review off), unless it is a draft Success: "Not reviewed: . Nothing from CodePanel blocks this commit"
A new pull request CodePanel does not review because the account is past its plan's monthly pull requests (plan_limit) Judged on the findings the pull request already has
A push past the round limit Judged on the findings the pull request already has. Success: "Not reviewed: round limit reached; answered state carried from , nothing is unanswered", and rounds.capped is true
A push CodePanel does not review for another reason (triggers, automatic review off) Judged on the findings the pull request already has
  • When only suggestions are open (at any level but all), the comment says so and payload.nextAction is rate, whose reason says not to push a commit for suggestions alone, since every push starts another round. A push after such a round runs a light round: only the Bugs & Security reviewer, plus whichever reviewer raised an open finding in a file the push changes. It still reads the new code, so the status is never carried over from the commit before it.
  • An agent's fixed counts once its fix is pushed. Rated before the push, it holds the status pending on the commit CodePanel judged until a newer commit arrives or 3 minutes pass, so GitHub auto-merge cannot land the commit without the fix. payload.nextAction is fix meanwhile, telling the agent to push. A person's fixed, and deferred or a dispute, are not held. In a merge queue such a pull request fails its group ("waits for the push of 1 fix rated before it") rather than holding the queue, since the push takes it out of the queue anyway. The step-back notice (Round limits) never changes the status either, unless the repository escalates on it.
  • A finding whose file, line or code is gone at a round's head is resolved by the anchor check, so a deleted file cannot keep a critical blocking. A down rating with no verdict does not answer a finding; nextAction says so and names the verdicts that dispute it (Disputes).
  • A suggestion a round after the first held back never blocks, at any level: it was not posted, so nobody is asked to answer it.
  • A failed review never blocks a merge on its own, so an outage on the reviewer's side does not hold your team up.
  • Every commit CodePanel declines or fails to review still gets a status, so a required check never waits on a review that is not coming. In the 60 seconds before a push is reviewed, the new commit has no status yet.
  • If GitHub never delivers a pull request's webhook, or a status post fails, CodePanel catches up on its own. Every 10 minutes it checks each repository's open pull requests updated in the last day, at least 5 minutes after their last update. It starts the review the webhook should have started, with the usual triggers and round limits, or reposts the status. A round started this way has startedBy: "reconciler" in GET /api/review.
  • Changing the gate level reposts the status on the repository's 50 most recent pull requests straight away. Older pull requests pick it up at their next review, answer or push.

Reviews paused

While no round can run (out of credits, no plan, a spending limit, a missing key, or a failed round), nothing can confirm an agent's answer, so the gate takes it as given: an agent's fixed or deferred on a critical, and a dispute the orchestrator has not decided, count as answers. The status reads "Not reviewed: reviews are paused, so agent answers count as given; nothing is unanswered". A finding nobody answered still fails it, and so does a dispute the orchestrator upheld. The next round that completes ends the pause and judges its own commit as usual. Reaching the automatic round limit is not a pause: the author's own pushes reach it, and the head it keeps from review passes once the findings already reported are answered. A /review comment (from anyone, since an agent's comes from the same GitHub login) and an API trigger past it are refused, except one round to confirm an agent's fixed or deferred on a critical, which nextAction trigger asks for. Raising the limit or Review now on the dashboard still runs a round.

A dispute is bounded the same way. If the orchestrator has not decided it 4 minutes after it was made, for any reason (a budget limit, no key, not enough credits, a failed call), it counts as an answer, and dispute.lapsedAt in get_review says when. A decision that lands while the pull request is still open applies: an upheld dispute blocks again. Your repository's process never depends on CodePanel being able to run.

Fix check past the round limit

Once a pull request reaches its automatic round limit, no round reads its new commits, so an agent's fixed on a warning answers it with nothing to check the fix. A repository can turn on a fix check with the review switch REVIEW_CONFIRM_FIXES (off by default): update_repo_settings with "reviewSwitches": {"REVIEW_CONFIRM_FIXES": true}, POST /api/v1/repos/settings, or codepanel repos set owner/name --switches REVIEW_CONFIRM_FIXES=on.

With it on, a few minutes after an agent rates a gated finding below critical fixed, or pushes past the limit, one model call reads each claimed fix: the finding, and its file's code where the finding was reported and at the head. It reports nothing new. For each finding it answers:

  • confirmed: the finding is resolved at the head, as a round would resolve it.
  • not confirmed: the agent's fixed stops counting while that commit is the head, so the finding fails the status again as it did before the rating. payload.nextAction is fix and names it. Fix it and push (the rating counts again on the new head, which gets its own check), or dispute it with /feedback F3 down false-positive <why>, which the orchestrator decides as any dispute.

The check can only hold a merge that would otherwise pass: without it the agent's fixed already answers the finding, and a confirmed verdict passes it the same way. The code it reads is the pull request author's, so a confirmed is the model's reading of that code, not a person's review. A finding with a stored verdict is not checked again at that head. A call that fails, is refused (a spending limit, no plan, no working key) or gives no readable answer for a finding stores nothing, so the agent's fixed stands as it would with the switch off, and a later rating or push on the same head can ask again. Criticals are not checked: a fixed critical still needs a round. Each verdict is on the finding in GET /api/review as fixCheck (sha, outcome, reason, model, at), and CodePanel replies on the pull request with one line per finding. The call is recorded as an orchestrator call on the pull request, so it counts toward the per-PR limit and the month.

Auto-approve

Off by default. Turn it on per repository with Approve when the gate passes under Settings → Review gate. Only the dashboard turns it on: an approving review can satisfy branch protection's required review, so an agent holding an API token must not be able to approve its own pull requests. A token turns it off with "autoApproveOnPass": false in POST /api/v1/repos/settings, MCP's update_repo_settings or codepanel repos set --auto-approve off; true is refused with 403, as described in Who can loosen the gate.

While it is on, a round that leaves the CodePanel status passing with no open warning or critical finding also posts an approving GitHub review; open suggestions are counted in its body but do not hold it back. When a later round blocks, CodePanel dismisses that approval with a message naming the round. Approval is best-effort: a failed post never stops the review. Turning the setting off posts no new approvals; an approval already posted stays until someone dismisses it on GitHub.

Convergence switches

Four repository switches change how a pull request settles once the gate has passed. Each is off unless set, and doneWarnsPush is retired: its note is now always on. They exist to cut the rounds agents spend after the first green status; convergence in GET /quality measures them.

Switch Effect when on
settleAfterGreen Once a head has passed the gate, a later round's finding holds the merge only if it is critical or within 5 lines of a line changed since that green head. A file changed without a patch counts as changed throughout. Other findings post with notBlocking set
orchestratorAdvisory A finding no reviewer reported, one the orchestrator wrote itself, does not hold the merge unless it is critical
disputeLearnings A candidate learning becomes active, with state.by disputes, once the orchestrator has conceded agents' false-positive disputes whose note cites it by ref (such as L12) on 3 different pull requests. Each finding's file must be in the learning's scope, and the pull request the learning came from does not count. list_learnings shows the disputes as conceded
doneWarnsPush Retired, and ignored if set. Every nextAction done whose next push would start an automatic round now ends its reason with a note to stop. Where a push is not reviewed (auto-review off, or past the round limit) there is no note

Set them with convergence in POST /repos/settings, MCP's update_repo_settings or codepanel repos set. true turns one on; false or null turns it off. A token may set all four. warning_high, settleAfterGreen and orchestratorAdvisory narrow what blocks, so they are the changes a token makes that a lower gate would not be allowed to.

Who can loosen the gate

The agent the gate holds should not be able to lower it. So an API token, whether a cpk_ token, the CLI's login or an MCP connection, can tighten a repository's merge protections but not loosen them. These are refused with 403 (code: "forbidden"):

  • lowering gate, including to off. Setting warning_high is allowed from a stricter level (warning or all): it narrows what blocks without turning review off;
  • adding an App to trustedBotAuthors;
  • removing an escalation contact, or clearing escalation;
  • turning crossFamilyReview off or clearing it;
  • turning autoApproveOnPass on.

The refusal names what it refused, in the message and in fields, and applies nothing else from the same update. Its nextAction is the repository's Settings tab in the dashboard, where a person signed in in the browser makes the change. The reverse of each, and every other setting, is still a token's to change, so an agent can set a repository up and tighten it without anyone.

Escalate to a person

Some findings no agent can settle. A repository can name up to five people to hand those to, with the escalation setting: POST /api/v1/repos/settings {"repo":"owner/name","escalation":{"contacts":["alice","bob"]}}, MCP update_repo_settings, or codepanel repos set owner/name --escalate-to alice,bob. Without it, which is the default, nothing on this page changes.

A gated finding with no answer is escalated when the first of these applies (triggers; upheld_critical and round_limit unless you list them, since step_back hands over warnings too and novel rests on a model's judgment):

Trigger When
upheld_critical The author disputed a critical, the orchestrator upheld it, and it is still not fixed
round_limit The pull request reached its automatic round limit with a critical still unanswered
step_back The step-back notice is showing: every unanswered gated finding is escalated
novel The orchestrator judged a warning or critical a decision for a person rather than a fix: a security boundary, data loss, a product or pricing call, or an irreversible migration. Only while the REVIEW_NOVEL_ESCALATION review switch is on for the repository; it is off by default

Nothing is escalated while a round runs, while a dispute waits for the orchestrator, with the gate off, or once the pull request is merged or closed. Then:

  • payload.nextAction is escalate, naming the findings, once every blocking finding left is escalated; the author agent is told not to push or dispute for them. Findings beside them that are not escalated stay fix, and the reason names the escalated ones.
  • payload.escalation says which trigger fired, the refs, the contacts, a one-sentence reason with the evidence, and notifiedAt. For novel it adds needsPerson: each finding's ref, its category (security_boundary, data_loss, product_decision or irreversible_migration) and the orchestrator's reason.
  • The status reads, for example, "Needs a person (@alice): F3; +1 more need a fix or /feedback".
  • CodePanel posts one comment on the pull request mentioning the contacts, naming each finding with its severity and the evidence (for novel, the category and the orchestrator's reason), and saying how to answer. A finding escalated later gets a new comment; one already asked about does not.

A person answers from an account with write access with /feedback F3 up fixed, /feedback F3 up deferred, or /feedback F3 down false-positive <why>. Escalation never changes what counts as an answer: these are the same verdicts the gate already takes from a person, through /feedback, the API or MCP rate_finding. A novel mark is the orchestrator's judgment, made again each round: a round that re-reports the finding without it clears it. Turning the repository's switch off stops novel at once. Clear the setting with "escalation": null or --escalate-to none.

Require the status

Step 1: Keep the gate on

Leave the gate level at anything but off. CodePanel posts the status once a pull request has been reviewed.

Step 2: Add the required check

In the GitHub repository, add CodePanel as a required status check in your branch protection rules or ruleset. GitHub lists it once it has been posted at least once.

GitHub App permission

CodePanel posts the status with the same identity it posts reviews with. A user token needs nothing extra. A GitHub App needs the Commit statuses: Read and write repository permission, and installations created before the permission was added must accept it. Until they do, reviews carry on without the status, and CodePanel says so where the gate is read:

  • The review comment replaces its gate sentence with what to accept.
  • gate.status in GET /api/review is missing_permission.
  • The repository shows Status not posting on the dashboard.

Once the permission is accepted, CodePanel drops its cached app token and the status posts on the next change.

Merge queues

In a GitHub merge queue, CodePanel also posts CodePanel on each merge group's head commit, so a ruleset with a merge queue can require it.

Merge group CodePanel status
Every pull request in it passes the gate on the head it was queued with Success, listing them, for example "Every pull request in this group passes the gate: #12, #14"
A pull request in it is blocked Failure, naming each one and why, for example "Blocked: #14 has 2 unanswered findings"
A pull request's head moved after it was queued Failure, "has no verdict on" the queued commit, even when the new head passes
A pull request in it is still under review, or CodePanel has no review of it Failure, naming it
CodePanel did not record the head a pull request was queued with (it was queued before CodePanel received the queue event) Failure, "queued head is unknown": queue it again
CodePanel cannot tell which pull requests the group holds Failure, "Could not tell which pull requests this merge group holds"
The gate is off Success, "The review gate is off for this repository"
  • A group holds its own pull request and every one queued ahead of it, since GitHub can merge them together when the group passes.
  • The status is posted once, when GitHub asks for checks on the group. Answering a finding later does not update it: remove the pull request from the queue and queue it again.
  • It needs the GitHub App's Merge queues: Read permission and its Merge group events. GitHub sends merge-group events to apps only, so a repository CodePanel posts to with a user token, not the app, gets no merge-group status.

GitHub Actions alternative

The workflow below waits for the review, reads it from GET /api/review, and fails while gate.blocking is true, annotating each unanswered finding. It runs on pushes only, so re-run it after answering findings with /feedback. The CodePanel status updates by itself.

Step 1: Create a CI token

In CodePanel, open the repository's Settings tab and create a token under CI tokens. Copy it when it appears ("Copy this token now. It won't be shown again."). It is read-only and works for that one repository. A repository can have up to 10 active CI tokens.

Step 2: Add two Actions secrets

In the GitHub repository, under Settings → Secrets and variables → Actions:

Secret Value
CODEPANEL_URL https://codepanel.ai, or a self-hosted deployment's own address. The token dialog under Settings → API tokens in CodePanel shows it ready to copy. A secret set to the old hosted .convex.site address keeps working
CODEPANEL_TOKEN The CI token from step 1

Step 3: Add the workflow

Save it as .github/workflows/codepanel-gate.yml. The same file is in the CodePanel source at examples/github-actions/codepanel-gate.yml.

.github/workflows/codepanel-gate.yml
name: CodePanel gate
on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]

jobs:
  gate:
    runs-on: ubuntu-latest
    steps:
      - name: Wait for the review and check it
        env:
          URL: ${{ secrets.CODEPANEL_URL }}
          TOKEN: ${{ secrets.CODEPANEL_TOKEN }}
          REPO: ${{ github.repository }}
          PR: ${{ github.event.pull_request.number }}
        run: |
          set -u
          deadline=$((SECONDS + 900))
          while :; do
            rm -f body.json
            code=$(curl -sS -o body.json -w '%{http_code}' -H "Authorization: Bearer $TOKEN" "$URL/api/review?repo=$REPO&pr=$PR") || code=000
            if [ "$code" = 401 ] || [ "$code" = 403 ]; then
              cat body.json 2>/dev/null
              echo "::error::CodePanel refused the request (HTTP $code): check the CODEPANEL_TOKEN secret and that the repository is connected"; exit 1
            fi
            body=$(cat body.json 2>/dev/null || echo '{}')
            status=$(echo "$body" | jq -r '.status // "unknown"')
            case "$status" in
              complete)
                blocking=$(echo "$body" | jq -r '.gate.blocking')
                round=$(echo "$body" | jq -r '.round')
                echo "CodePanel round $round: unanswered $(echo "$body" | jq -r '.gate.unanswered | join(", ")')"
                if [ "$blocking" = "true" ]; then
                  echo "$body" | jq -r '.gate.unanswered as $u | .findings[] | select((.ref // (if .line then "\(.file):\(.line)" else .file end)) as $r | $u | any(.[]; . == $r)) | "::error file=\(.file),line=\(.line // 1)::\(.ref // .file) \(.message)"'
                  exit 1
                fi
                if [ "$blocking" != "false" ]; then
                  echo "::error::CodePanel's response has no gate verdict; is the deployment up to date?"; exit 1
                fi
                exit 0 ;;
              failed)
                echo "::warning::CodePanel review failed; not blocking the merge"; exit 0 ;;
              pending|reviewing|unknown)
                if [ $SECONDS -ge $deadline ]; then
                  echo "::warning::CodePanel review not finished in 15 minutes; not blocking the merge"; exit 0
                fi
                sleep 20 ;;
            esac
          done

Step 4: Require the gate check

Add the gate check as a required status check in your branch protection rules.

Review state Workflow result
Still pending or reviewing Waits, polling every 20 seconds, up to 15 minutes
Complete, the gate is blocking Fails, with an annotation on each unanswered finding
Complete, the gate is not blocking Passes
Failed Passes with a warning
No result within 15 minutes Passes with a warning
Token rejected (401 or 403) Fails, so a bad token never turns the gate off unnoticed

GET /api/review

GET /api/review?repo=owner/name&pr=123
Authorization: Bearer <CI token for that repository>

repo must be owner/name and pr a positive integer. The response is JSON with cache-control: no-store:

{
  "found": true,
  "status": "complete",
  "round": 2,
  "headSha": "9fceb02d0ae598e95dc970b74767f19372d61af8",
  "lastReviewedSha": "9fceb02d0ae598e95dc970b74767f19372d61af8",
  "reviewCommentId": 1234567890,
  "rounds": { "completed": 2, "limit": 3, "perPr": false, "running": false, "limitReached": false },
  "open": { "critical": 1, "warning": 2, "suggestion": 0 },
  "gate": { "level": "warning", "blocking": true, "unanswered": ["F3", "F5"] },
  "findings": [
    {
      "id": "k17abc...",
      "ref": "F3",
      "severity": "critical",
      "file": "src/auth.ts",
      "line": 42,
      "message": "The ownership check runs after the write.",
      "suggestion": "Check ownership before calling patch().",
      "status": "new",
      "answered": false,
      "agentNames": ["Bugs & Security"]
    }
  ]
}
Field Meaning
found false when CodePanel has never seen this pull request; the HTTP status is then 404, open is all zeros, gate is not blocking and findings is empty.
status pending, reviewing, complete or failed.
round Number of review rounds so far.
headSha / lastReviewedSha The pull request's head and the last commit a review finished on.
reviewCommentId The id of the posted GitHub comment.
rounds Automatic rounds completed, the limit that applies (absent for none), whether it is the pull request's own (perPr, set with /rounds), whether a round is running, limitReached: completed has reached limit, so pushes are not reviewed, and capped: the head is a commit the limit kept from review, with no round running.
open Counts of open (new or still open) findings by severity.
gate The repository's gate level, whether the pull request is blocking, and the unanswered findings that block it, most severe first, by ref (or file:line for a finding without one). status says whether GitHub took the last CodePanel commit status: posted, missing_permission (the GitHub App has not accepted Commit statuses) or refused; it is absent until one was posted. Anything but posted means the pull request carries no status, so blocking is the only gate.
findings Every open finding, most severe first. Each has status new or persisting (still open from an earlier round). answered is true when it has a verdict since the last round reported it: it is still open, but no longer blocks. line, suggestion and ref are left out when empty. Deprecated: payload.findings lists the same findings with more fields, a state in the shared vocabulary and null for empty values (GET /review); this list is kept for existing readers and gains only state.
startedBy reconciler when the latest round was started because its webhook never arrived (see Status behaviour); absent otherwise.
payload The same review as versioned data, with a verdict (ready, blocked or needs-review) and nextRound. Fields are listed under GET /review. Absent when found is false. The verdict counts every open critical and warning, answered or not, so an answered finding still reads blocked; when gate.level is not off, follow gate.blocking instead. payload.nextAction weighs both and says what to do next.

When found is false, status, round, headSha, lastReviewedSha and reviewCommentId are absent.

Error Body
400 {"error":"repo must be owner/name and pr a positive integer"}
401 {"error":"missing bearer token"}
403 {"error":"not authorized"}, for a wrong token, a token for another repository, or an unknown repository
429 {"error":"rate limit exceeded"}, with a retry-after header

The example workflow treats any body without status as "wait", so a pull request CodePanel has not reached yet is retried until the deadline. A rejected token (401 or 403) fails the check at once. If the gate always takes 15 minutes, check CODEPANEL_URL.

Warning

Right after a push, the endpoint can still describe the previous round until the new one starts, because pushes wait 60 seconds before reviewing. The example does not compare headSha with lastReviewedSha. To judge only the current commit, wait in your script until lastReviewedSha equals ${{ github.event.pull_request.head.sha }} before reading gate. The CodePanel commit status has no such gap, because it is posted per commit.

Tokens

Token GET /api/review for repository R /api/v1
CI token for R Allowed 403
CI token for another repository 403 403
Personal token with read, owner of R Allowed Per scopes
Personal token of another user 403 Own data only
  • A CI token has the read scope only, never expires, and reads that one repository's review and nothing else. Revoke it from the same CI tokens list.
  • /api/review answers 403 identically for an unknown repository and a wrong token, so it cannot be used to discover which repositories are connected.
  • Requests are limited to 120 per minute per token; over that you get 429 with a retry-after header. The workflow polls three times a minute.
  • The repository's webhook secret is not accepted as a token. It signs GitHub's deliveries and is never exposed (Security).

Personal tokens, scopes and the rest of the API are in the HTTP API reference.

Last updated