# 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 review**: your normal code review and continuous integration decide the merge. Closing it is a valid outcome, 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.                                               |
| `approval_required` | The workspace asks before starting automatic fixes, so this run waits for someone to start it from its thread. |
| `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**, an expired or failed one with **Run again**, and a held one with **Approve and run**. Under **Settings > Workspace**, the **Autofix** card holds the **Open autofix pull requests** switch for the whole workspace and **Fixes Polylane starts on its own**, where **Ask first** holds automatic fixes until someone starts them.

## 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 or Conductor under **Settings > Integrations** with your own API key, then turn on **Use Devin for all autofixes** (or the equivalent switch on the Cursor, Factory or Conductor 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. **Approve and run**, **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.
- [Pull request reviews](/detect/pull-request-reviews) for the check every pull request gets before it merges.
- [Repositories](/connect/repositories) for connecting the code autofixes write to.
- [GitHub](/integrations/github) for the code host connection autofixes write through.
