Overview
Autofix automatically diagnoses test failures and generates code fixes after a scheduled run completes. When enabled, Stably’s AI analyzes why your tests are failing, categorizes each issue, and applies targeted repairs to your test code — all without manual intervention. This is ideal for teams that want their scheduled test suites to stay healthy overnight without waking anyone up.How It Works
AI diagnoses each failure
Stably analyzes the failure context — screenshots, traces, DOM snapshots, and logs — to determine why each test failed.
Enabling Autofix
From the Dashboard
When creating or editing a scheduled test run, toggle “Auto-fix failing tests” to enable autofix for that schedule.In stably.yaml
Add autofix: true to any schedule definition:
stably.yaml
Diagnosis Categories
When autofix runs, it categorizes each failure into one of the following:| Category | What it means |
|---|---|
| Test Outdated | The test references selectors or flows that have changed in your app |
| Actual Bug | The test caught a real bug in your application |
| Unstable | The test fails intermittently due to timing or race conditions |
| UI Change | The UI changed intentionally and the test needs to reflect the new design |
| Miscellaneous | Other issues that don’t fit the categories above |
Viewing Results
After autofix completes, results appear in your test runs table under the “Diagnosis & Fix” column:- Fixing — autofix is still running
- Diagnosed — analysis is complete, with issue counts by category
- Review fix — click to see the full report and code changes
- No fix available — the issue was identified but couldn’t be automatically repaired
- Each failing test with its diagnosis
- The code changes that were applied
- A link to the generated pull request (if your repo is connected to GitHub)
Configuration
You can fine-tune how the fix agent behaves using theagent.fix section in stably.yaml:
stably.yaml
| Option | Description |
|---|---|
maxTurnsPerIssue | Maximum AI turns per issue (default: 50) |
maxParallelWorkers | Number of issues to fix in parallel (default: 2) |
skipAfterConsecutiveUnfixed | Skip tests that have failed to fix this many times in a row — saves AI costs on persistently broken tests |
rules | Custom instructions for the fix agent (e.g., selector preferences, coding conventions) |
Running Autofix Manually
You don’t have to wait for a scheduled run. You can run autofix anytime from the CLI:stably fix CLI reference for details on run ID detection, CI integration patterns, and more.