From adf93c5b5a1f302e6ee2ee8d9c0838c6ee675eff Mon Sep 17 00:00:00 2001 From: Sergio Alexander Florez Galeano Date: Sun, 12 Jul 2026 02:19:21 +0000 Subject: [PATCH] feat(conversation): enforce Slack MPIM participant limit (max 7 + bot) Slack group DMs (MPIMs) support at most 8 total members. Since the Dailybot bot always occupies one slot, `conversation open` now rejects more than 7 user participants client-side before hitting the API. - Add MAX_CONVERSATION_PARTICIPANTS constant (7) - Pre-check identifier count and post-dedup UUID count - Handle `conversation_too_many_participants` API error code - Document the limit in the vendored agent skill Co-authored-by: Cursor --- .agents/skills/dailybot/conversation/SKILL.md | 9 ++++++++ dailybot_cli/commands/conversation.py | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/.agents/skills/dailybot/conversation/SKILL.md b/.agents/skills/dailybot/conversation/SKILL.md index b6206fc..98be830 100644 --- a/.agents/skills/dailybot/conversation/SKILL.md +++ b/.agents/skills/dailybot/conversation/SKILL.md @@ -98,6 +98,14 @@ Participants can be named three ways — the CLI resolves them for you: > The bot is added automatically — you do **not** pass the bot as a participant. > One human participant already makes a valid group with the bot. +### Participant limit + +Slack group DMs (MPIMs) support **at most 8 total members**. The Dailybot bot +always occupies one slot, so you can pass **at most 7 user UUIDs / emails / +names**. The CLI rejects more than 7 before making the API call; the server also +validates and returns `400 conversation_too_many_participants` if the limit is +exceeded. + --- ## Step 3 — Open the Conversation (idempotent) @@ -170,6 +178,7 @@ Match on the machine-readable `code` (with `--json`), never the prose `detail`. |------|--------|------------------------| | 406 | `open_conversation_not_supported` | Org is not on Slack. Tell the developer group DMs are Slack-only; stop. | | 403 | — | Caller is not an org admin. Explain the command needs admin rights. | +| 400 | `conversation_too_many_participants` | More than 7 users passed (8 total including the bot). Reduce the list. | | 400 | `one_or_more_users_not_found` | A participant isn't an active org user. Re-check the names/UUIDs. | | 400 | `no_valid_users` | The list contained invalid UUIDs. Fix the identifiers. | | 400 | `params_validation_error` | `users_uuids` wasn't a list — a CLI usage error; re-run with `-u`. | diff --git a/dailybot_cli/commands/conversation.py b/dailybot_cli/commands/conversation.py index b0e528e..a1a5c01 100644 --- a/dailybot_cli/commands/conversation.py +++ b/dailybot_cli/commands/conversation.py @@ -26,6 +26,7 @@ ) GROUP_CHAT_TYPE: str = "group_chat" +MAX_CONVERSATION_PARTICIPANTS: int = 7 # Slack MPIM limit: 8 total, minus the bot def _split_identifiers(values: tuple[str, ...]) -> list[str]: @@ -67,6 +68,11 @@ def _exit_for_conversation_error(exc: APIError, json_mode: bool) -> NoReturn: message = "One or more users were not found or aren't active in your organization." elif code == "no_valid_users": message = "The participant list contains invalid user UUIDs." + elif code == "conversation_too_many_participants": + message = ( + f"Too many participants. Slack group DMs support at most " + f"{MAX_CONVERSATION_PARTICIPANTS} users plus the Dailybot bot (8 total)." + ) elif code == "conversation_can_not_be_opened": message = "Slack rejected the request. A participant may be deactivated on the Slack side." elif exc.status_code == 403: @@ -147,6 +153,14 @@ def conversation_open( print_error("Provide at least one participant with --user (UUID, email, or name).") raise SystemExit(1) + if len(identifiers) > MAX_CONVERSATION_PARTICIPANTS: + print_error( + f"Too many participants ({len(identifiers)}). " + f"Slack group DMs support at most {MAX_CONVERSATION_PARTICIPANTS} " + "users plus the Dailybot bot (8 total)." + ) + raise SystemExit(1) + client: DailyBotClient = require_auth() try: participants: list[tuple[str, str]] = _resolve_participants(client, identifiers) @@ -155,6 +169,13 @@ def conversation_open( raise SystemExit(1) uuids: list[str] = [uuid for uuid, _name in participants] + if len(uuids) > MAX_CONVERSATION_PARTICIPANTS: + print_error( + f"Too many participants ({len(uuids)}). " + f"Slack group DMs support at most {MAX_CONVERSATION_PARTICIPANTS} " + "users plus the Dailybot bot (8 total)." + ) + raise SystemExit(1) try: with console.status("Opening group conversation..."): result: dict[str, Any] = client.open_conversation(uuids)