> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/issues/with-ai-features/remediation-campaigns.md). Agents can also search and read this documentation through its [MCP server](https://docs.sonarsource.com/~gitbook/mcp).

# Remediation campaigns

Use Remediation campaigns in SonarQube Cloud to work through backlog issues in steps and review the proposed fixes in one pull request.

Use a Remediation campaign to work through related issues in your main branch and review the proposed fixes together. Choose issues, give SonarQube Remediation Agent a goal, or let it start with the most severe issues in your backlog. The agent works on a separate campaign branch and combines changes into one final pull request (PR).

```mermaid
%%{init: {'theme': 'base', 'themeVariables': {
  'primaryColor': '#E6F2FF',
  'primaryBorderColor': '#126ED3',
  'primaryTextColor': '#111827',
  'lineColor': '#126ED3',
  'clusterBkg': 'rgba(18,110,211,0.06)',
  'clusterBorder': '#126ED3'
}}}%%
flowchart LR
    start["You: create campaign<br/>Choose scope<br/>Add optional instructions"]
    review["You: review<br/>and merge final PR"]

    subgraph agent["Remediation Agent"]
        direction TB
        prepare["Select eligible issues<br/>and plan steps"]
        step["Propose fixes<br/>in a step PR"]
        combine["Merge successful steps<br/>Update final PR"]

        prepare --> step
        step --> combine
        combine -->|More steps| step
    end

    start --> agent
    agent -->|Campaign finished| review
```

Remediation campaigns work with GitHub-bound projects and require a separate Remediation Agent subscription to your SonarQube Cloud Team (annual) or Enterprise plan.

## Prerequisites

Before starting a campaign, make sure:

* You're a member of the SonarQube Cloud organization and have **Browse** permission on the project.
* Your private project is bound to a GitHub repository, and its main branch has been analyzed.
* Your organization admin has enabled **Manual backlog remediation**, selected a valid large language model (LLM) provider key if your subscription uses bring your own key (BYOK), and given the SonarQube Agent GitHub app access to the repository. See [Administer Remediation Agent](https://docs.sonarsource.com/sonarqube-cloud/administering-sonarcloud/ai-features/administer-remediation-agent.md).
* Your organization has remaining Remediation Agent usage allowance. See [Viewing billing or usage information](https://docs.sonarsource.com/sonarqube-cloud/administering-sonarcloud/managing-subscription/viewing-billing-and-usage.md).

Campaigns select eligible issues with an **Open** or **Confirmed** status. They support Java, JavaScript/TypeScript, Python, C#, PHP, and secrets. They can also include eligible [Hunter Agent findings](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/issues/with-ai-features/hunter-agent-findings.md), regardless of language. Generating those findings requires a separate Hunter Agent subscription on your annual Team or Enterprise plan.

## Start a campaign

A campaign targets up to 200 eligible issues, grouped into steps. Choosing the whole backlog does not mean that every issue is included or fixed.

1. Open your project's **Issues** page and select the main branch.
2. If you want to fix specific issues, select them in the issues list.
3. Select **Start a campaign**.
4. Under **Recommended issues to be fixed**, select any scope you want to apply:

   | Checkbox                      | Scope                                                                                                                  |
   | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
   | **Issues I selected**         | Issues selected in the issues list                                                                                     |
   | **Assigned to me**            | Issues assigned to your SonarQube Cloud account                                                                        |
   | **Blocking the quality gate** | Eligible issues scoped to the failing quality gate; if only new-code conditions fail, the campaign focuses on new code |

   Leave all checkboxes cleared to use the whole backlog.
5. Optionally, under **Specify instructions for the agent**, describe a goal using up to 1,800 characters. For example, enter `Fix null pointer issues in the billing module`.
6. Select **Create campaign**.
7. Open **Agent activity** to follow the campaign.

With no scope selected and no instructions, the agent starts with the most severe eligible issues in your backlog. The campaign starts automatically after preparation. You do not need to approve its plan or each step PR.

## Follow a campaign

For each step that produces changes, the agent opens a PR into the campaign branch. It can merge the step PR automatically into that branch, then continue from the updated code. Steps run one at a time. A step that cannot produce a fix can be skipped or closed without stopping the campaign.

Open your project's **Agent activity** page and find the entry with **Campaign** as its source.

Expand the campaign entry to see its steps and links to their PRs. Check each step's outcome and any explanation of why it was skipped or closed. Steps that close without merging are not part of the campaign's result.

When the campaign shows **Completed**, open the final PR to review its results. **Completed, no changes** means that no step produced a change for a final PR. If the campaign shows **Could not be prepared**, read the explanation on its entry before trying again.

## Review and merge the fixes

The agent opens the final PR after the first step merges and updates it as more steps finish. While the campaign runs, its title starts with `[In progress]` and its description asks you not to merge yet. Wait for the campaign to finish before reviewing the complete result.

When the campaign ends, the description summarizes the issues and steps included in the result. It links each step's PR and commit, or explains why the step was closed. Check the **Result** and **Not done** lines for work that still needs attention.

1. Open the final PR from **Agent activity**.
2. Review the proposed changes and the summary of step outcomes.
3. If changes are needed, post review comments on the final PR. The agent automatically follows up on eligible comments. See [Review comment follow-up](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/issues/with-ai-features/pull-request-fix-suggestions.md#review-comment-follow-up).
4. Merge the PR when you're satisfied with the changes and it meets your repository's requirements.
5. Check the next main branch analysis to confirm which issues are resolved. If analysis does not run automatically, run your usual main branch analysis.

A completed campaign does not mean every targeted issue was fixed or that every quality gate condition passes.

## Stop a campaign

On **Agent activity**, open the campaign's actions menu and select **Stop this campaign**. The agent stops the remaining work and closes the open step PR and the final campaign PR, if one exists. Changes already merged into the campaign branch remain there.

A stopped campaign cannot be resumed. Review its existing changes before starting another campaign for the remaining issues.

## Troubleshoot a campaign

* **The campaign action is missing:** Check the prerequisites with your organization admin, including the GitHub binding, repository access, and **Manual backlog remediation** setting.
* **The campaign action is disabled:** Check your organization's remaining Remediation Agent usage allowance.
* **A step fails or closes without merging:** Check its details in **Agent activity** and open its PR, if one exists. For CI failure recovery on GitHub Actions, see [CI/CD failure recovery](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/issues/with-ai-features/pull-request-fix-suggestions.md#cicd-failure-recovery).
* **No changes were produced:** Review the step outcomes and remaining issues. Choose another eligible scope or fix the issues manually.

## Related pages

* [Backlog fix suggestions](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/issues/with-ai-features/backlog-fix-suggestions.md)
* [Pull request fix suggestions](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/issues/with-ai-features/pull-request-fix-suggestions.md)
* [Administer Remediation Agent](https://docs.sonarsource.com/sonarqube-cloud/administering-sonarcloud/ai-features/administer-remediation-agent.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/issues/with-ai-features/remediation-campaigns.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
