Skip to content

feat: Slack Agents interaction surface (setStatus + Block Kit task cards) - #81

Open
digby-bw wants to merge 4 commits into
mainfrom
feat/slack-agents-surface
Open

feat: Slack Agents interaction surface (setStatus + Block Kit task cards)#81
digby-bw wants to merge 4 commits into
mainfrom
feat/slack-agents-surface

Conversation

@digby-bw

@digby-bw digby-bw commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Design and implementation of Slack's Agents interaction surface.

Design doc: docs/slack-agents-surface.md

Phases

  • Phase 1: assistant.threads.setStatus — native loading indicator in thread header + completion notification fix (no scope changes needed)
  • Phase 2: Block Kit task cards — structured tool step view replacing flat text progress
  • Phase 3: Suggested prompts + thread titles (requires assistant:write scope + app reinstall)

Status

Design doc committed. Implementation follows — ready for review/exploration by Claude/Codex.

Open questions (in doc)

  1. Block Kit update debouncing for rapid tool calls
  2. Fallback behaviour for top-level channel messages (no thread_ts)
  3. Scope change timing for Phase 3

Thread: https://brainwavesio.slack.com/archives/C0AB3CQSSSZ/p1781659818854589


Summary by cubic

Implements the full Slack Agents surface: native assistant.threads.setStatus loading, a single Block Kit task card that updates in place, and suggested prompts/titles. Fixes long-response handling and scope errors for smoother UX.

  • New Features

    • Post one Block Kit task card and update it for step progress and the final answer; no separate response message.
    • Call assistant.threads.setStatus only when a thread_ts exists; top-level channel posts skip it and go straight to the card.
    • Replace flat progress text with structured tool steps; no debounce needed.
    • Set suggested prompts on thread open (assistant_thread_started), and set thread titles after the first response (DM/thread only); requires assistant:write.
    • Full cut-over of the Slack surface; remove the old message/progress path.
  • Bug Fixes

    • Remove double markdown conversion to prevent formatting glitches.
    • For long responses, truncate the card’s section with a clear note and post the full text in the thread; keep file fallback for oversized updates.
    • Ignore missing_scope errors from suggested prompts; warn on other failures.

Written for commit 6579c38. Summary will update on new commits.

Review in cubic

Digby added 2 commits June 17, 2026 07:39
Covers:
- Phase 1: assistant.threads.setStatus + completion notifications fix
- Phase 2: Block Kit task cards for tool step visibility
- Phase 3: suggested prompts + thread titles (needs assistant:write scope)

Research: https://brainwavesio.slack.com/archives/C0AB3CQSSSZ/p1781659818854589
- All phases ship together (no phased rollout)
- Never post fresh — always update in place
- Full cut-over, no backward compat
- Detailed Block Kit card spec, TaskCard class design
- Testing checklist added

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/slack-agents-surface.md">

<violation number="1" location="docs/slack-agents-surface.md:267">
P2: Do not delete `emitProgress` yet; existing event handlers still depend on it for compaction/retry status updates.</violation>

<violation number="2" location="docs/slack-agents-surface.md:278">
P1: Use the nested `assistant_thread` fields for `setSuggestedPrompts`; the event does not expose `channel`/`threadTs` at the top level.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Add handler for `assistant_thread_started` event (fires when a DM or Agent Container thread opens):
```ts
client.onAssistantThreadStarted(async (event) => {
await client.setSuggestedPrompts(event.channel, event.threadTs, suggestedPrompts(event));

@cubic-dev-ai cubic-dev-ai Bot Jun 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Use the nested assistant_thread fields for setSuggestedPrompts; the event does not expose channel/threadTs at the top level.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/slack-agents-surface.md, line 278:

<comment>Use the nested `assistant_thread` fields for `setSuggestedPrompts`; the event does not expose `channel`/`threadTs` at the top level.</comment>

<file context>
@@ -0,0 +1,322 @@
+Add handler for `assistant_thread_started` event (fires when a DM or Agent Container thread opens):
+```ts
+client.onAssistantThreadStarted(async (event) => {
+  await client.setSuggestedPrompts(event.channel, event.threadTs, suggestedPrompts(event));
+});
+```
</file context>
Suggested change
await client.setSuggestedPrompts(event.channel, event.threadTs, suggestedPrompts(event));
await client.setSuggestedPrompts(event.assistant_thread.channel_id, event.assistant_thread.thread_ts, suggestedPrompts(event));
Fix with cubic

}
```

Remove `emitProgress` from the interface (it was internal detail).

@cubic-dev-ai cubic-dev-ai Bot Jun 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Do not delete emitProgress yet; existing event handlers still depend on it for compaction/retry status updates.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/slack-agents-surface.md, line 267:

<comment>Do not delete `emitProgress` yet; existing event handlers still depend on it for compaction/retry status updates.</comment>

<file context>
@@ -0,0 +1,322 @@
+}
+```
+
+Remove `emitProgress` from the interface (it was internal detail).
+
+### `src/surface/linear.ts`
</file context>
Fix with cubic

…atus

Implements the full Slack Agents surface spec from docs/slack-agents-surface.md:

- SlackSurface now uses a TaskCard (Block Kit) that updates in place through
  the entire run lifecycle; never posts a second message
- emitThinking: calls setStatus (DM/thread only), posts empty task card
- emitToolStart/emitToolEnd: new methods replacing emitProgress; update card
  with per-step progress (in-progress → done/error with duration)
- emitResponse: folds response text into card, collapses steps to summary line
- resolve: final update with actual cost (streaming=false)
- reject: updates card header with error text
- Added setThreadStatus, setTitle, setSuggestedPrompts to SlackClient
- Added onAssistantThreadStarted to SlackClient; router wires it to setSuggestedPrompts
- setTitle called after first response in DM/thread contexts (main.ts callback)
- MessageTransport and MessagePayload moved to surface/types.ts
- AgentSurface: replaced emitProgress with emitToolStart/emitToolEnd
- LinearSurface: emitToolStart/emitToolEnd are no-ops (interface compliance)
- events.ts: compaction/retry events no longer surface to card (log only)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

3 issues found across 7 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/slack-agents-surface.md">

<violation number="1" location="docs/slack-agents-surface.md:267">
P2: Do not delete `emitProgress` yet; existing event handlers still depend on it for compaction/retry status updates.</violation>

<violation number="2" location="docs/slack-agents-surface.md:278">
P1: Use the nested `assistant_thread` fields for `setSuggestedPrompts`; the event does not expose `channel`/`threadTs` at the top level.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/slack/router.ts
Comment thread src/surface/slack.ts Outdated
Comment thread src/surface/slack.ts
…cope guard

- Remove mdToMrkdwn() call inside TaskCard.toResolvedBlocks (caller already converts)
- When response exceeds MAX_SECTION_TEXT, truncate card text with thread note and post full text via emitDetail
- Silently swallow missing_scope errors from setSuggestedPrompts; warn on others

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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