vercel / vercel/chat

rotated stream segments with open task_update chunks render as errored in 4.40.0

Open Beginner friendly
#911 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
314
Avg merge
1d 18h
Merged PRs (30d)
63

Description

Summary
A native Slack stream that runs past streamSegmentMaxAgeMs is rotated onto a new message. When the stream carries structured task_update chunks with status: "in_progress", the retired segment renders in Slack with the red error indicator, because rotateSegment stops it without closing the open task.

Reproduction

  1. createSlackAdapter({ agentView: true }) on 4.40.0, default streamSegmentMaxAgeMs.
  2. thread.post(source) where source is an async generator yielding { type: 'task_update', id: 'work', title: 'Working', status: 'in_progress', details: '…' } every ~20 s for 10 minutes.
  3. Observe the thread after the first rotation (~240 s).

Observed
The retired segment shows the red warning icon next to its title; the new segment continues normally with the replayed open task.

Expected
The retired segment settles cleanly (checkmark or neutral), since the work continues in the next segment.

Cause
rotateSegment in packages/adapter-slack/src/index.ts calls segment.streamer.stop({ token, markdown_text?, session_status: 'processing' }) and sends no closing task_update for tasks still in_progress. Slack renders a stopped stream whose last task chunk is open as an error state. A stop that includes { type: 'task_update', id, status: 'complete' } for each open task before startNextSegment renders cleanly; verified by driving the same calls manually.

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/adapter-slack/src/index.ts at rotateSegment, where the retired segment is stopped before startNextSegment. Trace the open task_update state and verify that each in-progress task is closed during rotation; reproduce with the async generator scenario and confirm the retired Slack segment settles without a red error indicator.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.