---
name: tawa-chaac-checks
description: "The checks Chaac runs on a task branch and the .chaac.yaml checks: install/run format, sandbox and network rules. Use when a Chaac Code run shows failed controller checks or a repo needs .chaac.yaml."
---

# Chaac Checks

## The Short Version

When a Chaac Code run finishes its steps, the Chaac controller runs your repo's
typecheck, lint and tests itself, on the task branch, and shows the results on
Review under **Checks run by Chaac**. That is the evidence a reviewer trusts; what
the agent says it ran is shown separately.

Most repos need nothing: Chaac finds `package.json` scripts, Go tests, Python tests
or Makefile targets on its own. To say exactly what to run, add a `.chaac.yaml` at
the repo root:

```yaml
# .chaac.yaml
checks:
  install:                       # optional; runs first, can reach package registries
    - python3 -m venv .venv
    - python3 -m pip install -r requirements.txt
  run:                           # required when `checks:` is present
    - { id: lint, command: python3 -m ruff check . }
    - { id: test, command: python3 -m pytest -q }
```

A failed check keeps the task waiting on Review ("Controller checks failed: test")
instead of completing on its own.

## What Chaac runs, if you declare nothing

First match wins:

| Your repo has | Install | Checks |
|---|---|---|
| `.chaac.yaml` with `checks:` | `checks.install` | `checks.run` |
| `package.json` scripts `typecheck` / `lint` / `test` | `npm ci` (or `corepack pnpm install --frozen-lockfile` / `corepack yarn install`, from the lockfile) | `npm run <script>` / `corepack pnpm run <script>` |
| `go.mod` and at least one `*_test.go` | `go mod download` | `go vet ./...`, `go test ./...` |
| `requirements.txt` or `pyproject.toml`, and tests | `python3 -m venv .venv`, then `pip install -r requirements.txt` (or `pip install .`) | `python3 -m pytest -q` if pytest is declared, else `python3 -m unittest discover` |
| `Makefile` targets `typecheck` / `lint` / `test` | none | `make <target>` |

- Only scripts that exist run. npm's placeholder `"test": "echo \"Error: no test specified\" && exit 1"` is ignored.
- A `go.mod` with no tests (a Hugo site's module file) runs nothing.
- Nothing found: Review says **no checks defined**, which does not block the task.

## `.chaac.yaml` reference

| Key | Required | Meaning |
|---|---|---|
| `checks.run` | yes | List of `{ id, command, network? }`. Runs in order; every one runs even if an earlier one fails |
| `checks.run[].id` | yes | Short lowercase name (`test`, `lint`, `e2e-smoke`), unique, not `install` |
| `checks.run[].command` | yes | A command line or an argv list. **No shell**: no pipes, `&&`, redirects or `$VARS`. Quotes work |
| `checks.run[].network` | no | `true` lets this check reach the package registries (below). Off by default |
| `checks.install` | no | Commands run before the checks, with registry access. If one fails, no check runs ("Dependencies did not install") |
| `checks.allow` | no | Up to 20 extra hosts this repo's install and `network: true` checks may reach (`api.example.com`, `*.example.com`) |

**The first word must be one of** `npm`, `pnpm`, `yarn`, `python3` (or `python`), `go` or `make`.
`pnpm` and `yarn` run through corepack, which Chaac prepares for you. Anything else
(`bash`, `npx`, `curl`, `./scripts/test.sh`) is refused: wrap it in a package.json
script or a Makefile target instead.

A malformed `.chaac.yaml` is an `error` on Review naming the problem
(`.chaac.yaml checks.run[1]: id must be a short lowercase name`), not a red check.

## How the checks run

- **Only what is committed counts.** Chaac clones the task branch into a fresh
  directory. Uncommitted files in the agent's work tree are not there.
- **As a sandboxed user, with an empty environment.** No credentials, no
  `MONGODB_URI`, no tokens. Tests that need a database must start their own or
  mock it.
- **Without network.** Checks run in a network namespace with only loopback:
  a test can bind `localhost`, but cannot reach the internet, the VPC, a
  database or another service. A check that fails with a DNS or connection error
  is marked **looks like it needs network** on Review.
- **Install and `network: true` checks reach registries only.** Their only way
  out is Chaac's registry gate, which tunnels HTTPS (port 443) to:
  `registry.npmjs.org`, `registry.yarnpkg.com`, `repo.yarnpkg.com`,
  `git.insureco.io` (the `@insureco` npm packages), `pypi.org`,
  `files.pythonhosted.org`, `proxy.golang.org`, `sum.golang.org`, plus your
  `checks.allow`. Everything else is refused, and the check's log ends with
  `chaac: the registry gate refused <host>`. A name that resolves to a private
  address is refused even if listed.
- **Time limits.** 10 minutes per install step and per check, by default.
- **Toolchains.** Node 20 (npm, corepack for pnpm/yarn), Python 3 with venv,
  Go 1.27 (`GOTOOLCHAIN=local`, so a `toolchain` line in `go.mod` cannot fetch
  another), make.

## On Review

- **Checks run by Chaac**: one row per command, with exit code, time and a
  **log** link (the head and tail of the output, secrets redacted).
- **Re-run checks** runs them again on the branch as it is now. The previous run
  moves to **Earlier runs**, with its logs. A green re-run on a task waiting in
  verifying clears "Controller checks failed"; it does not complete the task,
  the person on Review does.
- The screen updates when a run starts and finishes; there is no need to reload.
- Pausing a run that has pushed its branch runs the checks too, so Review has
  evidence while the run is paused.

## Examples

### pnpm monorepo, one package's tests

```yaml
checks:
  install:
    - pnpm install --frozen-lockfile
  run:
    - { id: typecheck, command: pnpm -r run typecheck }
    - { id: test, command: pnpm --filter api run test }
```

### A test that needs an outside API

```yaml
checks:
  allow:
    - api.carrier.example.com
  run:
    - { id: test, command: npm test }
    - { id: live-quote, command: npm run test:live, network: true }
```

Prefer mocking. A `network: true` check is logged, and shown on Review as
"with network (opted in)".

## Common mistakes

- **`command: bash -c "..."` or `command: npm test && npm run lint`.** No shell.
  Use two checks, or one package.json script.
- **Expecting secrets in tests.** The environment is empty on purpose.
- **A test that talks to a real database or service.** It fails with "looks like
  it needs network". Use an in-memory database or a mock.
- **Leaving work uncommitted.** Checks clone the branch; only commits count.
- **Listing a whole cloud domain in `checks.allow`** (`*.amazonaws.com`). Name
  the one host the test needs.

See also: [Tawa Test](/reference/tawa-test) for the checks that run after a
deploy, and [Definition of Done](/reference/definition-of-done).
