> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Quarantine

> Skip flaky tests without failing pipelines, manually or via automated rules.

Quarantine is a state that tells Momentic: "keep running this test, but don't
let failures fail the build." It's the right move for tests that are genuinely
flaky or mid-investigation, better than skipping entirely because you still get
data.

When a test is quarantined:

* It still runs on every `momentic run` and every CI job
* Failures are reported as **quarantined failures**, not regular failures
* The CLI returns a non-failing exit code even if quarantined tests fail
* Runs still show up in the dashboard so you can investigate

## Quarantine a test

### CLI

<CodeGroup>
  ```bash npm theme={null}
  npx momentic quarantine add <test> --reason <reason>
  ```

  ```bash yarn theme={null}
  yarn dlx momentic quarantine add <test> --reason <reason>
  ```

  ```bash pnpm theme={null}
  pnpm dlx momentic quarantine add <test> --reason <reason>
  ```
</CodeGroup>

See [`momentic quarantine`](/cli-reference/momentic/commands/quarantine) for the
full command reference.

### Dashboard

Go to **Quarantine** in the sidebar and click **Quarantine test**. You can also
quarantine and unquarantine directly from the run viewer, or hover a test on the
Quarantine page and pick **Unquarantine**.

<Frame caption="Quarantine dialog in the run viewer">
  <img src="https://mintcdn.com/momentic-docs/74ZfuO1WWXQIVJ6H/images/reliability/quarantine-dialog.png?fit=max&auto=format&n=74ZfuO1WWXQIVJ6H&q=85&s=7a608dada69d62d81894815c3071c51e" alt="Quarantine dialog" className="w-full" width="1006" height="760" data-path="images/reliability/quarantine-dialog.png" />
</Frame>

## Quarantine rules

Rules automate quarantine/unquarantine based on thresholds so you don't have to
intervene manually.

Each rule has:

* **Action**, quarantine or unquarantine
* **Metric**, one of:
  * **Pass rate**, percentage of runs that passed
  * **Failure count**, absolute number of failed runs
  * **Flake rate**, percentage of runs that flaked
  * **Recovery count**, absolute number of runs that passed via
    [failure recovery](/reliability/failure-recovery)
  * **Recovery rate**, percentage of runs that passed via failure recovery
* **Threshold**, value that triggers the action
* **Window**, period over which the metric is evaluated

<Frame caption="Rule thresholds">
  <img src="https://mintcdn.com/momentic-docs/74ZfuO1WWXQIVJ6H/images/reliability/quarantine-rule-thresholds.png?fit=max&auto=format&n=74ZfuO1WWXQIVJ6H&q=85&s=08db6eec05c1b8e2ca4a8ec751bfa396" alt="Rule thresholds" className="w-full" width="950" height="406" data-path="images/reliability/quarantine-rule-thresholds.png" />
</Frame>

### Filters

Scope a rule to specific tests or runs:

* Repository
* Branch (useful for quarantining tests failing on `main`)
* Labels (useful for stricter rules on a subset of tests)

<Frame caption="Rule filters">
  <img src="https://mintcdn.com/momentic-docs/74ZfuO1WWXQIVJ6H/images/reliability/quarantine-rule-filters.png?fit=max&auto=format&n=74ZfuO1WWXQIVJ6H&q=85&s=6d447ab3daedba9d49e5ac64690a47dc" alt="Rule filters" className="w-full" width="1014" height="754" data-path="images/reliability/quarantine-rule-filters.png" />
</Frame>
