How to have an agent triage Sentry errors and open a fix PR
Yes. Create a From a webhook automation in Nori and add its URL to a Sentry internal integration used as an alert rule action. Each time the alert fires, Nori starts a coding agent on a fresh machine with your repositories and the alert payload; the agent reproduces the error, opens a fix pull request, and asks for review in a Slack thread. Your branch protection decides what merges.
Prerequisites
Section titled “Prerequisites”- The GitHub App installed, with the affected repositories added under Settings → Environment.
- A connected agent (Claude Code, Codex, or another harness) under Integrations → Token providers.
- The Nori Slack app installed and the bot invited
to the alerts channel, for example
#eng-alerts, plus its channel ID. - Optional but recommended: the Sentry MCP server from the catalog (Integrations → MCPs, OAuth sign-in), so the agent can read the full issue and event history, not only the payload. See MCP servers.
- In Sentry, permission to create an internal integration and alert rules.
- In Nori, open Automations → New automation. Name it, for example
Sentry alert to fix PR. - Under Starts when, choose From a webhook.
- Write the Instructions (see the example). Nori appends each webhook’s JSON payload to them and marks it as untrusted data.
- Under Deliver to, choose Slack thread and enter the
#eng-alertschannel ID. - Save with Create, or Submit for approval if you are a member.
- Open the saved automation and use Copy webhook URL. It has the form
https://<org>.norisessions.com/api/webhook/<automation-id>. Anyone with the URL can start a run, so keep it private. - In Sentry, go to Settings → Developer Settings and create an internal integration. Paste the Nori URL as its webhook URL, turn on Alert Action, and save.
- In Sentry Alerts, create an issue alert for the project, for example
“A new issue is created” in
production, with the action Send a notification via your new integration. Start with one project.
Example
Section titled “Example”Automation instructions:
A Sentry alert fired; the payload is attached.
1. Identify the repository from the release and the culprit path.2. If the Sentry MCP server is connected, read the full issue and the latest event.3. Find the commit that most likely introduced the error.4. Write a failing test that reproduces it.5. If the cause is clear and the fix is small, fix it on a new branch, run the test suite, and open a pull request that links the Sentry issue. Never merge.6. If the cause is unclear or the code is under payments/ or auth/, open no pull request; report what you found instead.
Reply with: cause, PR link (or why there is none), tests run, and what thereviewer should check.The same automation from the CLI:
nori-sessions triggers create --name "Sentry alert to fix PR" --type webhook \ --slack-channel-id C0123456789 --prompt "$(cat sentry-prompt.txt)"Verify it works
Section titled “Verify it works”- On the automation, choose Run now and paste a sample Sentry payload
into Optional JSON payload (CLI:
nori-sessions triggers test --id <id> --payload '<json>'). - Check that a thread opens in
#eng-alertsand that the reply names the right repository. - In Sentry, send a test notification from the alert rule. The automation’s Recent activity shows Latest webhook payload with Sentry’s body.
- When a real alert produces a pull request, review it like any other. Reply in the Slack thread to ask for changes; the same agent continues.
Each delivery queues separately (up to 10 waiting), so an alert storm does not start unlimited runs. See the queue and retries.
this page as markdown: /sessions/recipes/sentry-errors-to-fix-pull-requests.md· index for agents: /llms.txt