Skip to main content

Daily Sentry Error Fixes

Schedule a daily Advanced Devin session that pulls new Sentry errors overnight, spawns a fix session for each, and has PRs ready by morning.
AuthorCognition
CategoryAutomations
FeaturesSchedules, MCP, Advanced
1

Connect the Sentry MCP

Before creating your schedule, Devin needs access to your Sentry data.
  1. Go to Settings > MCP Marketplace and search for Sentry
  2. Click Enable and authenticate via OAuth — this grants Devin read access to your Sentry issues, events, and stack traces
  3. Click Test listing tools to verify the connection is working
Once connected, Devin can query your Sentry projects, pull issue details and stack traces, and read breadcrumbs — all from within a session. Learn more about configuring MCP servers.
2

Create the schedule

Go to Settings > Schedules and click Create schedule.
  • Name: Daily Sentry remediation — payments-api
  • Frequency: Daily at 6:00 AM (so fix PRs are ready before standup)
  • Agent: Advanced Devin — this lets Devin spawn a separate session for each error, so fixes run in parallel
  • Slack channel: Select a channel (e.g., #sentry-fixes) so your team gets notified when the run completes and PRs are ready for review
  • Prompt:
3

Seed Knowledge from your codebase and past fixes

Devin writes better fixes when it understands your app’s error patterns. Instead of writing Knowledge entries yourself, run an Advanced Devin session to investigate your codebase and past fixes, then let it create the Knowledge:These entries are automatically recalled when Devin encounters matching errors during scheduled runs — and the scheduled prompt above tells Devin to update Knowledge based on your PR feedback, so it improves over time.
4

What a typical run produces

Each morning, Devin processes the overnight error queue and opens targeted PRs. Here’s what a real session output looks like:
Processed 5 Sentry errors from payments-api (past 24h):

1. TypeError: Cannot read property 'last4' of null (1,892 events)
   Root cause: Stripe webhook delivers `payment_method: null` for
   bank transfer payments. CheckoutReceipt.tsx:34 destructures
   without a null check.
   PR #612: Add null safety to CheckoutReceipt, show "Bank Transfer"
   fallback for non-card payments.

2. TimeoutError: Query timeout after 30s on /api/invoices (743 events)
   Root cause: N+1 query in InvoiceService.getMonthly() — each
   line item triggers a separate product lookup.
   PR #613: Add eager loading for invoice line items with
   Sequelize `include`.

3. RangeError: Maximum call stack size exceeded (412 events)
   Root cause: Circular reference in refund.toJSON() when a
   refund references its parent transaction which references
   the refund.
   PR #614: Break circular ref with a custom serializer,
   add max-depth test.

4-5. Two lower-frequency validation errors — PRs #615, #616.
Each PR includes the Sentry issue link, a description of the root cause, the fix, and a test that would have caught the original error.
5

Tune and iterate

After a week of runs, review what’s working and adjust:Scope the error count. Start with top 5 errors per run. If Devin consistently produces mergeable PRs, increase to 8-10. If fixes need heavy revision, reduce to 3.Filter by project or tag. Narrow the prompt to specific Sentry projects (payments-api, web-frontend) or exclude noisy tags. You can create separate schedules per project if error volumes differ.Learn from results. After a couple of weeks, run an Advanced Devin session to analyze which fixes actually shipped and turn that into Knowledge: