Skip to content

fix(slack): rotate long native streams before expiry - #884

Merged
bensabic merged 3 commits into
vercel:mainfrom
dcbuild3r:codex/slack-stream-rotation
Sep 4, 2026
Merged

fix(slack): rotate long native streams before expiry#884
bensabic merged 3 commits into
vercel:mainfrom
dcbuild3r:codex/slack-stream-rotation

Conversation

@dcbuild3r

Copy link
Copy Markdown
Contributor

Summary

Slack expires native streams after roughly five minutes. Finalize long-running streams after four minutes by default and continue in a fresh segment so late appends do not fail with message_not_in_streaming_state. Preserve open fenced code blocks by closing and reopening them across the segment boundary. The threshold is configurable with streamSegmentMaxAgeMs.

Test plan

  • bunx vitest run packages/adapter-slack/src/index.test.ts (444 passed)
  • bunx tsc -p packages/adapter-slack/tsconfig.json --noEmit
  • bunx biome check on changed source, tests, docs, and changeset

Checklist

  • All commits are signed and verified
  • All commits are signed off for the DCO (git commit -s)
  • pnpm validate passes (targeted package validation run)
  • Changeset added
  • Documentation updated

Signed-off-by: dcbuild3r <dcbuilder@pm.me>
@dcbuild3r
dcbuild3r requested a review from a team as a code owner September 1, 2026 21:08
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@dcbuild3r is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread packages/adapter-slack/src/index.ts Outdated
Slack expires native streams after roughly five minutes, so long replies
are continued in a new message. Rotation now waits for a paragraph break
(up to a 30s grace) and carries the leading text out with the old
segment's stop call, closes and reopens code fences with CommonMark
semantics, repeats a table header when a table continues, replays the
plan and open task cards, keeps the agent session in processing, and
flushes the new segment's first append immediately.

The segment clock starts at the first call Slack accepts rather than at
construction, rotation only runs when there is text to send, and
streamSegmentMaxAgeMs treats non-positive or NaN values as the default
and Infinity as never. A segment Slack already expired during an idle
gap is recovered by resending unconfirmed text in a new message instead
of failing the reply.

Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Document how long native streams are continued across messages: the
paragraph-break rotation and grace window, fence and table handling,
task card replay, agent session status, the Infinity opt-out, and which
message thread.post() returns.

Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
@bensabic
bensabic merged commit d4a1f03 into vercel:main Sep 4, 2026
13 of 15 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.

2 participants