# Autofix

> Agent-written fixes arrive as pull requests in your repository. You review and merge; Polylane reminds you and tidies up what nobody touches.

An autofix is a pull request Polylane opens to resolve something it found. The agent investigates first, then writes the change on a branch and opens the pull request on GitHub; the merge is yours.

## What it does

Autofixes start from three places. You ask for one in a [thread](/investigate/threads), for example "open a pull request that fixes this". A [fix run](/investigate/fix-runs) lands on a confirmed cause in a connected repository and opens the fix in the same thread. Or Polylane proposes one on its own, such as the observability improvements it drafts when a repository is first connected.

## How it works

1. **Investigate**: the agent gathers context from the topology, telemetry and the affected [repository](/connect/repositories).
2. **Branch**: it creates a branch against the repository's base branch.
3. **Fix**: the executor writes the change and pushes commits.
4. **Pull request**: it opens the pull request describing what was wrong and what changed, linked to the thread or issue behind it.
5. **Your checks**: your team and continuous integration decide whether to merge. Closing the pull request is valid, and Polylane records it.

## Statuses

| Status              | Description                                                                                            |
| ------------------- | ------------------------------------------------------------------------------------------------------ |
| `started`           | The run is under way.                                                                                  |
| `branch_pushed`     | Commits are on the branch and the pull request is about to open.                                       |
| `pr_opened`         | The pull request is open and waiting on your review.                                                   |
| `merged`            | You merged the pull request.                                                                           |
| `closed`            | The pull request was closed without merging, by you or by Polylane.                                    |
| `failed`            | The executor could not produce a fix.                                                                  |
| `no_fix_needed`     | The agent concluded there was nothing to change.                                                       |
| `already_in_flight` | Another run or an open pull request already covers the same fix.                                       |
| `quota_exhausted`   | The workspace cannot start another run right now.                                                      |
| `disabled`          | Autofix is turned off for the workspace.                                                               |
| `plan_rejected`     | The request was rejected before a run started.                                                         |
| `unreachable`       | Polylane can no longer read the repository, for example after the GitHub App was removed or suspended. |
| `expired`           | The run stalled past its time window and was closed out.                                               |

A skipped run can be started from its overview with **Run anyway**, and an expired or failed one with **Run again**. Under **Settings > Workspace**, the **Autofix** card holds the **Open autofix pull requests** switch for the whole workspace.

## Pull requests left open

A pull request Polylane opens does not wait forever. After a week without activity, the weekly sweep sends one reminder by email and in Slack and leaves the same note as a comment on the pull request; when nobody has been asked to review it, the owners of the code it touches are asked. A pull request that sees nothing for another week after the reminder is closed by Polylane with a comment explaining why, and the branch stays, so reopening brings the change back as it stands.

Pull requests opened while a repository is being connected are left out of reminders and closures.

## Executors

The executor is the coding agent that writes the diff. Polylane's own executor needs no setup; you can route autofixes through a coding agent you already use instead:

:autofix-executors

Connect Devin, Cursor, Factory, Conductor, Capy or Amp under **Settings > Integrations** with your own API key or access token, then turn on **Use Devin for all autofixes** (or the equivalent switch on the Cursor, Factory, Conductor, Capy or Amp page) to make it the executor for every autofix in the workspace. If that integration is removed or disabled, autofixes fall back to the Polylane executor.

## Where to find it

Read an autofix on the thread that produced it. The **Lineage** in the thread's sidebar shows the **Autofix** and its **Pull request**, and the autofix node opens **Overview**, **Diff**, **Session**, **Timeline** and **Properties** tabs. **Run anyway**, **Run again** and the close reason live on its overview.

## Related

- [Fix runs](/investigate/fix-runs) for the runs that hand a confirmed cause to autofix.
- [Impact assessments](/detect/pull-request-reviews) for the production check on each pull request.
- [Repositories](/connect/repositories) for connecting the code autofixes write to.
- [GitHub](/integrations/github) for the code host connection autofixes write through.
