Skip to content

How a review runs

This page follows one pull request through Visto AI, from the moment GitHub sends a webhook to the moment the review is posted. It shows where each feature fits and which safeguards apply at each step.

The work is split in two. The service receives events, queues jobs, talks to GitHub and records everything in Postgres. The engine is one function, review(input, deps), that reads a pull request and returns a structured review. The engine writes nowhere, not to GitHub and not to a database, which is why the replay and backtest commands can call it directly.

GitHub posts an event to the service’s webhook route. The service:

  • checks the signature with the webhook secret, and answers 401 invalid_signature when it does not match;
  • records the delivery’s id, so a delivery GitHub sends twice is answered 202 duplicate and does nothing more;
  • stores what the event says (the pull request, a comment, a thread change) and any job it asks for, in one database transaction;
  • answers 202 accepted (or 202 ignored for an event it does not act on) once that is committed, or 503 storage_unavailable when the database cannot be reached, so GitHub’s delivery log shows the failure.

A pull request that is opened, reopened, made ready for review, pushed to or given a new base branch gets a review job, unless it is skipped:

Skip reason When
closed The pull request is not open
draft It is a draft
ignored_author Its author is in ignoredAuthors (dependabot[bot] by default)
base_filtered Its base branch is not in baseBranches
gated The merge gate is on for its base branch in enforce or bypass mode, where pull requests are reviewed only when asked

A comment of /review asks for a review of the current head whatever the filters say, from anyone allowed to command. The merge gate adds /done and /skip.

Jobs live in Postgres, so they survive a restart. A job for a push waits three minutes, and a later push to the same pull request replaces it, so a burst of commits gets one review. Other jobs are due at once.

Up to limits.queueConcurrency reviews run at once (2 by default). No review starts while reviews are paused: when the day’s spend has reached limits.spendPerDay, or for five minutes after the model endpoint refuses the key or reports no credit. A key with no limit left counts as no credit only while model.model or one of model.fallbacks the service started with is not an OpenRouter free model (an id ending in :free, in any letter case), since free models cost nothing. A job is tried at most three times and dropped once it is a day old.

When a job starts, the service reads the pull request live from GitHub and checks it again:

  • An automatic job whose pull request has since been closed, made a draft or filtered out is dropped with that reason.
  • An automatic job whose head is no longer the pull request’s head is dropped as stale_head, and a new job for the live head waits its three minutes. A /review reviews whatever the live head is.
  • A head that already has a published review for the same base is not reviewed again. A /review on it runs a re-check instead.

The service then decides the mode: a full review, an incremental review that reads only what changed since the last one, or a recheck (see Scores across reviews). It gathers what earlier reviews left: their threads, their scores and their acceptance rows.

Everything the engine reads comes through a read-only source. The GitHub source refuses to send anything but a GET request. It reads the pull request’s changed files, their contents at the head, and .visto-ai.yml from the default branch.

For each changed file the model gets:

  • the diff, with an anchor on every line (R142 |+code), so a finding can name an exact line;
  • the full contents of the file, where they fit;
  • the test file that belongs to it, when one exists.

Secret files are never sent. A file is secret by its name alone, and nothing of it (its diff, its contents or its paired test) reaches the model. It is listed as not reviewed (secret_file) and scores 100%, so a person looks at it. Secret names are:

  • .env and .env.*, except .env.example, .env.sample and .env.template;
  • anything under a .ssh directory;
  • files named exactly id_rsa, id_dsa, id_ecdsa, id_ed25519, .netrc, _netrc, .npmrc, .pypirc or .dockercfg.

A file renamed from a secret name counts too. Other files that may hold credentials, such as *.pem, *.key or .aws/credentials, are sent like any other file.

Batches. The files are packed into batches that fit limits.inputTokensPerCall, up to limits.batchesPerReview (6 by default). A file that does not fit is listed as not reviewed, unless an earlier review already covers it. Batches go to the model two at a time.

Optional context is added only when it costs the files nothing, meaning no more cutting and no extra file left unreviewed. In this order:

  1. Memory: where people stepped in on earlier pull requests of the repository.
  2. Lessons learned from people’s replies.
  3. Ticket text and acceptance criteria from extension modules.
  4. Tools from MCP servers.

The model is asked with elevated effort when the base branch is in primaryBranches, or the pull request changes more than 15 files or adds more than 500 lines.

Everything that comes from the pull request, everything an extension module supplies, and everything an MCP tool returns, is wrapped in data markers that carry a random token, the same in every call of one review:

<<<data 7f3a... title>>>
...the text...
<<<end 7f3a...>>>

The token is deleted from the text before it is wrapped, so the text cannot close its own block. Invisible and direction-changing characters are stripped from the pull request’s text, and a file whose changed lines held any scores 100%, so a person looks at it. The review contract tells the model that text inside the markers is data, never instructions.

Memory holds no words a person wrote, only file and directory names, days, kinds of change and counts the service computed, so it is not wrapped; each name stands in a code span. Lessons are words a model wrote from a person’s reply, so each one is wrapped in the data markers, under rules of its own.

7. The model answers through one tool call

Section titled “7. The model answers through one tool call”

The model must answer through one tool call, submit_review, so the answer is structured data and not prose. Unless model.toolChoice is auto, every request names that tool, except the open turns of a call that offers MCP tools (see Configuration). The rules the model follows are in contract/review-contract.md.

When MCP servers are named, the model may first call their tools in a few open turns, a bounded number of times, before a closing turn asks for submit_review (see MCP tools).

When the second scorer is on, the review model gives findings and a separate model gives the block scores.

The service does not take the model’s answer on trust:

  • Grounding. An answer whose overview names no changed file is sent back once, and then rejected. An invalid answer gets one retry.
  • Wrong files. A finding on a file that is not in the pull request is dropped.
  • Placement. A finding on a line that can take a comment stays there. One on a line that cannot is placed by the code it quotes: on the nearest line of the file whose text is the quote, on its own side first, unless the full file shows the quote on the very line it named (then it is about code outside the diff). Otherwise it moves to the nearest line that can take a comment, within three lines. One its own file cannot take goes to another file of the same batch when exactly one line there has the quote as its text. Anything else is listed separately, under Findings not placed on the diff.
  • Files that take no findings. A finding on a test, documentation, generated, vendored or lock file is dropped. Such a file is still read and scored, and the model is told that no finding is asked there.
  • Earlier threads. A finding that repeats an earlier thread is dropped and listed under Already discussed. The model’s verdict on each earlier thread it was shown (fixed, answered or still open) is checked before it is used.
  • Scores. A block score that is not a whole number from 0 to 100 leaves its block counted as 100. See The score.

The service builds the review text from the structured result. The layout, the severity tags and the lists are the service’s own. The model supplies only the overview, the text of each finding, its notes on acceptance criteria and a score for each changed block. A review typically has a summary, Human review (the blocks at or above the threshold), Acceptance criteria when a module gives any, Findings, and a Coverage list of files that were not reviewed.

Just before posting, the service reads the pull request again. If its head or base has moved, nothing is posted and the new head gets its own job.

Otherwise it posts one GitHub review on the head commit, with the findings as inline comments on the diff:

  • With automatic approval on and every condition met, the review is posted as an approval. Otherwise it is posted as a comment, and its last paragraph says which condition did not hold.
  • In dry run nothing is posted: the review is recorded so you can read what it would have said (see Leaving dry run).

After posting, the service records the review as posted, follows up in earlier threads (a reply, and a resolve where the verdict and the app’s permissions allow), writes the review log line, and tells any extension module’s notify part. For a gated pull request it then asks for the merge gate’s check to be updated.