Skip to content

fix(observability): name captured errors so Sentry titles describe the failure - #5064

Merged
JSONbored merged 1 commit into
mainfrom
fix/5058-generic-sentry-titles
Jul 11, 2026
Merged

fix(observability): name captured errors so Sentry titles describe the failure#5064
JSONbored merged 1 commit into
mainfrom
fix/5058-generic-sentry-titles

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • captureError/captureReviewFailure (src/selfhost/sentry.ts) passed the raw error straight to Sentry.captureException, so every issue title in Sentry read as the generic "Error: ..." — or, for a genuinely caught library exception, that exception's own class name (e.g. "HttpError: ..."). This made the issue list nearly useless for triage: dozens of unrelated failure modes all collapsed into a handful of "Error"/"HttpError" buckets.
  • Added an optional third eventName parameter to both functions via a small namedCaptureError helper that renames the captured error before it reaches Sentry — mirroring forwardStructuredLogToSentry's existing errorEvent.name = event discipline, which already gives structured-log-forwarded issues descriptive titles today.
  • Threaded a descriptive slug (e.g. processing_timeout, agent_merge_blocked, ai_review_inconclusive, queue_pump_crashed) through every captureError/captureReviewFailure call site in src/ — 21 total across server.ts, both queue backends (sqlite-queue.ts, pg-queue.ts), the AI-review pipeline (ai-review-orchestration.ts, processors.ts), and the agent action executor.
  • For call sites capturing a genuinely caught exception (rather than a freshly-constructed new Error(...)) where a stable category name is more useful for grouping than the exception's own class — e.g. an Octokit HttpError from a blocked merge — the new name groups every terminal hold under one readable title (agent_merge_blocked) regardless of which HTTP status caused it; the status/reason stays in the message and context either way.

Closes #5058

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; my diff's changed lines add no new branches (each call site only gained a literal 3rd string argument), and the only new logic (namedCaptureError's if (eventName) branch) is covered by 4 new tests in test/unit/selfhost-sentry.test.ts.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. (N/A — no auth/cookie/CORS/session code touched.)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (N/A — no API/OpenAPI/MCP surface changed.)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. (N/A — no UI changed.)
  • Visible UI changes include a UI Evidence section below. (N/A — backend-only change, no visible UI.)
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs. (N/A — no doc-facing behavior changed.)

Notes

  • Existing test assertions on the affected captureError/captureReviewFailure call sites (agent-action-executor.test.ts, ai-review-advisory.test.ts, queue-2.test.ts, queue-4.test.ts) were updated to expect the new third eventName argument.

…e failure (#5058)

captureError/captureReviewFailure passed the raw error straight to
Sentry.captureException, so every issue title read as the generic
"Error: ..." (or a caught library exception's own class, e.g.
"HttpError: ..."), regardless of what actually failed. Add an optional
eventName parameter that renames the captured error before it reaches
Sentry, mirroring forwardStructuredLogToSentry's existing "event"
naming discipline, and thread a descriptive slug through every call
site across the queue backends, the AI-review pipeline, and the agent
action executor.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.13%. Comparing base (9ba03e0) to head (e65b9ab).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5064   +/-   ##
=======================================
  Coverage   94.13%   94.13%           
=======================================
  Files         465      465           
  Lines       39542    39543    +1     
  Branches    14431    14431           
=======================================
+ Hits        37223    37224    +1     
  Misses       1664     1664           
  Partials      655      655           
Flag Coverage Δ
shard-1 46.49% <81.81%> (-0.02%) ⬇️
shard-2 33.45% <0.00%> (-0.12%) ⬇️
shard-3 31.59% <0.00%> (+0.25%) ⬆️
shard-4 32.65% <27.27%> (-0.03%) ⬇️
shard-5 33.24% <0.00%> (-0.20%) ⬇️
shard-6 45.15% <9.09%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/queue/ai-review-orchestration.ts 100.00% <ø> (ø)
src/queue/processors.ts 95.42% <ø> (ø)
src/selfhost/sentry.ts 99.63% <100.00%> (+<0.01%) ⬆️
src/selfhost/sqlite-queue.ts 99.60% <100.00%> (ø)
src/services/agent-action-executor.ts 96.95% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored self-assigned this Jul 11, 2026
@JSONbored
JSONbored merged commit d7bf5a3 into main Jul 11, 2026
17 checks passed
@JSONbored
JSONbored deleted the fix/5058-generic-sentry-titles branch July 11, 2026 12:14
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.

Sentry issue titles are generic ("Error", "HttpError") instead of describing what failed

1 participant