Skip to content

ref(slack): Simplify assistant thread delivery#204

Merged
dcramer merged 6 commits intomainfrom
dcramer/ref/slack-assistant-thread-cleanup
Apr 17, 2026
Merged

ref(slack): Simplify assistant thread delivery#204
dcramer merged 6 commits intomainfrom
dcramer/ref/slack-assistant-thread-cleanup

Conversation

@dcramer
Copy link
Copy Markdown
Member

@dcramer dcramer commented Apr 16, 2026

Rework Slack assistant-thread delivery around a single Slack-owned outbound boundary.

This moves assistant-thread lifecycle, title generation, status handling, message, file, and reaction delivery, and markdown-to-mrkdwn translation into Slack-specific modules with explicit contracts. It removes the old runtime progress reporter and transport split, simplifies reply planning so Slack delivery operates on plain text, files, and stages, and keeps the runtime-facing API narrow.

The motivation is the number of regressions we had accumulated around assistant status, DM assistant-thread identifiers, title generation, reply finalization, and duplicated Slack-specific behavior. This branch isolates Slack behavior in one place, makes the live Slack context requirements explicit, and adds integration coverage around the Chat SDK contract and Slack request shape so future changes have fewer ways to break.

I considered a more aggressive rewrite around a brand new outward API or bringing streaming back as the primary Slack surface, but kept the finalized-reply model intact. That reduces internal complexity without changing the user-visible delivery contract again. The follow-up fixes in this branch also keep image-bearing turns on the normal reply path when vision is unavailable and preserve assistant-status ordering so a delayed status write cannot reappear after the final reply lands.

Fixes GH-97
Fixes GH-187
Fixes GH-200
Fixes GH-202

dcramer and others added 3 commits April 16, 2026 13:44
Collapse Slack reply delivery around a single outbound contract for finalized messages, files, reactions, assistant status, and markdown normalization.

Remove the legacy streaming reply path, document the supported assistant-thread behavior, and expand integration coverage around the Chat SDK boundary with MSW-backed Slack API assertions.

Harden assistant DM title and status handling so best-effort status writes do not block turns, title generation uses the oldest known human message with a lightweight model, and stable Slack title permission failures do not repeat on later turns.

Point example-app dev at the built workspace dist via a symlinked injected package path so local boot no longer races on recursive copy refreshes.

Refs GH-202
Co-Authored-By: GPT-5 <noreply@openai.com>
Move assistant-thread lifecycle, status, title generation, and mrkdwn translation into Slack-owned modules. Remove the old progress reporter and transport split so the outbound contract is smaller and Slack-specific behavior stays isolated.

Keep the existing assistant status and title semantics while simplifying the reply planning path and tightening the integration coverage around the Chat SDK and Slack API wiring.

Refs GH-202
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Separate assistant-status rendering, scheduling, and Slack sending so the status path is easier to reason about without changing the public runtime API.

Document the distinction between Slack-required behavior, Junior runtime policy, and product policy so future changes do not conflate transport requirements with UX decisions.

Refs GH-202
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

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

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment Apr 17, 2026 0:18am

Request Review

Comment thread packages/junior/src/chat/runtime/reply-executor.ts
Comment thread packages/junior/src/chat/slack/assistant-thread/status-send.ts
Treat inbound Slack images without vision support as a deterministic runtime fallback instead of letting the model infer that no image was attached. Also log raw inbound attachments separately from prompt attachments so local diagnosis stays obvious.

Collapse the extra light-model knob into AI_FAST_MODEL and route title generation through the same fast-model setting. This removes a redundant config surface while keeping lightweight follow-up work on the cheaper model path.

Refs GH-202
Co-Authored-By: GPT-5 <noreply@openai.com>
Comment thread packages/junior/src/chat/runtime/reply-executor.ts Outdated
Comment thread packages/junior/src/chat/runtime/reply-executor.ts Outdated
Comment thread packages/junior/src/chat/slack/reply.ts
Keep image-bearing Slack turns on the normal reply path when vision is disabled and pass the omission through the reply context so the model stays truthful in mixed and image-only turns.

Drain already-started assistant status writes before the first visible reply so Slack cannot re-show stale progress after the final message lands, while keeping status writes off the model and tool execution critical path.

Refs GH-202
Co-Authored-By: GPT-5 <noreply@openai.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8dbe791. Configure here.

Comment thread packages/junior/src/chat/slack/assistant-thread/status-send.ts
Keep assistant status best effort by letting finalized replies post without waiting for in-flight status writes.

Persist inbound attachment facts on user messages so timeout and MCP auth resumes can rebuild omitted-image context before Pi continues or the request is replayed.

Refs GH-202
Co-Authored-By: Codex <noreply@openai.com>
@dcramer dcramer marked this pull request as ready for review April 17, 2026 01:35
@dcramer dcramer merged commit 6dc959c into main Apr 17, 2026
13 checks passed
@dcramer dcramer deleted the dcramer/ref/slack-assistant-thread-cleanup branch April 17, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment