Creating pull requests for errors with AI SRE

AI SRE can read your code, write fixes, and open pull requests. To enable this, connect the GitHub integration with contents: write and pull_requests: write permissions.

Who will be seen as author?

Pull requests are opened by the Better Stack GitHub App, not on your behalf. The author of the pull request will be the app, not the user who initiated the fix.

Creating pull requests for errors

The fastest way to fix a bug is to start from an error report in Better Stack.

In Errors, find an error pattern you want to fix.

Click Create pull request.

Create pull request button in Error

AI SRE opens a new chat and begins the process automatically:

  1. It starts with the full error context, including the stack trace, breadcrumbs, and occurrence counts.
  2. Clones the linked GitHub repository into a fresh sandbox environment. AI SRE runs in an isolated environment per conversation—your code is only accessible to that conversation and is wiped when the conversation ends.
  3. Creates a new branch named ai-sre/fix-<short-hash>-<random>.
  4. Investigates the error by reading the relevant files and traces it to its root cause.
  5. Writes and validates a minimum-viable fix.
  6. Opens a pull request with a clear title and a description linking back to the error and the AI SRE conversation.

Pull request creation in chat

The new pull request is automatically linked to the error pattern in Better Stack, so anyone viewing the error can see that a fix is in progress.

Pull request example

Application must be linked to a GitHub repository

The "Fix with AI" button only appears for errors from applications that have a GitHub repository linked in their settings.

No external integrations during a pull request fix

To stay focused, AI SRE deliberately skips tools like Sentry, Linear, and Datadog during this specific workflow. It still has full access to GitHub and its standard toolset.

Concurrency is handled

If a teammate clicks "Fix with AI" on the same error while a fix is in progress (within a 15-minute window), they will join the existing conversation instead of starting a duplicate one. It's safe to click again.

Interactive code assistance

You can also work with code interactively in any chat. Ask AI SRE to:

  • List repositories connected to your team.
  • Clone a specific repository by name or by the source it's linked to.
  • Read and edit files inside the sandboxed environment.
  • Open a pull request with the changes when you are ready.

Each step appears as a collapsible card in the chat, so you can see exactly what the agent is doing.