Skip to content

[chat] fix Slack streaming team ID for interactive payloads#330

Open
mdnanocom wants to merge 1 commit intovercel:mainfrom
mdnanocom:slackfixrerivingrecipientteamidfromactionpayload
Open

[chat] fix Slack streaming team ID for interactive payloads#330
mdnanocom wants to merge 1 commit intovercel:mainfrom
mdnanocom:slackfixrerivingrecipientteamidfromactionpayload

Conversation

@mdnanocom
Copy link
Copy Markdown
Contributor

@mdnanocom mdnanocom commented Apr 5, 2026

Fix Slack structured streaming from block_actions handlers

Calling thread.post(stream) from an onAction handler fails because recipientTeamId is derived as an object instead of a workspace ID string.

Cause

thread.handleStream used:

options.recipientTeamId = raw?.team_id ?? raw?.team;
  • Message events: raw.team is "T123" → works.
  • block_actions payloads: raw.team is { id: "T123", domain: "..." } → returned an object, Slack rejects the stream.

Fix

Extract the team ID with a helper that accepts every shape Slack sends:

  • raw.team_id
  • raw.team (string)
  • raw.team.id (block_actions)
  • raw.user.team_id (fallback)

Only packages/chat/src/thread.ts changes. No public API change. Only the Slack adapter reads recipientTeamId.

Tests

  • Unit: parametrized over all three raw shapes + a block_actions structured‑chunk case.
  • Replay: new buttonPrompt + buttonAction fixtures assert chatStream receives recipient_team_id and a task_update chunk.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 5, 2026

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

A member of the Team first needs to authorize it.

@mdnanocom mdnanocom force-pushed the slackfixrerivingrecipientteamidfromactionpayload branch 2 times, most recently from 8c25a76 to 0549c4f Compare April 21, 2026 08:06
@mdnanocom mdnanocom changed the title [slack] [bug] resolve structured streaming team context from interactive payloads [chat] fix Slack streaming team ID for interactive payloads Apr 21, 2026
@mdnanocom mdnanocom force-pushed the slackfixrerivingrecipientteamidfromactionpayload branch 7 times, most recently from 8aecb22 to 912b49a Compare April 21, 2026 08:48
@mdnanocom mdnanocom force-pushed the slackfixrerivingrecipientteamidfromactionpayload branch from 912b49a to 103a99c Compare April 21, 2026 08:49
@mdnanocom
Copy link
Copy Markdown
Contributor Author

mdnanocom commented Apr 21, 2026

@bensabic hello!
i improved the pr
do you need anything from me before merging?
thank you

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