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

# Incident Detection

> Automatically create incident records from rollbacks, hotfixes and reverts.

## How it works

Incident Detection automatically creates incidents when it detects problematic deployments. Incident Detection is enabled and pre-configured by default for every workspace. You can disable or customize the detection rules as needed.

### Rollback detection

Detects when a deployment reverts to a previously deployed version. Sweetr compares the commit history between deployments to identify rollbacks automatically.

| Incident field | Value |
| - | - |
| **Cause deployment** | The first deployment after the version that was rolled back to. |
| **Fix deployment** | The rollback deployment itself. |
| **Detected at** | The time of the rollback deployment. |

For example, given deployment versions `A → B → C → D -> B²`:

* **Cause deployment**: `C` (the first deployment after `B`, where the problem was introduced)
* **Fix deployment**: `B²` (the rollback deployment itself)

### Hotfix detection

Detects incidents based on patterns in pull request titles, branch names, or labels. Configure regular expressions to match your team's conventions.

| Pattern | Description |
| - | - |
| **PR title regex** | Match pull request titles (e.g., `hotfix`, `emergency`). |
| **Branch regex** | Match branch names (e.g., `^hotfix/.+`). |
| **PR label regex** | Match pull request labels. |

| Incident field | Value |
| - | - |
| **Cause deployment** | The deployment immediately before the hotfix deployment. |
| **Fix deployment** | The deployment containing the hotfix pull request. |
| **Detected at** | The time of the hotfix deployment. |

### Revert detection

Detects when a pull request is a revert of a previous change.

| Incident field | Value |
| - | - |
| **Cause deployment** | The deployment that contained the original (now-reverted) pull request. |
| **Fix deployment** | The deployment containing the revert pull request. |
| **Detected at** | The time of the revert deployment. |

## Benefits

> [card] Improves data accuracy
>
> More accurate failure rate on your DORA metrics. Remove manual work from
> incident reporting.

## Related

> [card] [DORA Metrics](https://docs.sweetr.dev/metrics-and-insights/dora.md)

> [card] [Incidents](https://docs.sweetr.dev/platform/incidents.md)

> [card] [Deployments](https://docs.sweetr.dev/platform/deployments.md)

![](https://mintlify.s3-us-west-1.amazonaws.com/sweetrdev/logo.svg)

Ready to make delivery flow again?

[Try now](https://github.com/apps/sweetr-dev/installations/new)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.