← Back to PRs

#22476: fix(slack): add streamMode to Zod schema and support "off" mode

by ms-ponyo open 2026-02-21 06:38 View on GitHub →
channel: slack size: XS
## Summary - **Bug fix:** `streamMode` is read at runtime in `dispatch.ts` via `resolveSlackStreamMode(account.config.streamMode)` but was missing from `SlackAccountSchema` in the Zod validation schema. Since the schema uses `.strict()`, setting `streamMode` in the Slack account config caused silent validation failure and the gateway would hang during startup with no error message. - **Feature:** Adds `"off"` mode that disables the draft stream entirely — no intermediate messages are posted, only the final reply is delivered. This is useful when `streaming: false` is set (disabling native Slack streaming) but the draft stream still progressively edits messages via `chat.postMessage` + `chat.update` (the two are independent mechanisms). ## Changes 1. `src/config/zod-schema.providers-core.ts` — Add `streamMode` enum to `SlackAccountSchema` (`"replace" | "status_final" | "append" | "off"`) 2. `src/slack/stream-mode.ts` — Add `"off"` to `SlackStreamMode` type and `resolveSlackStreamMode` resolver 3. `src/slack/monitor/message-handler/dispatch.ts` — Early return in `updateDraftFromPartial` when `streamMode === "off"` ## Context - Discord already has `streamMode` in its schema (added in #22111) - Telegram has `streamMode` in its schema with `"off"` as default - Slack was the only channel where `streamMode` was referenced in runtime code but missing from the Zod schema ## Test plan - [x] Set `streamMode: "off"` in Slack account config — verify gateway starts without validation error - [x] Send a message to the bot — verify no draft/preview message is posted, only the final reply - [x] Set `streamMode: "replace"` — verify progressive editing still works - [x] Omit `streamMode` — verify default `"replace"` behavior is unchanged 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds missing `streamMode` field to `SlackAccountSchema` and introduces `"off"` mode to disable draft stream updates. The field was already used at runtime via `resolveSlackStreamMode()` but missing from the Zod validation schema, causing silent validation failures due to `.strict()` mode. - Fixed schema validation by adding `streamMode` enum with values `"replace" | "status_final" | "append" | "off"` - Added `"off"` mode support to `SlackStreamMode` type and resolver function - Implemented early-return in `updateDraftFromPartial()` when `streamMode === "off"` to skip all draft message updates - Final replies still delivered correctly through `dispatchInboundMessage` (independent from draft stream) <h3>Confidence Score: 4/5</h3> - Safe to merge with minor improvements suggested - The core fix is correct — adds missing schema field and implements `"off"` mode properly. Early-return logic prevents draft updates while final replies are still delivered. Minor style suggestions: explicit schema default and test coverage for the new mode would improve consistency with other channels. - No files require special attention <sub>Last reviewed commit: 288fa30</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs