Skip to content

fix(slack): bound structured stream chunk fields - #886

Draft
dcbuild3r wants to merge 1 commit into
vercel:mainfrom
dcbuild3r:codex/slack-structured-chunk-limits
Draft

fix(slack): bound structured stream chunk fields#886
dcbuild3r wants to merge 1 commit into
vercel:mainfrom
dcbuild3r:codex/slack-structured-chunk-limits

Conversation

@dcbuild3r

Copy link
Copy Markdown
Contributor

Summary

Slack limits structured task and plan fields to 256 characters. Truncate IDs, titles, and plan titles safely, and split oversized task details/output into stable continuation chunks so large tool results do not make native streaming fail. Preserve the prior part count on subsequent task updates so existing continuation cards can be updated consistently.

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 files

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 (N/A; automatic enforcement of Slack platform limits)

@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 on lines +326 to +328
const lastCode = value.charCodeAt(end - 1);
if (lastCode >= 0xd800 && lastCode <= 0xdbff) {
end -= 1;

@vercel vercel Bot Sep 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

splitStreamChunkField enters an infinite loop when the input string ends with an unpaired high surrogate at the final chunk boundary, hanging the synchronous stream handler and blocking the Node event loop.

Fix on Vercel

Signed-off-by: dcbuild3r <dcbuilder@pm.me>
@bensabic
bensabic force-pushed the codex/slack-structured-chunk-limits branch from a346105 to 04cdec5 Compare September 4, 2026 01:14
@bensabic

bensabic commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this. Before merging I ran a probe against chat.appendStream with a live bot token to pin down the 256 rule from the docs. Slack accepted every case: title, details, and output at 300, 1,000, 4,000, 12,000, and 40,000 characters, ids at 300 and 1,000, plan titles at 1,000, 300-character titles under task_display_mode "plan", pending status, and thirty 300-character cards in one append. The only rejection was sending markdown_text and chunks in the same request, which the streamer never does.

Could you share the payload and the error code you hit? If Slack enforces a limit in some condition I missed, I'd like to target that exactly rather than truncate fields Slack renders fine today.

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