Skip to content

feat(slack): Keep resumed Slack slices in the Turn trace - #2408

Merged
thomasjiangcy merged 1 commit into
feat/slack-turn-ingress-tracefrom
feat/slack-resumed-turn-trace
Oct 30, 2026
Merged

thomasjiangcy merged 1 commit into
feat/slack-turn-ingress-tracefrom
feat/slack-resumed-turn-trace

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Part of #2269. Stacked on #2406.

A Turn that yields, hits the hard timeout, or waits for OAuth continues in a resumed slice. Before this change, a resumed slice did not open a turn span. Its attributes went onto the worker span, and the slice had no connection to the trace of the first slice.

Trace context on the Turn cursor

  • TurnRecord.traceId becomes traceContext ({ sentryTrace, baggage }). Nothing read traceId, and checkpoint.ts overwrote it on each save.
  • The first checkpoint save stores the active trace. Later saves keep it. A later save can come from a different trace, such as lost-worker recovery, so the first value wins.
  • The cursor uses the same tolerant schema as the mailbox entry. A malformed value is dropped and does not reject the cursor. storedTurnRecordSchema uses .strip(), so an older worker ignores the new field.

Resumed slice span

  • getPausedTurnRequest returns the stored trace context. runPausedTurn passes it to resumeSlackTurn.
  • resumeSlackTurn runs in a chat.turn span through withTurnSpan from feat(slack): Put Slack turns in the ingress trace #2406. It continues the stored trace and links to the queue.process worker span. TELEMETRY.md already listed a "resumed chat.turn" under Auth And Resume. This change keeps that name and does not add a new span name or attribute. A resumed chat.turn is a child of the first slice, so you can tell it apart from the first chat.turn by its parent.
  • A Turn without stored trace context, such as a Turn from before this change, gets a chat.turn that is a child of the worker span.

All resume paths (yield, timeout, OAuth, lost-worker recovery) go through runNextPausedTurn, so this covers each of them.

getActiveTraceContext() in logging.ts now gives both the mailbox writer and the checkpoint the active trace in this shape.

Tests
The existing Sentry-client test in conversation-work-telemetry.test.ts gets one resumed-slice case. It saves the first slice in one trace and a later pause in another trace, then runs runNextPausedTurn under a worker span. It checks that the resumed chat.turn is in the first trace, is a child of the first span, and links to the worker span.

via @thomasjiangcy.

--

View Session [Sentry]

@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
junior-docs Ready Ready Preview Oct 30, 2026 3:34am UTC

Request Review

Part of #2269

Co-Authored-By: Thomas Jiang <20501235+thomasjiangcy@users.noreply.github.com>
@github-actions github-actions Bot added the risk: high PR risk score: high label Oct 30, 2026
@thomasjiangcy
thomasjiangcy merged commit 426d676 into main Oct 30, 2026
62 of 64 checks passed
@thomasjiangcy
thomasjiangcy deleted the feat/slack-resumed-turn-trace branch October 30, 2026 03:50

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 90940700 Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant