Running the service
This page is for whoever runs Visto AI day to day. It covers which image to run and how to upgrade it, how to put it behind a proxy, what limits and alerts to expect, and what the service does when GitHub, the model or the database fails. For a first install, start with the Quick start.
Requirements
Section titled “Requirements”- One instance per database. A second instance on the same database stops at once with
another_instance_running, and the first keeps running. The refused instance loads no extension module. - A direct connection to Postgres. The instance lock and the statement timeout do not work through a pooler in transaction mode. The Compose file runs Postgres 17 beside the service.
- A restart policy. The service exits to be restarted in several cases: when a save in Settings needs a restart, and when it loses its database lock. Compose’s
restart: unless-stoppedand Kubernetes both handle this. - A GitHub App and a model API key. See Create the GitHub App and Configuration.
Images
Section titled “Images”The prebuilt image is vistoaichecker/visto-ai on Docker Hub, built for linux/amd64 and linux/arm64. It is tagged latest and with each release version, for example 0.6.0.
Pin a version in production, rather than running latest:
services: app: image: vistoaichecker/visto-ai:0.6.0To upgrade, read the release notes first: before 1.0, a breaking change bumps the minor version. Then change the tag (or run docker compose pull if you track latest) and restart:
docker compose pulldocker compose up -dDatabase migrations run at start, after the service takes its instance lock and before it reads any setting, so the new version migrates the database on its first start. Migrations only go forward: an older release refuses to start on a database that a newer one has migrated (unknown_migration_applied), so back up the database before an upgrade if you may need to roll back. From a clone of the repository, docker compose up -d --build builds the image from source instead.
Exposing it
Section titled “Exposing it”The service listens on one port, 8080 unless server.port says otherwise, and serves these paths:
| Path | What it is |
|---|---|
/webhooks/github |
GitHub’s webhook deliveries (POST). GitHub must reach it. |
/healthz |
A health check (GET), answered 200 ok. The Compose file uses it. |
/ui/, /api/ |
The web UI and its API, when ui.publicUrl is written. Otherwise they answer 404. |
/extensions/<name>/ |
An extension module’s routes, when a module has them. An address under /extensions/ that names no module with a route is answered 404 without being read. |
The Compose file publishes port 8080 on every interface of the host. TLS, and any limit on connections or body size per caller, belong to the proxy in front of it. Firewall the port, or publish it only where the proxy can reach it.
Extension module routes are public: the service checks nothing about who calls, and each module must check every request itself.
Request limits
Section titled “Request limits”| Limit | Value | When it is reached |
|---|---|---|
| Webhook body | 25 MB | Answered 413 payload_too_large. |
| Webhook requests at once | 20 | Further deliveries are answered 503 busy. |
| Extension module body | 1 MiB | Answered 413 payload_too_large. |
| Requests at once, per module | 10 | Answered 503 busy. Separate from the webhook’s 20. |
| UI body | 64 KiB | Answered 413 payload_too_large. |
| UI requests at once | 16 for files, 2 for sign-in, 4 for the rest of /api |
Answered 503 busy. See The UI. |
The service holds a webhook body in memory before it can check the signature. With 20 requests of 25 MB at once, that is about 500 MB while bodies arrive, and about twice that at the moment a body is joined into one piece.
A caller that sends slowly can hold one of the 20 webhook places for up to about a minute, and one of a module’s places for up to 30 seconds. Twenty such callers, none of whom needs the webhook secret, can take every place, and real deliveries are answered 503 busy meanwhile. Put the proxy’s own connection and rate limits in front of the service.
Spending and limits
Section titled “Spending and limits”Every review costs money. The cost of a run is what the model endpoint reports with each answer; OpenRouter, the default, reports it in US dollars. For an endpoint that reports no cost, it is computed from model.prices, in whatever currency those prices are written in. With neither, the cost is recorded as 0.
limits.spendPerDay (50 when not written) caps the spend in one UTC day, in the unit of those recorded costs. The service adds up the cost of the review runs, and of the calls of the lessons judge (see Lessons), recorded since the start of the UTC day. It can only see what is recorded: with an endpoint that reports no cost and no prices, the limit never stops anything, and the service raises cost_unknown.
| Spend | What happens |
|---|---|
| 80% of the limit | Alert spend_80. |
| The limit | Alert spend_limit. No new review starts until the next UTC day, and the lessons judge makes no call. Reviews already running finish. |
cost_unknown, spend_80 and spend_limit are raised once per run of the service, so a restart can raise them again. spend_80 and spend_limit are also raised once per UTC day. A change to limits.spendPerDay saved in Settings is read at the next look; raising the limit above what is already spent lets both alerts fire again when the spend reaches them.
Queues and concurrency
Section titled “Queues and concurrency”Jobs run in three lanes, and stopping the service waits for all three.
| Lane | Places | Paused by the spend limit or the model’s key? |
|---|---|---|
| Reviews | limits.queueConcurrency (2 when not written) |
Yes |
Merge gate jobs: writing the check, /done, a skip, a re-run |
4 | No, and it waits for no review |
| Withdrawals of the app’s approvals | 2 | No. See Automatic approval. |
There are never two review jobs for one pull request at once, and never two gate jobs for one pull request at once. One gate job may run beside a review job of the same pull request. limits.queueConcurrency is read at start, so a change saved in Settings applies after the restart it triggers.
When the model’s key is refused or its account is out of credit, reviews pause for 5 minutes at a time. The service raises model_error once, and model_ok when the key works again. Waiting jobs are not kept for ever: a job that has waited 24 hours is dropped as too_old. A review refused after it had already made model calls uses up one of the job’s three starts.
Alerts
Section titled “Alerts”Every alert goes to the service’s log. It is also sent:
- to
alerts.webhook, when you wrote one, as aPOSTof JSON{ "source": "visto-ai", "code": ..., "at": ..., "details": { ... } }; - out of dry run, to the extension modules that have an alert sink (see Extension contract).
Every alert except the four that say a problem ended (model_ok, extension_ok, mcp_ok, memory_ok) is also stored in visto_ai.alerts, in dry run and with the UI off too, and shown on the UI’s Overview as open or recent (see The UI). Alerts are kept 30 days. Each dependency’s current state is kept in visto_ai.dependency_health.
| Alert | Raised when | See |
|---|---|---|
model_error |
The model’s key is refused or its account is out of credit. Reviews pause. | Queues and concurrency |
model_ok |
The model’s key works again. | |
spend_80 |
The day’s spend reaches 80% of limits.spendPerDay. |
Spending and limits |
spend_limit |
The day’s spend reaches the limit. Reviews stop starting until the next UTC day. | Spending and limits |
cost_unknown |
A run used tokens with no reported cost and no model.prices, so the daily limit cannot see it. |
Spending and limits |
redelivery_failed |
At start, GitHub could not be made to redeliver every webhook delivery that failed while the service was down. | Restarts and upgrades |
feature_off |
At start, the GitHub App lacks a permission or event that a feature needs. Its details name the feature and what is missing. | Leaving dry run |
gate_check_failed |
A merge gate job gave up writing or evaluating its check. | The merge gate |
gate_bypass |
At a start in which a repository’s gate is in bypass mode. |
The merge gate |
extension_error |
A part of an extension module (context, notify or route) starts failing. |
Extension modules |
extension_ok |
That part works again. | |
mcp_error |
A review records an error for an MCP server. | MCP tools |
mcp_ok |
A later review records that server as working. | |
memory_error |
A review records an error reading memory, its signals or its lessons. | Memory |
memory_ok |
A later review reads memory again. | |
learning_stale |
No learning pass has completed for more than 36 hours. | Memory |
lessons_stale |
No run of the nightly lessons judge has completed for more than 36 hours. | Lessons and reverts |
dismissal_failed |
The app could not withdraw one of its own approvals. | Automatic approval |
stale_approval_merged |
A pull request was merged while an approval of the app’s that should have been withdrawn still stood. | Automatic approval |
An MCP server is first contacted at the first review that uses it, not at start, so a wrong address or key shows at that review (see MCP tools).
Failures, retries and end codes
Section titled “Failures, retries and end codes”When GitHub fails
Section titled “When GitHub fails”When GitHub cannot be reached, or refuses a read (reading the threads is one), before any model call, the run is recorded as failed and the job is tried again a minute later, then 15 minutes after that: three starts in all.
A pull request whose threads cannot be read, because GitHub refuses the query or the list is too long to read, gets no later review: each of its jobs ends attempts_exhausted. The list of the pull request’s reviews, which the service reads to find its own, has a cap of 10 pages of 100. A pull request past that cap gets no further review, in the same way.
When posting a review fails
Section titled “When posting a review fails”Out of dry run, a review that was computed but could not be posted (GitHub could not be reached, or answered with an error) stays recorded. Its job is tried again 15 minutes later, whatever its starts and whatever the error. GitHub may have created the review even though it answered with an error, so the later start first asks GitHub for the app’s own reviews and adopts one it finds, rather than posting again.
A start that comes sooner (after a /review, a reopening or a restart) and finds no review of the app’s own for that commit does not post the recorded review yet, because GitHub may hold a review it does not list yet. It waits until 15 minutes have passed since the review was recorded, or since the last start that set out to post it. Each such start writes its time on the recorded review first, and posts nothing when it cannot. A start that waits is not counted, and a /review that waits this way gets no reply meanwhile. So each real failure delays the review by up to 15 minutes, and a review GitHub created but still does not list by then is posted a second time.
The later start posts the recorded review without computing it again, while the review is less than a day old.
End codes
Section titled “End codes”A job that ends without posting a review records one of these codes.
| Code | Why the job ended |
|---|---|
attempts_exhausted |
Its three starts are used up. |
too_old |
It is a day old. |
no_installation |
No GitHub App installation is known for the pull request. |
superseded |
Another job for the pull request was already waiting when this one was put back. |
not_found |
The pull request is gone. |
closed |
The pull request is closed. Out of dry run, also when it was closed while the review was being computed. |
draft |
The pull request is a draft. |
ignored_author |
Its author is in ignoredAuthors. |
base_filtered |
Its base branch is outside baseBranches. |
gated |
It is gated and is reviewed only when asked (see The merge gate). |
stale_head |
It has a new head. The new head gets a job of its own. |
already_reviewed |
It was already reviewed at that head and base. A /review does not end this way, except in dry run. Out of dry run, also when GitHub lists a review of the app’s own on the live head that the database does not know of, checked before anything is paid for. |
nothing_new |
Out of dry run, a push whose review would tell a person nothing the newest published review does not already tell. The engine runs without a model call. Not used when automatic approval is on and that newest review was posted as an approval. See Reviews after the first. |
failed |
The review failed. It is recorded, and nothing is posted. |
head_moved |
Out of dry run, the head or the base changed while the review was computed. The new head gets a job; a command’s own job starts over once. |
publish_rejected |
Out of dry run, GitHub refused the review even without its inline comments. |
render_failed |
Out of dry run, the review’s text could not be written. |
The codes in the last four rows, and the second meanings of closed and already_reviewed, apply after the review was computed and recorded, or just before; the others are checked when the job runs.
Restarts and upgrades
Section titled “Restarts and upgrades”What happens at start
Section titled “What happens at start”The service starts in this order:
- It reads and checks the config file. A file that fails prints its
config:lines and exits with 2. - It takes the instance lock, then loads the extension modules. A module that cannot be loaded logs
extension_failedwith the module’s name and a code, thenstart_failed, and the process exits with 1 before it listens (see Extension contract). - It runs the database migrations.
- It syncs the editable settings of the file with the database and logs one
settingsline (see Configuration). A clash between the file and the settings saved in the UI stops the start with exit code 1, and nothing is copied. - It listens, then checks the model’s key and the GitHub App’s permissions (logging
feature_offfor each thing a feature lacks) and asks GitHub to redeliver missed webhooks.
Missed webhooks. The service writes a heartbeat to the database every minute. At start it lists the webhook deliveries since its last heartbeat, less two minutes, and asks GitHub to redeliver each one that never succeeded, oldest first, at most 200. If it cannot redeliver all of them, it raises redelivery_failed. A first start on a new database redelivers nothing.
Stopping
Section titled “Stopping”docker compose stop sends a signal. The service then waits up to 10 minutes for the jobs that are running in all three lanes; the Compose file allows 660 seconds for this. A second signal ends it at once.
Restarts asked from the UI
Section titled “Restarts asked from the UI”Saving a setting in Settings that is read only at start (dryRun, learning, limits.queueConcurrency, model.timeoutSeconds, model.toolChoice, or the second scorer on or off) logs restarting. Once the save is answered and sent, the service stops the same way and exits with code 75, for its supervisor to start it again on the saved settings. See The UI.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
A clean stop after a signal. |
1 |
The start failed (start_failed), the stop failed, a second signal ended it, or it lost its database lock. |
2 |
A usage error, or a config file that fails its check. |
75 |
A restart asked from the UI’s Settings. |
When the database restarts
Section titled “When the database restarts”If the database restarts, the service notices that it has lost its lock, logs instance_lock_lost and exits, and Compose starts it again.
A restart of the database, like any restart of the service in the middle of a review, cuts the reviews that are running. They run again afterwards while they have starts left, and their model calls are paid for again. Out of dry run, a review already recorded when the restart came is posted afterwards, once 15 minutes have passed since it was recorded or last tried, without being computed again, provided its job has a start left and is less than a day old.
Setup notes
Section titled “Setup notes”- A database password that contains any of
@ : / # ?must be percent-encoded in the database URL. - If you change
server.portin the config, change the port mapping and the health check in the Compose file too.