Skip to content

feat(code): Sentry error watcher with automatic bugfix creation - #26

Open
danii1 wants to merge 3 commits into
mainfrom
feature/sentry-error-watcher
Open

feat(code): Sentry error watcher with automatic bugfix creation#26
danii1 wants to merge 3 commits into
mainfrom
feature/sentry-error-watcher

Conversation

@danii1

@danii1 danii1 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add provider-neutral error-monitor polling and Sentry as the first adapter
  • Configure one or more sources through [[error_monitors]] in workspace.toml
  • Route every monitoring project explicitly to its owning repository, with optional team context
  • Support independent credentials per source through env_file and [error_monitors.env]
  • Run fixes through the current fleet pipeline: isolated worktree, agent, commit, and PR

Workspace configuration

[[error_monitors]]
id = "api-production"
provider = "sentry"
repo = "backend"
team = "platform" # optional
organization = "acme"
project = "api"
query = "environment:production level:error"
poll_interval = 60
min_occurrences = 5
max_per_tick = 3
env_file = "env/sentry-api.env" # contains SENTRY_AUTH_TOKEN

Add one entry per Sentry project. repo is required when the workspace has multiple repositories. Source IDs namespace durable deduplication, so identical Sentry issue IDs from different projects cannot collide.

A Sentry DSN is not used here: DSNs ingest events, while issue polling requires an auth token plus organization/project slugs.

Extensibility

ErrorMonitorProvider normalizes provider-specific issues and rendering. ErrorMonitorAcquirer owns polling, occurrence thresholds, lifecycle, deduplication, deferral handling, and dispatch. Adding Datadog therefore only requires another configuration union member and provider adapter/factory case.

Validity and deduplication

An issue must meet the configured occurrence threshold and pass the provider actionability check. It is claimed before execution to prevent duplicate fixes. Failed fix attempts remain handled; capacity-deferred attempts are unclaimed and retried on a later poll.

Validation

  • Merged current main; PR is conflict-free
  • bun run format
  • bun run lint
  • bun run typecheck
  • Full @getdevintern/code test suite
  • Focused Sentry/workspace tests: 68 passing
  • Workspace, worker, and Sentry documentation updated

The monorepo-wide suite additionally encountered one unrelated flaky agent-harness process-group test; the complete code-package suite passes.

danii1 added 3 commits August 21, 2026 15:14
New `devintern sentry` command (and worker-mode acquirer) polls Sentry
for unresolved error groups and turns valid ones into bugfix tasks run
through the standard pipeline.

- Minimal Sentry API client (sentry.io + self-hosted via SENTRY_BASE_URL)
- Validity gate: min event count, actionable metadata, optional injected
  validator; the pipeline clarity check remains the final gate
- Deduplication: handled group ids persist in queue.db processed_events
  and are marked before execution, so restarts, overlapping ticks, and
  failing runs never re-process the same error across modes
- Worker auto-registers the acquirer when SENTRY_AUTH_TOKEN + SENTRY_ORG
  are configured; standalone and worker modes share dedupe state
The shim had only 250ms to spawn sh, fork sleep, and write the child
pid before the timeout fired, so the pid-file read hit ENOENT on loaded
machines and failed the pre-push suite. 2000ms keeps the assertion
meaningful while leaving realistic startup headroom.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant