Skip to content

Pause/resume turns missing footer and cumulative stats #384

Closed

Description

@sentry-junior

Timeout continuation ("I'm still working on this in the background…") has two footer/diagnostics gaps:

1. Pause notice posts with no footer

When a turn times out and the continuation notice is posted, it goes out as raw text with no Slack footer. Neither reply-executor.ts nor slack-resume.ts attaches blocks or a footer to the pause message, so there is no conversation ID / Sentry trace link.

  • reply-executor.ts posts via thread.post(buildSlackOutputMessage(buildTurnContinuationResponse())) — no footer
  • slack-resume.ts posts via postSlackApiMessage({ text: buildTurnContinuationResponse() }) — even more raw

At minimum, the pause notice should include a conversation ID footer with the Sentry trace link so the turn is traceable.

2. Resumed turn footer only reflects the final slice

When the resumed slice completes, slack-resume.ts builds the footer from only that slice's reply.diagnostics:

const footer = buildSlackReplyFooter({
  durationMs: reply.diagnostics.durationMs,
  usage: reply.diagnostics.usage,
  ...
});

Duration and token counts are per-invocation — prior slices' usage is lost. The checkpoint (AgentTurnSessionCheckpoint) does not store cumulative usage or duration, so there is nothing to aggregate against.

Fix direction

  • Pause notice: post with buildSlackReplyBlocks(text, footer) where footer includes at least the conversation ID. Consolidate the two posting paths into one shared helper.
  • Cumulative diagnostics: extend checkpoint with cumulativeUsage?: AgentTurnUsage and cumulativeDurationMs?: number. Accumulate at each checkpoint boundary. Build the final reply footer from cumulative totals, not just the last slice.
  • Old checkpoints without cumulative fields should degrade gracefully (show partial data, not break).

Key files

  • packages/junior/src/chat/services/turn-continuation-response.ts
  • packages/junior/src/chat/runtime/reply-executor.ts (§ postTurnContinuationNotice)
  • packages/junior/src/chat/runtime/slack-resume.ts (§ postTurnContinuationNoticeBestEffort, footer construction)
  • packages/junior/src/chat/slack/footer.ts
  • packages/junior/src/chat/services/turn-checkpoint.ts

Raised by David Cramer.
Action taken on behalf of David Cramer.

Activity

  1. added
    bug
    on May 20, 2026
  2. dcramer commented on May 23, 2026

    @dcramer
    Member

    more work to do here but its a start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions