| Classic Auto-Heal | Autofix (Agent 2.0) | |
|---|---|---|
| When | During test execution | After a test run completes |
| What it fixes | Broken locators, flaky screenshots | Any test failure — selectors, flows, timing, auth, config |
| How | Retries the failing action with AI-suggested alternatives | Multi-agent orchestrator triages, diagnoses, and edits your test code |
| Output | Test passes in the current run (healed inline) | Code changes committed to your repo (optionally as a PR) |
| Setup | Enable in project settings + stably.config.ts | stably.yaml — autofix: true or stably fix CLI |
Classic Auto-Heal (action-level healing during runs)
Classic Auto-Heal (action-level healing during runs)
Classic auto-heal runs during test execution. When a single action fails, Stably’s AI attempts the smallest safe fix inline so the run can continue. It covers two categories:
- Locator healing — requires
describe()on your locators. When a described locator fails, AI uses the description + page context to find the updated element. - Screenshot healing — distinguishes benign render variance (font hinting, subpixel shifts) from real UI changes in
toHaveScreenshot()assertions, suppressing false positives automatically.
stably.config.ts via the autoHeal option. See the Stably SDK setup guide for details.Autofix — Agent 2.0 (post-run code repair)
Autofix runs after a test run completes. Instead of patching actions inline, it edits your actual test code — updating selectors, rewriting flows, fixing timing issues — and optionally opens a PR. If the test caught a real bug in your application, Autofix can even fix your application code directly. Under the hood, Autofix uses an orchestrator pattern with specialized AI subagents:Triage
A triage agent groups failing tests by likely root cause into issues and classifies each one:
Tests that were already fixed 2+ times for the same root cause are automatically skipped to save cost — you’ll just be prompted to accept the already-opened PRs from previous autofix runs.
Actual bug in your application
Actual bug in your application
The test caught a real bug in your product code. Autofix can fix the application code directly and open a PR — or flag it for your team to investigate.
Minor test update needed
Minor test update needed
The test has a flaky locator, timing issue, or small selector change. Autofix patches the test code with a targeted fix (e.g., updating a
data-testid, adding a wait).Major test rewrite needed
Major test rewrite needed
Your application had a significant update — a redesigned flow, new pages, or restructured UI. Autofix rewrites the affected test steps to match the new application behavior.
Test update workers
Each issue is assigned to a specialized worker:
- Test editor — diagnoses failures from traces, screenshots, and DOM snapshots, then applies targeted fixes (can run in parallel).
- Browser inspector — opens a live browser to inspect page state, debug locators, and verify fixes (runs sequentially).
Validate
Fixed tests are re-run to confirm the repair actually works. Each fix includes a trace proof you can inspect in the dashboard.


Diagnosis categories
Every failure is classified so you can understand at a glance what happened:| Category | What it means |
|---|---|
| Test Outdated | Selectors or flows changed in your app |
| Actual Bug | The test caught a real application bug |
| Unstable | Intermittent failure due to timing or race conditions |
| UI Change | Intentional UI change — test needs updating |
| Miscellaneous | Other issues |
Smart skip logic
Autofix tracks its own history. If a test has been “fixed” 2+ times for the same root cause but the fix keeps being reverted or rejected, Autofix skips it on the next run. This prevents wasting AI budget on persistently broken tests that need manual attention.Enabling Autofix
CLI — run after any test execution:stably.yaml:
stably.yaml
autofix: true when triggering a run:
stably.yaml
Configuration
Fine-tune the fix agent instably.yaml:
stably.yaml
| Option | Type | Description |
|---|---|---|
maxBudgetUsd | number | Max spend per fix session (default: 50) |
maxTurnsPerIssue | number | Max AI turns per issue (default: 50) |
maxParallelWorkers | number | Parallel code-workers (default: 2) |
skipAfterConsecutiveUnfixed | number | Skip tests unfixed this many consecutive runs |
rules | string | Custom instructions for the fix agent (selector preferences, coding conventions) |
Next Steps
Auto-fixing Tests (CLI)
Full guide on
stably fix — run ID detection, CI integration, and monitoringAutofix on Scheduled Runs
Enable autofix for scheduled cloud runs
Test Reporter
View healed actions and fix reports in the dashboard
Cursor/Claude Code Templates
Generate tests with
describe() annotations built in