# Cloud runs

> How screw-bugs Cloud tests a site or a pull request by itself, what a run may cost, and how to stop one.

Source: https://docs.screwbugs.dev/cloud/cloud-runs

A Cloud run is `screw-bugs` running on Cloud's side: Claude plans the cases, a cloud browser runs them, Claude reviews the result, and the report is published as a link. No local machine or coding agent is needed.

> **Warning: Not open yet**
>
> Only the screw-bugs team (Cloud's admins) can start Cloud runs for now. Everyone else is told
>   "Cloud runs aren't open yet."

## Starting a run

| From                                 | What it tests                             | Where it answers             |
| ------------------------------------ | ----------------------------------------- | ---------------------------- |
| A `/screw-bugs` PR comment           | The PR's preview, planned from its diff   | [On the PR](/bots/github.md)    |
| A Slack mention (Slack: coming soon) | A site or a PR                            | [In the thread](/bots/slack.md) |
| **Start a run** (`/runs/new`)        | A site by itself, at the address you give | On `/runs` only              |

On **Start a run**, give the address, what to test in your own words, and optionally one of your [test accounts](/cloud/test-accounts.md). **Runs** (`/runs`) lists your runs and their reports.

![Start a run on screwbugs.dev: a Website field, a What to test field filled in, a Test account dropdown and a Start the run button.](https://docs.screwbugs.dev/screenshots/cloud-runs-start.webp)

## What a run does

### Plan

Claude looks at the site first, then writes the cases. A PR's run also reads the PR's diff.

### Run

The `screw-bugs` engine (`@screw-bugs/core`) runs the cases on Cloudflare Browser Run. Each browser session is recorded to video.

### Review

Claude reads the evidence and the screenshots of the cases that didn't pass, and tells the site's bugs from the cases' own mistakes. Its write-up shows in the report.

### Publish

The report is published as a share on `reports.screwbugs.dev` ([report sharing](/cloud/report-sharing.md)) and linked where the run was asked for.

## Cost

Cloud runs aren't for sale yet. When they open:

| Plan       | Price      | Included each month                   |
| ---------- | ---------- | ------------------------------------- |
| Cloud plan | $20/month  | 1,000 browser minutes, 1.2M AI tokens |
| No plan    | Free trial | Up to $2 of runs, in total            |

Sharing reports stays free. Overage prices ($0.02 a minute, $10 per 1M tokens) are set but not billed yet.

**Your cap.** Your runs stop once they have cost $20 this month (plan), $2 in total (trial), or never (admins). A run's cost is what it costs us (the model's price per token, plus $0.09 per browser hour), not the overage prices above.

**Each run** also stops at the first of these (the defaults), and still gets a report of what ran:

| Per run    | Cap                                              |
| ---------- | ------------------------------------------------ |
| Tool calls | 150                                              |
| Tokens     | 3 million, cached ones included                  |
| Wall time  | 15 minutes                                       |
| Cost       | $2, or what's left of your cap (none for admins) |

- The run is the requester's (whoever commented, mentioned the bot or clicked **Start**): their cap pays.
- Once nothing is left, new runs are refused, and the bot says so.
- A run that ends gives back what it didn't use. The review is skipped once a cap is reached.
- Sign-in browsers for [test accounts](/cloud/test-accounts.md) count too.

## Stopping a run

The bot's first comment (or the Slack status message (Slack: coming soon), or the run's row on `/runs`) links to `/runs/<slug>/stop`.

1. Open the link and sign in.
2. Click **Stop the run**.

- The run ends at once, spends nothing more, and writes no report.
- Its PR comment or Slack thread (Slack: coming soon) says who stopped it.
- Who may stop it: for a PR, anyone who can push to the repository; for a site tested by itself, the person who asked. Admins can stop any run.

## Protected previews: preview headers

Previews behind a login wall (Vercel Deployment Protection, Cloudflare Access) need a secret header. Admins set these per repository on **Preview headers** (`/previews`).

- Vercel: `x-vercel-protection-bypass` (Protection Bypass for Automation).
- Cloudflare Access: a service token's headers.

Runs send them only to the preview's own address (and to a site it redirects to). They are stored encrypted, never shown again, and never sent to a site a request names on its own.

## How it works

- Every entry point calls one job API, which creates a job and starts a Cloudflare Workflow (`ReportJobWorkflow`).
- The Workflow runs the job step by step (choose an account, plan, run, review, finish) and resumes from the last finished step if a Worker dies.
- A failed step is tried again after 10 seconds, with exponential backoff: plan, run and review once more, quick steps twice. Each attempt's usage counts toward your cap.
- A run reserves its share of your cap when it is made, so runs started together can't overshoot it.
- Each step's model usage and browser time are recorded (`job_usage`).
- Browser Run has no ffmpeg, so the screencast streams to a separate encoder Worker, which makes a VP9 WebM, as local `screw-bugs` does.
- Preview headers and saved sessions are sealed with AES-GCM and opened only inside a run.

Code: `apps/web/src/server/jobs` (Cloud). Billing: `docs/billing.md` (Cloud).

**Next:** [Test accounts](/cloud/test-accounts.md)