Skip to content

fix(slack): keep components with streamed responses - #829

Merged
izadoesdev merged 3 commits into
stagingfrom
codex/slack-combined-responses
Sep 17, 2026
Merged

izadoesdev merged 3 commits into
stagingfrom
codex/slack-combined-responses

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Sep 17, 2026

Copy link
Copy Markdown
Member

Streamed Slack answers currently post tables and feedback controls as a separate reply. Finalize the existing stream with chat.stopStream.blocks so those controls stay attached to the answer they describe, and feedback refers to the answer's message timestamp. Clients without streaming keep the existing text-and-components fallback.

Serialize progress updates, coalesce superseded pending updates, and finish them before resolving the thinking card or closing the stream. Check cancellation before starting the model and before sending queued text or final blocks. If Slack rejects the component blocks, finish the valid prose without them; cancellation still closes the stream without adding new prose.

Validation: 67 Slack tests pass, including combined answer/table/feedback, non-stream fallback, delayed progress on success/error/cancellation, coalescing, cancellation during stream startup, and cancellation during rejected-block recovery. The new behavioral regressions failed before their fixes. Root lint and all 33 typecheck tasks pass. The pre-push repository test suite passed all 29 tasks (28 cached). Independent review found one cancellation edge, now covered by a regression and fixed.

Scope: response rendering and delivery ordering only. No schema, dependency, Slack scope, manifest, or installation changes. Based directly on current staging with no PR dependency. Related Slack lifecycle drafts #819, #820, and #822 change other files; #819's cancellation behavior should be verified together with this response path before landing. API timeout configuration and message-edit handling are separate slices.

Slack's documented final-message blocks behavior: https://docs.slack.dev/reference/methods/chat.stopStream/


Summary by cubic

Streamed Slack answers now keep tables and feedback controls attached to the answer itself instead of posting them as a separate reply. Progress updates are serialized and coalesced, and cancellation is honored at key points.

  • Tables and feedback buttons are included in the final stream via chat.stopStream.blocks.
  • Non-streaming clients still get the text-and-components fallback via chat.postMessage.
  • Progress updates are coalesced: only the most recent pending update is sent after an earlier one resolves.
  • Cancellation aborts before the model starts, before flushing pending text, and before final blocks send; it closes the stream without adding new prose.
  • If Slack rejects the component blocks, the prose answer still finishes without them.

Written for commit 140a21e. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
databuddy-status Ready Ready Preview Sep 17, 2026 10:45am UTC
2 Skipped Deployments
Project Deployment Actions Updated
dashboard Skipped Skipped Sep 17, 2026 10:45am UTC
documentation Skipped Skipped Sep 17, 2026 10:45am UTC

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e44280b3-6690-42f6-9921-6eda8c56657a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no outstanding findings or newly introduced actionable defects identified.

Summary

This PR keeps Slack response components attached to streamed answers and strengthens response-delivery ordering.

  • Finalizes streamed prose, tables, and feedback controls through chat.stopStream.
  • Preserves the existing non-streaming fallback.
  • Serializes and coalesces progress updates before resolving the thinking card.
  • Honors cancellation before model execution, pending-text delivery, and final block delivery.
  • Retries stream finalization without component blocks when Slack rejects otherwise valid blocks.
  • Replaces broad block and test assertions with concrete Slack API types and discriminated narrowing.

Diagram

sequenceDiagram
    participant Agent
    participant Handler as Slack response handler
    participant Slack

    Handler->>Slack: chat.startStream
    Slack-->>Handler: stream timestamp
    Agent-->>Handler: tool progress events
    Handler->>Slack: serialized chat.appendStream progress
    Agent-->>Handler: prose and components
    Handler->>Slack: resolve thinking state
    Handler->>Slack: append queued prose
    Handler->>Slack: chat.stopStream with final blocks
    alt Slack rejects component blocks
        Handler->>Slack: chat.stopStream without blocks
    else Request is cancelled
        Handler->>Slack: chat.stopStream without new prose
    end
Loading

Reviews (3) · Last reviewed commit: "refactor(slack): use native block and bu..."

Comment thread apps/slack/src/slack/respond.test.ts Outdated
@izadoesdev
izadoesdev force-pushed the codex/slack-combined-responses branch from b39b5a7 to 2f064d2 Compare September 17, 2026 10:35
@vercel
vercel Bot temporarily deployed to Preview – documentation September 17, 2026 10:35 Inactive
@vercel
vercel Bot temporarily deployed to Preview – dashboard September 17, 2026 10:35 Inactive
@unkey-deploy

unkey-deploy Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Unkey Deploy

Name Status Preview Inspect Updated (UTC)
links (preview) Ready Visit Preview Inspect Sep 17, 2026 10:45am

Comment thread apps/slack/src/slack/blocks.ts Outdated
@izadoesdev
izadoesdev marked this pull request as draft September 17, 2026 10:41
@vercel
vercel Bot temporarily deployed to Preview – documentation September 17, 2026 10:45 Inactive
@vercel
vercel Bot temporarily deployed to Preview – dashboard September 17, 2026 10:45 Inactive
@izadoesdev
izadoesdev marked this pull request as ready for review September 17, 2026 10:45
@izadoesdev
izadoesdev merged commit 1d221c1 into staging Sep 17, 2026
15 checks passed
@izadoesdev
izadoesdev deleted the codex/slack-combined-responses branch September 17, 2026 10:48
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