> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fix CI failures

> Automatically fix failing CI checks by opening a stacked pull request with the fixes.

export const Hint = ({type, children, headline, tip, href, cta}) => {
  const TIPS = {
    learnings: {
      headline: "Learnings",
      tip: "Review preferences CodeRabbit learns from your chat conversations and applies automatically to future reviews.",
      cta: "Learn about Learnings",
      href: "/knowledge-base/learnings",
      content: "Learnings"
    },
    walkthrough: {
      headline: "PR Walkthrough",
      tip: "A structured comment posted by CodeRabbit at the top of every pull request, summarizing changes, sequence diagrams, review effort, and more.",
      cta: "Learn about PR Walkthroughs",
      href: "/pr-reviews/walkthroughs",
      content: "Walkthrough"
    },
    "finishing-touches": {
      headline: "Finishing Touches",
      tip: "Post-review agentic actions (Autofix, writing docstrings or unit tests, and more) you trigger from a PR comment or a checkbox in the Walkthrough.",
      cta: "See all Finishing Touches",
      href: "/finishing-touches",
      content: "Finishing Touches"
    },
    "coding-plan": {
      headline: "Coding Plan",
      tip: "A detailed, codebase-aware implementation plan CodeRabbit generates from an issue or description, ready to hand off to any coding agent.",
      cta: "Learn about Coding Plans",
      href: "/plan",
      content: "Coding Plan"
    },
    "knowledge-base": {
      headline: "Knowledge Base",
      tip: "The collected context sources CodeRabbit draws on during reviews: Learnings, Code Guidelines, issue trackers, connected MCP servers, and cross-repo analysis.",
      cta: "Explore the Knowledge Base",
      href: "/knowledge-base",
      content: "Knowledge Base"
    },
    "path-instructions": {
      headline: "Path Instructions",
      tip: "Custom review rules that only apply to files matching a glob pattern, e.g. 'src/controllers/**'.",
      cta: "Configure path instructions",
      href: "/configuration/path-instructions",
      content: "Path Instructions"
    },
    "coderabbit-review": {
      headline: "CodeRabbit Review",
      tip: "An improved code inspection interface that reorganizes a pull request from a flat file list into a structured, layer-by-layer walkthrough with range-specific summaries and diagrams.",
      cta: "Learn about CodeRabbit Review",
      href: "/pr-reviews/coderabbit-review",
      content: "CodeRabbit Review"
    },
    scope: {
      headline: "Scope",
      tip: "A named set of repositories, connections, and spend limits that controls what CodeRabbit Agent can access in a given Slack conversation.",
      cta: "Learn about Scopes",
      href: "/slack-agent/scopes",
      content: "Scope"
    },
    "coderabbit-agent": {
      headline: "CodeRabbit Agent for Slack",
      tip: "An AI agent built into Slack that investigates issues, generates implementation plans, and opens pull requests right from the Slack threads.",
      cta: "Explore CodeRabbit Agent",
      href: "/slack-agent",
      content: "CodeRabbit Agent"
    },
    "configuration-inheritance": {
      headline: "Configuration Inheritance",
      tip: "A setting that merges configuration values across multiple levels — repository YAML, central YAML, and UI settings — instead of using only the highest-priority source.",
      cta: "Learn about Configuration Inheritance",
      href: "/configuration/configuration-inheritance",
      content: "Configuration Inheritance"
    }
  };
  const defaults = TIPS[type] || ({});
  return <Tooltip headline={headline ?? defaults.headline} tip={tip ?? defaults.tip} cta={cta ?? defaults.cta} href={href ?? defaults.href}>
      {children ?? defaults.content}
    </Tooltip>;
};

export const OpenBetaBadge = ({tip = "This feature is currently in open beta. We are actively improving it based on your feedback. If you encounter any issues or have suggestions, please share them on our Discord community or visit the support page.", title = "Open Beta", cta = "Contact support", href = "/support", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="badge-alert" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

export const ProPlusPlanBadge = ({tip = "This feature is available as part of the Pro+ plan and Enterprise plan. Please refer to our pricing page for more information about our plans and features.", title = "Pro+ Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="shield-plus" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

export const GitHubBadge = ({tip = "This feature is available on GitHub and GitHub Enterprise.", title = "GitHub", cta, href, disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="github" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

<GitHubBadge /> | <ProPlusPlanBadge /> <OpenBetaBadge />

Failing CI checks stall a pull request and often send you digging through job logs to find what broke. When CI fails on a PR, you can ask CodeRabbit to investigate the failing checks and fix them for you: it reads the failing checks and their output, works through the fix in a sandbox, and opens a stacked pull request with the changes so you can review them before they land.

## Platform support

Fix CI failures is available on GitHub only.

<CardGroup cols={2}>
  <Card title="GitHub" icon="github" horizontal>
    GitHub Cloud and GitHub Enterprise Server (self-hosted).
  </Card>
</CardGroup>

## Usage

Comment on any pull request that has failing CI checks:

```text theme={null}
@coderabbitai fix-ci
```

CodeRabbit investigates the failing checks and opens a stacked pull request targeting your PR branch with the proposed fixes. Merge that pull request into your branch to apply the fix; your original PR's CI then re-runs against it.

<Info>
  Fix CI failures is triggered only by the `@coderabbitai fix-ci` comment. Unlike some other finishing touches, it does not have a checkbox in the <Hint type="walkthrough" /> comment.
</Info>

## How it works

<Steps>
  <Step title="Trigger">
    Comment `@coderabbitai fix-ci` on a pull request that has failing CI checks. CodeRabbit collects the checks reported as failing on the PR's head commit.
  </Step>

  <Step title="Investigate">
    CodeRabbit clones the repository into a sandbox and gathers context for the failing checks: the available failure output and the relevant CI configuration for the jobs that ran. This tells the agent what failed and how each job is invoked, rather than guessing from the check name alone.
  </Step>

  <Step title="Fix">
    A coding agent works directly in the repository, reading files and editing code to address the failures. It focuses on the code under test: infrastructure and configuration files (CI and build config, lock files, and other dependency manifests) are left out of the change and surfaced separately so you can apply them yourself if they are genuinely needed.
  </Step>

  <Step title="Deliver">
    CodeRabbit opens a stacked pull request targeting your PR branch with the fix. The status comment lists the failing checks it addressed and the files it changed.
  </Step>
</Steps>

Because the fix is delivered as a separate pull request, your project's real CI runs against it. That run is the source of truth for whether the failures are actually resolved.

## Re-running the fix

Re-running `fix-ci` behaves like a retry, and where the changes land depends on which pull request you comment on:

* **On the stacked pull request** (the one CodeRabbit opened): if it has its own failing CI checks, CodeRabbit commits the new fix **directly to that pull request** instead of stacking another one on top. This lets you iterate in place until its CI is green.
* **On your original pull request:** CodeRabbit opens a fresh stacked pull request for the current failures.

## Scope and limitations

* **GitHub only.** Fix CI failures is not available on GitLab, Azure DevOps, or Bitbucket.
* **Stacked pull request output.** Fixes are delivered as a new pull request targeting your PR branch, not committed directly to it. If your CI only runs on PRs targeting specific branches (for example `main`), it may not run on the stacked PR itself; merge the stacked PR into your branch and CI validates on the original PR.
* **Infrastructure and dependency files are not committed.** Changes the agent makes to CI/build config, lock files, or other dependency manifests are excluded from the pull request and listed in the status comment so you can apply them manually.
* **Workflow files are excluded.** CodeRabbit cannot commit changes under `.github/workflows/`. If a fix requires editing a workflow file, it is surfaced in the status comment for you to apply.

## Command reference

```text theme={null}
@coderabbitai fix-ci
```

Also accepts `@coderabbitai fix ci` and `@coderabbitai fixci`.

## Configuration

Fix CI failures is enabled by default for eligible repositories. To turn it off, set the following in your `.coderabbit.yaml`:

```yaml theme={null}
reviews:
  finishing_touches:
    fix_ci:
      enabled: false
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="The fix-ci command isn't available" icon="circle-alert">
    Fix CI failures requires a Pro Plus plan and is available on GitHub only. Confirm the repository is on a Pro Plus plan and that the pull request is on GitHub. If it was turned off in configuration, set `reviews.finishing_touches.fix_ci.enabled` to `true`.
  </Accordion>

  <Accordion title="The agent only changed configuration files" icon="triangle-alert">
    Infrastructure, CI/build config, and dependency files are intentionally left out of the stacked PR. If the only changes the agent produced were out of scope, no fix pull request is created; the status comment lists the files it touched so you can apply them manually.
  </Accordion>

  <Accordion title="The stacked PR's CI still fails" icon="git-pull-request-closed">
    The stacked pull request runs your real CI, which may surface remaining or new failures. Comment `@coderabbitai fix-ci` on the stacked pull request to have CodeRabbit commit another fix directly to it, or comment on your original pull request to open a fresh stacked PR. You can also resolve the remaining failures manually.
  </Accordion>
</AccordionGroup>

## What's next

<CardGroup cols={1}>
  <Card title="Finishing Touches overview" href="/finishing-touches" icon="sparkles" horizontal>
    See all available finishing touches and how to trigger them from any PR
  </Card>

  <Card title="Autofix" href="/finishing-touches/autofix" icon="wrench" horizontal>
    Automatically implement fixes for unresolved CodeRabbit review findings
  </Card>

  <Card title="Resolve merge conflicts" href="/finishing-touches/resolve-merge-conflict" icon="git-merge" horizontal>
    Let CodeRabbit analyze the intent behind conflicting changes and commit a clean resolution to your branch
  </Card>
</CardGroup>
