Skip to content

feat: include Sentry event ID in all error responses#307

Merged
dcramer merged 6 commits intomainfrom
jr/unify-error-responses-305
May 7, 2026
Merged

feat: include Sentry event ID in all error responses#307
dcramer merged 6 commits intomainfrom
jr/unify-error-responses-305

Conversation

@sentry-junior
Copy link
Copy Markdown
Contributor

@sentry-junior sentry-junior Bot commented May 7, 2026

Failed Slack turns now have one failure-response contract: capture a Sentry exception, require the returned event ID, and post the static event_id={eventId} message. This removes no-reference and legacy resume fallback messages so live turns, OAuth/MCP resumes, and timeout resumes all expose a real Sentry event when they fail.

Failure Finalization

finalizeFailedTurnReply owns failed reply capture and text replacement before Slack planning. It fails closed if Sentry does not return an event ID instead of rendering event_id=unknown.

Resume Delivery

Resume-level failures now post the same canonical event-ID response after capture. Failure state persists before enforcing that captured event ID so Sentry outages do not leave turn state inconsistent.

Slack Planning

Provider-error replies are no longer decorated with interruption markers after being replaced by the canonical failure response. Failed turns whose model text is rejected as escaped/raw payload keep thread delivery enabled so failure finalization owns the visible response, while successful side-effect-only turns no longer schedule empty thread posts.

Fixes #305

Every turn failure now captures a Sentry exception and includes the
event ID in the user-facing error message.

Changes:
- logging.ts: ErrorReference now requires eventId (traceId optional),
  resolveErrorReference requires an eventId string, added
  buildErrorResponseMessage as the canonical error message builder
- reply-executor.ts: provider_error and execution_failure paths now
  capture the logException return value and rewrite reply.text with
  the canonical error message containing the event ID
- slack-runtime.ts: buildFailureMessage delegates to the canonical
  buildErrorResponseMessage; types tightened throughout
- slack/output.ts: empty-normalization path now throws instead of
  returning a hardcoded fallback, so the runtime catch handler
  captures and includes the event ID

Closes #305

Co-Authored-By: Claude (anthropic/claude-opus-4.6) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment May 7, 2026 10:27pm

Request Review

Comment thread packages/junior/src/chat/runtime/reply-executor.ts Outdated
Addresses advisor review feedback:
- Replace dynamic buildErrorResponseMessage with static template
  buildTurnFailureResponse(eventId) — one format, no conditional parts
- Remove buildExecutionFailureMessage (dead code after executor rewrite)
- Remove ErrorReference/getErrorReference from slack-runtime deps
  (no longer needed for user-facing error path)
- Remove if (eventId) guards in reply-executor — unconditional rewrite
- Remove buildFailureMessage wrapper in slack-runtime
- turn-result.ts uses empty placeholder; executor owns final text

Co-Authored-By: Claude (anthropic/claude-opus-4.6) <noreply@anthropic.com>
Comment thread packages/junior/src/chat/services/turn-result.ts Outdated
Comment thread packages/junior/src/chat/logging.ts
Consolidate failed-turn response finalization so live and resumed Slack turns capture a Sentry exception before user-visible delivery. Remove legacy resume fallback text and fail closed when capture does not return an event ID.

Fixes #305
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Comment thread packages/junior/src/chat/slack/resume.ts
Comment thread packages/junior/src/chat/slack/resume.ts Outdated
Run resume failure callbacks before enforcing that Sentry returned an event ID.

This keeps failure state persisted even when capture is unavailable.

Keep the user-visible response contract fail-closed with no fallback event ID.

Share the event-ID guard with normal turn failure finalization.

Refs #305

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Comment thread packages/junior/src/chat/services/turn-result.ts Outdated
Limit reaction-only text suppression to successful turns.

Failed turns with rejected model text now keep thread delivery enabled.

Failure finalization still owns the visible event-ID response.

Refs #305

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2fa9d64. Configure here.

Comment thread packages/junior/src/chat/slack/output.ts
Do not schedule thread text for successful side-effect-only channel posts.

Failed turns still keep thread delivery so finalization can replace the text.

Refs #305

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
@dcramer dcramer merged commit f668981 into main May 7, 2026
13 checks passed
@dcramer dcramer deleted the jr/unify-error-responses-305 branch May 7, 2026 22:41
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.

Unify error responses with Sentry event ID

1 participant