How Autofix works
Autofix works in rounds. Each round pushes one commit to the branch, or adds a reply that tells why it did not. Autofix replies in each thread it works on, so you can see what happened to your comment:- Fixed. The reply starts with
Fixed inand the commit, then says what the change does. - A question first. The reply starts with
A question before changing the code:. Autofix asks before a change it judges big, a change that reaches past what the comment names, or a change a reviewer would want to agree to first. It also asks when it can’t tell what the comment wants. The question says what Autofix would do. Autofix makes no change for that thread until someone who can push answers. - Answered. The reply starts with
Answered without changing the code.Autofix uses it when the comment is a question, or when the code already does what the comment asks for. - Not fixed. The reply starts with
Couldn't fix this.,Left as is., orChange not pushed., then gives the reason.
- someone who can push to the repository adds a comment,
- a Upsun Dispatch review completes, or
- another merge request or pull request merges into the target branch and causes a conflict.
Turn on Autofix for one merge request or pull request
Use one of these methods:- Add a comment. Write
@upsun-dispatch autofix. To give instructions, add them after a colon, for example@upsun-dispatch autofix: keep the retry limit. Start the comment with the mention. - Add the label. Add the
Dispatch Autofixlabel. This method is available on GitLab and GitHub only. Upsun Dispatch creates the label the first time it turns on Autofix in a project or repository. To add the label before then, create it on the Labels page. - Use the Upsun Dispatch console. On the run page of a Code review or Issue to code run, select the Enable Autofix checkbox in the header. Only an organization owner or admin can change this checkbox.
@<configured-bot-username> autofix. This applies to every Autofix command on this page.
Autofix commands can carry instructions, as in the example above. This is different from Code review commands such as @upsun-dispatch review, which must be the whole comment.
Upsun Dispatch confirms the change:
While Autofix is on, the run page in the Upsun Dispatch console shows the Autofix on badge.
Turning Autofix on starts the first round right away. If there is nothing to fix yet, Autofix says so in a note and waits for the next comment or review.
To skip this step for the merge requests and pull requests that Issue to code opens, see Turn on Autofix for new merge requests and pull requests.
Turn on Autofix for new merge requests and pull requests
Upsun Dispatch can turn Autofix on automatically for the merge requests and pull requests that Issue to code opens. This works for GitLab, GitHub, and Bitbucket.- In the Upsun Dispatch console, go to Workflows > Issue to code.
- Turn on Autofix for new merge requests. The label can also read Autofix for new pull requests or Autofix for new merge and pull requests.
- GitLab: Issue to code opens the merge request with the
Dispatch Autofixlabel, and the first Autofix round starts right away. - GitHub: Issue to code opens the pull request, posts
Autofix is on for this pull request., and adds theDispatch Autofixlabel. The first round starts on the next trigger, usually when the Upsun Dispatch review completes. - Bitbucket: Issue to code opens the pull request and posts
Autofix is on for this pull request.The first round starts on the next trigger, usually when the Upsun Dispatch review completes.
Run one round only
Write@upsun-dispatch update or @upsun-dispatch fix. Autofix does one round and does not stay on. To give instructions, add them after the command, for example @upsun-dispatch fix the failing lint job.
If Autofix is already on, it stays on after the round.
To stop a round that is running, write @upsun-dispatch cancel. Autofix stays on. The same comment also stops a Code review that is running on the merge request or pull request.
Turn off Autofix
Use one of these methods:- Write
@upsun-dispatch autofix off. - Remove the
Dispatch Autofixlabel. This method is available on GitLab and GitHub only. - In the Upsun Dispatch console, clear the Enable Autofix checkbox on the run page.
Autofix is off for this merge request. or Autofix is off for this pull request.
Autofix also turns off when you close or merge the merge request or pull request. If you open it again, Autofix stays off.
Permissions
In the Upsun Dispatch console, only an organization owner or admin can use the Enable Autofix checkbox.
Whose comments Autofix reads
Autofix reads only comments from people who can push to the repository: the Developer role or higher on GitLab, and write access on GitHub and Bitbucket. It also reads the findings of a Upsun Dispatch review. A comment from someone who can’t push does not start a round, and Autofix does not act on it. When that person asks for a change in a thread, Autofix replies once to say so. Anyone who can push can then ask for the change.Comments from other bots
Autofix treats another bot, such as a second review bot, like any other author. By default it does not read the bot’s comments. GitHub. Trust the bot on the repository:- In the Upsun Dispatch console, open the repository and go to Trusted bots.
- Find the bot in the list. A bot shows there after it has commented on one of the repository’s pull requests. The list shows each bot’s name, when it was last seen, and whether it is Trusted or Not trusted.
- Select Trust, then confirm with Trust bot.