Repository navigation
[3558 by Claude Opus 5.5] Official plugin: Sentry (turn an error into an issue, give the agent the error context) - #3636
Conversation
…the docs page. All the tests I ran pass, but I did not test against a real Sentry organization, and I did not run the full repository suite. What happens with an error - Intake: Sentry sends either an issue webhook (`issue`, action `created`) or an issue-alert webhook (`event_alert`, action `triggered`). Any other kind is ignored. The plugin takes only the issue id and project from the payload, then reads the issue and its latest event back from the configured Sentry's API. One GitHub issue is created per Sentry issue. Later events and alerts for an issue already handed over create nothing and make no API calls. - Issue body: a link to Sentry, built from the settings, and one sentence saying whether a task was started and, if not, why. The error data sits between "Begin" and "End Sentry error data" lines, every line quoted and made inert. It holds the title, culprit, first and last seen, event count, environment, level and the trimmed stack trace. Request data, user fields, cookies, headers, breadcrumbs, other tags, frame variables and source context are never read into the issue. - Stack-trace trimming (`stacktrace.ts`): the main exception first, then up to two causes. It keeps at most 20 frames, choosing in-app frames first, caps lines at 240 characters and the whole trace at 6,000. - Automatic start (`autostart.ts`): off by default. When on, the trigger label is added only if the issue has at least 10 events (default), the latest event's environment is allowed (default: production only), and the repository has a start left today (default cap: 3). The cap is counted per repository and UTC day in `ctx.state`, in one atomic step, so parallel alerts can't go past it. A failed check still creates the issue, without the label, and the body says why. If the issue can't be created, its start is given back. - Sync back (`sync.ts`): on merge, one note on the Sentry issue with the pull request link, and optionally marking it resolved. Each is done once. - Agent context: Sentry's hosted MCP server (`https://mcp.sentry.dev/mcp`) supports the two OAuth sign-in methods ProPR uses, so it is contributed as a read-only server. Its tool list leaves out the write tools, the gateway tool that can run any other tool, Seer, and the breadcrumb, tag-value and attachment tools (they return personal data). The `sentry-error` skill tells the agent to open the issue, read the latest event and reproduce the error before fixing it. Things to know - Event-count limit: an issue webhook arrives with the first event, so its count is usually 1 and the minimum of 10 blocks automatic start. Frequent errors only start work through alert rules that fire on frequency; the README and docs say so. - Undocumented comment endpoint: the endpoint for comments (`POST …/issues/<id>/notes/`) isn't in Sentry's public API reference. I took it from the source of Sentry's own MCP server. The README records this along with the other vendor links I checked. - MCP tool names: these also come from that source code, not from Sentry's documentation. - Self-hosted Sentry: works through the Sentry URL setting, but the hosted MCP server only serves sentry.io organizations, so the agent works from the issue body there. Other changes: the plugin is added to `registry.json` and the registry test, a page is added to `docs/sidebars.ts`, and a row to `docs/docs/features/plugins.md`. I made no preview images, because nothing in the interface changed. Checks run: `plugins:check` ("8 plugins checked"), the plugins package typecheck, and lint on the new plugin and test files. Test results: - all `packages/plugins/test` suites: 117 passed. - `packages/core/test/sentryPluginEvents.test.ts`: 3 passed. - the plugin handler lint, check-plugins, Jira and contributions tests: 45 passed. - the docs manifest and static serving tests: 6 passed. Acceptance criteria - AC1: met — `packages/plugins/test/sentry.test.ts`: one issue with the expected fields, repeats and later alerts create none, unmapped projects do nothing. `packages/core/test/sentryPluginEvents.test.ts`: forged, missing or tampered signatures get 401 and Sentry is never called; a replayed `Request-ID` gets 409. Signed fixtures are in `sentry/fixtures/webhooks.json`. - AC2: met — `sentry.test.ts` tests "automatic start honours the minimum event count and the allowed environments", "…stops at the daily cap per repository and UTC day…" (six parallel deliveries, three started) and "with the setting off no trigger label is ever added…". - AC3: met — `sentry.test.ts` test "personal data never appears in the created issue…" checks the sentinels in `sentry/fixtures/api.json` and `webhooks.json`; the core test checks them against the issue body and Activity. - AC4: met — `sentry.test.ts` test "sync back posts one note on merge when enabled…": one note and resolve on merge, nothing on redelivery, nothing when switched off. - AC5: met — `packages/plugins/sentry/README.md` (setup, permissions, manual smoke-test checklist, vendor links) and `docs/docs/plugins/sentry.md`.
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Sentry intake, guarded automatic starts, merge sync-back, and documentation. It needs changes before merge: the daily counter can reset backwards, and a failed counter update can permanently suppress an issue before creation. ✅ Restricted error data — The issue builder selects diagnostic fields and excludes request data, user context, breadcrumbs, frame variables, and source context. ✅ Verified webhook boundary — The supplied integration tests exercise signature rejection before handler execution and duplicate delivery rejection. ✅ Conservative defaults — Automatic starts default to off, with event-count, environment, and repository-cap guards when enabled. This was a static review; no commands were run. The authoritative check summary has zero failures and five pending checks. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Delayed deliveries reset the daily cap backwards
F2: 🔴 Counter failure strands a pending ticket
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Clarify alert-only automatic startsThe README setup enables issue-created webhooks and then recommends frequency alerts. Because the first webhook permanently deduplicates later alerts, those alerts cannot start an issue already handed over below the threshold. Explicitly recommend disabling issue-created webhooks for frequency-based automatic starts. This is optional documentation clarification: the user-facing documentation already describes the alert-only setup and deduplication behavior. ScoreThe implementation has useful boundaries and substantial fixture coverage, but two recoverable delivery conditions break persistent intake and cap behavior. Both need localized corrections before merge. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 21e5cb5
Summary of ChangesI fixed F1 and F2 in the Sentry plugin and added a regression test for each. Both new tests fail on the previous code and pass now. F1: a delayed delivery could reset the daily cap
F2: a counter failure could leave a pending ticket behind
Other places checked: the Linear and Jira hand-off ( Checks run:
I didn't make preview images, since nothing visible changed. Review digestRisk-tiered paths
Validation evidence
Diff size: 4 files changed, +106/−27 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…on test for each. Both new tests fail on the previous code and pass now.
I fixed F1 and F2 in the Sentry plugin and added a regression test for each. Both new tests fail on the previous code and pass now.
**F1: a delayed delivery could reset the daily cap**
- **Which day a start counts against** (`sentry/autostart.ts`): `decideStart` now takes the time the start is taken (`Date.now()` from `intake.ts`). It no longer uses the webhook's `receivedAt`, which a retried delivery keeps from its first attempt.
- **The stored day never moves back:** if the counter already holds a later day, `takeStart` counts the start against that later day instead of resetting it. That covers a worker whose clock is behind. The day a start was counted against is stored with it, so giving a start back after a failed issue creation still reduces the right day's count.
- **Regression test:** a delivery received before midnight first fails its Sentry read. After midnight, with a cap of 1, a new issue takes the day's start. The old delivery's retry is then created without the label (reason `daily_cap`), the counter stays at the new day with a count of 1, and a third delivery that day is also refused. The test also checks that a clock behind the stored day doesn't reset the count.
- **Test clock:** the three existing tests that count starts now set the clock with `mock.timers` (a Node experimental API). Without that, their dates would depend on the real day the suite runs.
**F2: a counter failure could leave a pending ticket behind**
- **The fix** (`sentry/intake.ts`): `decideStart` and the building of the issue title and body now run in their own `try`. If either fails before `createIssue` is called, the Sentry issue's reservation is deleted and the error is re-thrown, so the delivery can be retried. The building step was moved in because a failure there would otherwise have been reported as "may have been created anyway" and left the ticket pending too.
- **Unchanged:** once `createIssue` has been called, failures are handled as before.
- **Regression test:** writing the counter throws `state_limit`. The delivery fails, no issue is requested and no reservation is left. A retry after the state frees up creates the issue with the label.
**Other places checked:** the Linear and Jira hand-off (`_shared/trackerIssue.ts`) does nothing between reserving and creating, so it doesn't have this bug. I found no other defects. The README's "Automatic start" paragraph now describes both behaviours.
**Checks run:**
- all `packages/plugins/test` suites: 119 passed.
- `packages/core/test/sentryPluginEvents.test.ts`: 3 passed.
- the plugins typecheck and `plugins:check` ("8 plugins checked") pass, and lint is clean on the changed files.
I didn't make preview images, since nothing visible changed.
PR: #3636
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Sentry intake, guarded automatic starts, merge sync-back, and documentation using the existing plugin infrastructure. No verified merge blocker emerged from the supplied code. It is ready to merge within scope, conditional on the remaining validation check. ✅ Conservative automatic starts — Starts default to off; enabled starts check event count and environment before atomically charging the repository’s UTC-day cap. ✅ Restricted issue content — Issue construction selects specific fields and excludes request data, user context, breadcrumbs, frame variables, and source context. Sentinel fixtures exercise these exclusions. ✅ Webhook verification coverage — Receiver tests cover invalid signatures, tampered bodies, replayed delivery IDs, and credential injection to the configured Sentry host. This was a static review of the supplied diff and surrounding context; no commands or tests were run. Current checks report 23 passed, none failed, and one pending. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Clarify frequency-alert setupIn S3: 🟢 Validate vendor contracts liveThe fixtures thoroughly exercise local behavior, but their API responses and endpoint matching are authored together. Running the provided smoke test against a real Sentry organization would independently validate webhook shapes, token permissions, and especially the undocumented notes endpoint. This is useful integration assurance rather than evidence of a demonstrated defect. ScoreThe implementation is scoped, reuses existing infrastructure, and provides substantial coverage of the new behavior. No verified blocker or current check failure remains; live vendor integration has not been independently validated. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
ℹ️ GitHub auto-merge is turned off for this repository, so ProPR merges this PR itself once it is ready (checks passed or no CI configured, and the review goal met). To let GitHub merge it the moment required checks pass, enable Settings → General → Pull Requests → Allow auto-merge. |
AI Implementation Summary
Closes #3558
Branch:
3558/claude-opus-5-5-official-plugin-sentry-tu-20261117-0253-la3Commits: ✅ Changes committed (fed3b92)
AI Processing Completed
Execution Details:
Summary:
I've built the Sentry plugin in
packages/plugins/sentry/and added the docs page. All the tests I ran pass, but I did not test against a real Sentry organization, and I did not run the full repository suite.What happens with an error
issue, actioncreated) or an issue-alert webhook (event_alert, actiontriggered). Any other kind is ignored. The plugin takes only the issue id and project from the payload, then reads the issue and its latest event back from the configured Sentry's API. One GitHub issue is created per Sentry issue. Later events and alerts for an issue already handed over create nothing and make no API calls.stacktrace.ts): the main exception first, then up to two causes. It keeps at most 20 frames, choosing in-app frames first, caps lines at 240 characters and the whole trace at 6,000.autostart.ts): off by default. When on, the trigger label is added only if the issue has at least 10 events (default), the latest event's environment is allowed (default: production only), and the repository has a start left today (default cap: 3). The cap is counted per repository and UTC day inctx.state, in one atomic step, so parallel alerts can't go past it. A failed check still creates the issue, without the label, and the body says why. If the issue can't be created, its start is given back.sync.ts): on merge, one note on the Sentry issue with the pull request link, and optionally marking it resolved. Each is done once.https://mcp.sentry.dev/mcp) supports the two OAuth sign-in methods ProPR uses, so it is contributed as a read-only server. Its tool list leaves out the write tools, the gateway tool that can run any other tool, Seer, and the breadcrumb, tag-value and attachment tools (they return personal data). Thesentry-errorskill tells the agent to open the issue, read the latest event and reproduce the error before fixing it.Things to know
POST …/issues/<id>/notes/) isn't in Sentry's public API reference. I took it from the source of Sentry's own MCP server. The README records this along with the other vendor links I checked.Other changes: the plugin is added to
registry.jsonand the registry test, a page is added todocs/sidebars.ts, and a row todocs/docs/features/plugins.md. I made no preview images, because nothing in the interface changed.Checks run:
plugins:check("8 plugins checked"), the plugins package typecheck, and lint on the new plugin and test files. Test results:packages/plugins/testsuites: 117 passed.packages/core/test/sentryPluginEvents.test.ts: 3 passed.Acceptance criteria
packages/plugins/test/sentry.test.ts: one issue with the expected fields, repeats and later alerts create none, unmapped projects do nothing.packages/core/test/sentryPluginEvents.test.ts: forged, missing or tampered signatures get 401 and Sentry is never called; a replayedRequest-IDgets 409. Signed fixtures are insentry/fixtures/webhooks.json.sentry.test.tstests "automatic start honours the minimum event count and the allowed environments", "…stops at the daily cap per repository and UTC day…" (six parallel deliveries, three started) and "with the setting off no trigger label is ever added…".sentry.test.tstest "personal data never appears in the created issue…" checks the sentinels insentry/fixtures/api.jsonandwebhooks.json; the core test checks them against the issue body and Activity.sentry.test.tstest "sync back posts one note on merge when enabled…": one note and resolve on merge, nothing on redelivery, nothing when switched off.packages/plugins/sentry/README.md(setup, permissions, manual smoke-test checklist, vendor links) anddocs/docs/plugins/sentry.md.Review digest
Acceptance criteria (5 of 5 met, as stated by the agent)
Fixture-based tests: a webhook for a mapped project creates one issue with the expected fields; repeats create none; unmapped projects do nothing; bad signature is rejected before plugin code runs.—`packages/plugins/test/sentry.test.ts`: one issue with the expected fields, repeats and later alerts create none, unmapped projects do nothing. `packages/core/test/sentryPluginEvents.test.ts`: forged, missing or tampered signatures get 401 and Sentry is never called; a replayed `Request-ID` gets 40…Automatic start honours event count, environment and the daily cap; with the setting off no trigger label is ever added.—`sentry.test.ts` tests "automatic start honours the minimum event count and the allowed environments", "…stops at the daily cap per repository and UTC day…" (six parallel deliveries, three started) and "with the setting off no trigger label is ever added…".Personal data fields listed above never appear in the created issue (sentinel fixture).—`sentry.test.ts` test "personal data never appears in the created issue…" checks the sentinels in `sentry/fixtures/api.json` and `webhooks.json`; the core test checks them against the issue body and Activity.Sync back posts once on merge when enabled.—`sentry.test.ts` test "sync back posts one note on merge when enabled…": one note and resolve on merge, nothing on redelivery, nothing when switched off.README with setup, permissions and a manual smoke-test checklist; `docs/docs/plugins/sentry.md`.—`packages/plugins/sentry/README.md` (setup, permissions, manual smoke-test checklist, vendor links) and `docs/docs/plugins/sentry.md`.Risk-tiered paths
packages/plugins/registry.json(+1/−0)packages/plugins/sentry/api.ts(added, +171/−0)packages/plugins/sentry/autostart.ts(added, +79/−0)packages/plugins/sentry/handlers.ts(added, +19/−0)packages/plugins/sentry/icon.svg(added, +1/−0)packages/plugins/sentry/intake.ts(added, +166/−0)packages/plugins/sentry/issueBody.ts(added, +68/−0)packages/plugins/sentry/manifest.json(added, +184/−0)packages/plugins/sentry/settings.ts(added, +77/−0)packages/plugins/sentry/stacktrace.ts(added, +95/−0)packages/plugins/sentry/sync.ts(added, +61/−0)docs/docs/features/plugins.md(+1/−0)docs/docs/plugins/sentry.md(added, +158/−0)docs/sidebars.ts(+1/−0)packages/core/test/sentryPluginEvents.test.ts(added, +122/−0)packages/plugins/sentry/README.md(added, +184/−0)packages/plugins/sentry/fixtures/api.json(added, +1,612/−0)packages/plugins/sentry/fixtures/webhooks.json(added, +76/−0)packages/plugins/sentry/skills/sentry-error/SKILL.md(added, +41/−0)packages/plugins/test/registry.test.ts(+4/−4)packages/plugins/test/sentry.test.ts(added, +339/−0)Validation evidence
Diff size: 21 files changed, +3,460/−4 lines
Detailed Logs:
7cc20725-c64f-4eb8-a07f-ab53afe745f1Log files stored at:
/usr/src/app/logs/executions/issue-3558-2026-11-17T03-12-07-141Z-conversation.json/usr/src/app/logs/executions/issue-3558-2026-11-17T03-12-07-141Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3558.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!