stably fix is a headless command that automatically diagnoses test failures and applies AI-generated fixes. Designed for unattended execution, it’s ideal for self-healing CI pipelines, background maintenance agents, and automated test repair workflows.
For interactive debugging, use the Interactive Agent instead.
stably fix is optimized for automated, hands-off repair.How It Works
Run tests
Execute your test suite with
stably test. The Stably Reporter captures failure context — screenshots, traces, DOM snapshots, and logs.AI diagnoses each failure
stably fix analyzes the failure context to determine why each test failed and categorizes the issue.Run ID Detection
stably fix automatically detects which test run to fix using this fallback chain:
- Explicit argument —
stably fix <runId> - CI environment — detected from CI provider variables (GitHub Actions, Azure DevOps, Bitbucket, GitLab, CircleCI, Jenkins, and others via the
env-cilibrary) - Last local run — read from
.stably/last-run.json(written automatically bystably test)
stably test followed by stably fix — no run ID needed.
Diagnosis Categories
Each failure is categorized to help you understand at a glance whether it needs attention or has already been addressed:| 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 |
Monitoring Fix Sessions
Whenstably fix runs, it automatically creates an automation — a real-time view of the agent’s progress visible on the Stably web dashboard. This is especially useful in CI pipelines, Docker containers, and other non-interactive environments where you can’t see the terminal.

- Watch progress live — see the current phase, activity log, and files being fixed
- Send messages to the agent — provide guidance or corrections while the agent works, even in CI
- View the final report — when complete, the automation shows a summary with links to the autoheal report
initializing → triage → fixing → validation → complete
Automation creation is best-effort and non-blocking. If the connection fails, the CLI continues normally — your commands are never interrupted.
Example Output
Example Output
CI Integration
GitHub Actions: Self-Healing Pipeline
Background Agent Integration
Autofix on Scheduled Runs
When running tests on Stably Cloud Runner, you can enable autofix to run automatically after each scheduled run — no CLI invocation needed.Enabling Autofix
From the Dashboard: When creating or editing a scheduled test run, toggle “Auto-fix failing tests”. Instably.yaml: Add autofix: true to any schedule definition:
stably.yaml
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
Fine-tune how the fix agent behaves using theagent.fix section in stably.yaml:
stably.yaml
| Option | Type | Description | |
|---|---|---|---|
maxTurnsPerIssue | number | Maximum AI turns per issue (default: 50) | |
maxParallelWorkers | number | Number of issues to fix in parallel (default: 2) | |
skipAfterConsecutiveUnfixed | number | Skip tests that have failed to fix this many times in a row — saves AI costs on persistently broken tests | |
rules | string | Custom instructions appended to the agent’s system prompt (e.g., selector preferences, coding conventions). Use YAML ` | ` for multi-line rules |