Skip to content

fix(observability): include threadId in Slack send failure Sentry events#204

Merged
LIU9293 merged 1 commit intomainfrom
fix/slack-send-threadid-context-04526a90
Apr 24, 2026
Merged

fix(observability): include threadId in Slack send failure Sentry events#204
LIU9293 merged 1 commit intomainfrom
fix/slack-send-threadid-context-04526a90

Conversation

@LIU9293
Copy link
Copy Markdown
Contributor

@LIU9293 LIU9293 commented Apr 23, 2026

Summary

  • Enrich Slack send delivery failures with the target threadId so Sentry events like ODE-DEAMON-7 (IM slack send failed: invalid_thread_ts) are diagnosable without having to correlate with local logs.
  • Only affects the observability path; no behavior change in delivery.

Context

  • ODE-DEAMON-7 only captured channel_id, platform, op — the offending thread id (Slack complained the value was 9223372036854775807, a value never produced by us directly) was lost.
  • With this change, thread_id appears as both a Sentry tag and under the delivery context, so the next occurrence tells us exactly which thread id was passed in.

Changes

  • FailureRecord.threadId added; deliveryStats.recordFailure() accepts an optional threadId.
  • Slack sendMessage now passes the thread id on failure (other ops / other adapters unchanged — update/delete target a messageTs, not a thread).
  • captureDeliveryFailure surfaces thread_id as a tag plus delivery-context field.
  • Added a delivery-stats unit test covering the new field.

Testing

  • bun test packages/ims/shared/delivery-stats.test.ts → 11 pass
  • bun test packages/core/observability/sentry.test.ts → 6 pass
  • bunx tsc --noEmit → no new errors (pre-existing web-ui missing-module warnings only)

The `IM slack send failed: invalid_thread_ts` issue (ODE-DEAMON-7) only
captured channel_id, platform and op — not the thread id the adapter tried
to post into. That made the root cause (a malformed / synthetic thread id
reaching Slack) impossible to diagnose from Sentry alone.

Thread the `threadId` through `deliveryStats.recordFailure` for Slack
threaded sends and surface it as both a tag and delivery-context field in
the Sentry event. Top-level channel sends and update/delete ops leave it
undefined (they don't target a thread).

No behavior change — purely observability.
@LIU9293 LIU9293 merged commit 2e62f41 into main Apr 24, 2026
2 checks passed
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