Skip to content

fix(chat): Use Chat SDK primitives for streaming, status, and file uploads - #19

Merged
dcramer merged 1 commit into
mainfrom
fix/chat-sdk-streaming-status
Feb 28, 2026
Merged

dcramer merged 1 commit into
mainfrom
fix/chat-sdk-streaming-status

Conversation

@dcramer

@dcramer dcramer commented Feb 28, 2026

Copy link
Copy Markdown
Member

Replace the custom assistantThreadMetaById cache and direct setAssistantStatus adapter bypass with the Chat SDK's built-in thread.startTyping() and thread.channelId.

The old approach manually called getSlackAdapter().setAssistantStatus(channelId, threadTs, ...) which required a global in-memory map to store {channelId, threadTs} per thread. This map silently failed when entries weren't populated — which happened because threadTs resolution was scattered across four separate helper functions with inconsistent fallback chains. The same missing threadTs caused file uploads to be silently skipped.

The Chat SDK already handles all of this: thread.startTyping(status) delegates to the Slack adapter's assistant.threads.setStatus with proper decodeThreadId + withToken + error handling. thread.channelId is a first-class property. No map needed.

What changed:

  • Add parseSlackThreadId as single canonical parser for the slack:CHANNEL:TS format
  • Rewrite createProgressReporter to use thread.startTyping() instead of the adapter bypass
  • Derive channelId from thread.channelId (Chat SDK property) with message fallback
  • Derive threadTs from parseSlackThreadId — single source of truth, no scattered helpers
  • Remove ~80 lines: AssistantThreadMeta interface, map, pruning, population in two call sites
  • Remove dead EditableSentMessage / isEditableSentMessage code
  • Update system prompt to allow brief initial ack before heavy tool work (was "no progress promises")
  • Broaden imageGenerate tool description to cover visual concepts, not just explicit creation requests

Verified against the actual Chat SDK contracts: SlackAdapter.startTyping calls the same assistant.threads.setStatus API with identical parameters (status + loading_messages: [status]).

Fixes #12

…loads

Replace the custom assistantThreadMetaById cache and direct
setAssistantStatus bypass with the Chat SDK's built-in
thread.startTyping() and thread.channelId. This removes ~80 lines of
map infrastructure that silently failed when entries weren't populated
due to inconsistent threadTs resolution across scattered helpers.

- Add parseSlackThreadId as single canonical parser for slack:CHANNEL:TS
- Rewrite createProgressReporter to use thread.startTyping()
- Derive channelId from thread.channelId with message fallback
- Derive threadTs from parseSlackThreadId (single source of truth)
- Update prompt to allow brief ack before heavy tool work
- Broaden image-generate tool description for visual concepts
- Remove dead EditableSentMessage/isEditableSentMessage code

Fixes #12

Co-Authored-By: Claude <[email protected]>
@dcramer
dcramer marked this pull request as ready for review February 28, 2026 01:56
@dcramer
dcramer merged commit 36a7226 into main Feb 28, 2026
3 checks passed
@dcramer
dcramer deleted the fix/chat-sdk-streaming-status branch February 28, 2026 02:20

This branch was successfully deployed

1 active deployment
Preview — 35a020bf Deployed Feb 28, 2026 by vercel[bot]
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.

Fix response streaming and add immediate ack for long-running tasks

1 participant