Auto-fix
Let Claude Code fix your production errors and open the pull request
When Errilo reports a new error or a regression, a GitHub workflow starts Claude Code. The agent reads the issue over MCP, reproduces the error with a failing test and fixes it. The workflow opens a pull request and marks the issue resolved in the next release. One workflow file to copy, nothing to install.
Errilo is in development. The workflow runs today against app.errilo.com: we tested it end to end on 18 November 2026 on a demo repository. The source is on GitHub: geterrilo/examples.
How it works
Three services talk to each other: Errilo, which catches the error and serves it over MCP; GitHub Actions, which runs the workflow in your repository; and Claude Code, the agent, which runs inside the workflow.
From Errilo to GitHub Actions: New issue or regression: the alert sends a
repository_dispatchwith the issue ID.From GitHub Actions to Errilo: Reads the issue with the project token and checks that it should be fixed.guard
From GitHub Actions to Claude Code: Starts Claude Code with the
fix_issueprompt and a read-only GitHub token.fixFrom Claude Code to Errilo: Reads over MCP the stack trace, the events and the commit of the release.fix
In Claude Code: Checks out that commit, writes a failing test, fixes the code, commits locally.fix
From Claude Code to GitHub Actions: Hands back its commits and a summary, exported as a patch.fix
In GitHub Actions: A job without the agent pushes
errilo/fix-<id>and opens the pull request.pull-requestFrom GitHub Actions to Errilo: Comments with the link and marks the issue “resolved in the next release”.pull-request
The workflow has three jobs, and the agent only runs in the middle one. guard decides whether the issue should be fixed. fix runs Claude Code with a GitHub token that can only read: it can neither push nor open a pull request. pull-request pushes the agent’s commits to a dedicated branch and opens the pull request, without the agent.
You review and merge the pull request like any other. If the error comes back once the fix is deployed, Errilo reopens the issue as a regression and alerts again: a new run starts.
There is no code of ours to install: one workflow file that uses anthropics/claude-code-action, maintained by Anthropic, and the Errilo MCP server. Copy it, read it, change it.
What you need
- An Errilo project that receives the errors of your app.
- Admin access to the GitHub repository (on github.com: GitHub Enterprise Server isn’t supported).
- An Anthropic API key, or a Claude Pro or Max subscription.
- Tests the agent can run in GitHub Actions: it fixes by reproducing the error with a failing test.
1. Send releases with their commit
The agent fixes the code at the version that crashed. Errilo knows that version when your Sentry SDK sends a release and the release has a commit. A release that is a commit SHA is enough:
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: process.env.GIT_SHA,
});Otherwise, record the commit when you deploy:
sentry-cli releases set-commits "$RELEASE" --autoWithout a release, the agent works from the default branch, and Errilo can’t mark the issue “resolved in the next release”. The pull request is still opened.
2. Create an Errilo token for the project
In Errilo, open Settings, API tokens, New token. Choose the project of this repository and tick issues:read and issues:write.
The token only sees this project. The workflow reads the issue with it, the agent reads the stack trace and the events, and the last job writes the comment and the status. It is shown only once: keep it for step 4.
3. Add the workflow
Copy the workflow to your repository, on the default branch: GitHub only starts repository_dispatch workflows from there.
mkdir -p .github/workflows
curl -o .github/workflows/errilo-auto-fix.yml \
https://raw.githubusercontent.com/geterrilo/examples/main/auto-fix/errilo-auto-fix.ymlThen add your project’s setup to the fix job, where the commented block after the checkout is, so that the agent can install the dependencies and run your tests:
# Your project's setup, after the checkout of the fix job
- uses: actions/setup-node@v6
with:
node-version: 24
- run: npm ci4. Add the secrets
In the repository, open Settings, Secrets and variables, Actions:
| Name | Kind | Value |
|---|---|---|
ANTHROPIC_API_KEY | Secret | Your Anthropic API key. Or, instead, the next one. |
CLAUDE_CODE_OAUTH_TOKEN | Secret | A Claude subscription token (Pro or Max), created with claude setup-token. |
ERRILO_TOKEN | Secret | The Errilo token from step 2. |
ERRILO_ORG | Variable | Your organization slug: the first segment of your Errilo URLs (app.errilo.com/<slug>/…). |
ERRILO_AUTOFIX_GITHUB_TOKEN | Secret | Recommended: the token that opens the pull request, see below. |
ERRILO_MAX_PRS_PER_DAY | Variable | Optional. Cap on pull requests opened in 24 hours, 3 by default. |
Also turn on Settings, General, Automatically delete head branches. The workflow skips an issue while its errilo/fix-<id> branch exists: a branch left after a merge would block the next attempt on a regression.
Why ERRILO_AUTOFIX_GITHUB_TOKEN? Without it, the pull request is opened with the workflow’s GITHUB_TOKEN. GitHub then only lets it open pull requests if Allow GitHub Actions to create and approve pull requests is on (in the organization, then in the repository), and doesn’t run your CI on that pull request. A fine-grained token on this repository only, with Contents and Pull requests in read and write, avoids both. Only the last job receives it, never the agent.
5. Connect the Errilo alert
On GitHub, create a fine-grained personal access token for this repository only, with Contents in read and write (GitHub requires it to send a repository_dispatch), and a short expiry. For a repository of an organization, choose the organization as Resource owner; otherwise GitHub answers 404.
In Errilo, open the project, then Alerts, Create a rule, channel GitHub: the repository (owner/name), the token, and the triggers New issue and Regression. The workflow ignores spikes.
Click Send a test alert: a run appears in the Actions tab of the repository and stops at once with “test alert received”. The wiring works.
6. Try it on one issue
You don’t have to wait for a new error. In Actions, Errilo auto-fix, Run workflow, enter the ID of an issue (the number at the end of its Errilo URL).
The run opens a pull request named fix: Errilo issue <id>, with the diagnosis, the fix and the test the agent added. In Errilo, the issue shows a comment with the link and the status “resolved in the next release”.
Tested on 18 November 2026 on a demo repository with two bugs (an unknown discount code and an empty cart), each sent to Errilo by a real crash. Each run reproduced its bug with a test, opened the pull request and resolved the issue in Errilo.
If the agent can’t reproduce the error, or isn’t sure of its fix, it opens nothing and writes why in the run summary.
Safeguards
- Pull request only. The agent can’t push. A separate job pushes to
errilo/fix-<id>, never with--force, never to the default branch. Protect your default branch as well. - No change to workflows. A fix that touches
.github/is refused. - Minimal permissions. None at the workflow level,
contents: readfor the agent, write access only for the job that opens the pull request. - One run per issue. Errilo delivers alerts at least once, so the same issue can arrive twice. Runs are grouped by issue, and a run stops if the issue’s branch exists: a duplicate never opens a second pull request.
- Daily cap. 3 pull requests in 24 hours by default, checked before the agent starts and again before the pull request opens.
- Untrusted payload. The alert carries text from your errors, such as the title. The workflow reads it through environment variables and only uses the issue ID, after checking it is a number. A crafted title can’t run a command.
- Untrusted event content. Error messages, breadcrumbs and tags come from your users, maybe from an attacker. Errilo marks them as untrusted data, and the
fix_issueprompt tells the agent never to follow instructions found in them. - Only your code. No fix when the stack trace only has frames from
node_modulesor Node.js internals: the agent reports a dependency bug instead. - Only real issues. Test alerts, spikes and issues already resolved or ignored are skipped.
What it costs
Errilo charges nothing for the MCP server or for this workflow, on every plan, the free one too. The agent runs on your Anthropic account: billed by token with an API key, or counted against your plan’s limits with a Claude subscription. Runs also use GitHub Actions minutes.
For scale: on the demo bug (an unknown discount code that crashes a cart function), a run took 7 agent turns, 30 seconds, and the action reported $0.08. A real code base costs more: the agent reads more code and runs a longer test suite.
Three settings bound the cost: the daily cap on pull requests, --max-turns in the fix job (80 by default) and timeout-minutes (45).
Limits
- Review every pull request. The agent writes a test that reproduces the error, but a passing test doesn’t prove the fix is right.
- Without
ERRILO_AUTOFIX_GITHUB_TOKEN, your CI doesn’t run on the pull request: close and reopen it to start the checks. claude-code-actiononly runs for a person: the token of step 5 must belong to a GitHub user, not to a GitHub App.- One issue per run. An alert that groups several issues sends one dispatch per issue, 10 at most.
Want another model or another agent? Set --model in the claude_args of the fix job. Or replace Claude Code with any agent that speaks MCP: give it the same MCP configuration and instructions, and keep the read-only token. The guard and pull-request jobs don’t depend on the agent.
To use the MCP server from your editor instead, read Agents and MCP. Comparing with Sentry’s AI agent? Read Errilo as a Sentry Seer alternative.