The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): explicit tool_progress off disables Slack task cards
Victor Kyriazakosed25a40917e7
diff --git a/gateway/run_turn.py b/gateway/run_turn.pyindex e2c07b3e84a..e3dbf01a301 100644--- a/gateway/run_turn.py+++ b/gateway/run_turn.py@@ -2735,6 +2735,8 @@ class GatewayTurnMixin:for cfg, key in ((_platform_cfg, "tool_progress"), (_legacy_tp_overrides, platform_key)))progress_mode = _env_tp if _env_tp and not _tool_progress_configured else (_resolved_tp or _env_tp or "all")+ # Operator intent vs tier default: True when a human wrote the mode (config or env).+ _tool_progress_explicit = _tool_progress_configured or bool(_env_tp)# "accumulate" (edit one bubble) or "separate" (one msg per tool)progress_grouping = resolve_display_setting(user_config, platform_key, "tool_progress_grouping") or "accumulate"_generic_status_recent: List[str] = []@@ -2792,8 +2794,16 @@ class GatewayTurnMixin:# native plan/task cards via chat.startStream — the progress queue is needed even though Slack keeps# ordinary text tool_progress off by default (requiring both flags would silently leave the native# feature inactive).+ # Cards are still tool progress. Slack's TIER default (``off``) only quiets the text lane so+ # cards stay on for unconfigured installs, but an operator who WRITES ``tool_progress: off``+ # (global, platform override, or legacy overrides) has asked for no tool progress at all and+ # gets no cards either. Every other explicit mode keeps the card lane._native_slack_task_cards = False- if source.platform == Platform.SLACK and hasattr(adapter, "native_task_cards_enabled"):+ if (+ source.platform == Platform.SLACK+ and hasattr(adapter, "native_task_cards_enabled")+ and not (_tool_progress_explicit and progress_mode == "off")+ ):try:_native_slack_task_cards = bool(adapter.native_task_cards_enabled())except Exception:diff --git a/tests/gateway/test_run_progress_topics.py b/tests/gateway/test_run_progress_topics.pyindex 9d2fadd00b7..b82f1db4fb4 100644--- a/tests/gateway/test_run_progress_topics.py+++ b/tests/gateway/test_run_progress_topics.py@@ -292,19 +292,19 @@ class DuplicateNativeToolsAgent:self.tools = []def run_conversation(self, message, conversation_history=None, task_id=None, **kwargs):- self.tool_start_callback("call-a", "web_search", {"query": "alpha"})+ # Production (agent/tool_executor.py) fires these through _safe_callback, which skips a+ # None callback; the card lane leaves them unset when cards are disabled for the turn.+ start = self.tool_start_callback or (lambda *a, **k: None)+ complete = self.tool_complete_callback or (lambda *a, **k: None)+ start("call-a", "web_search", {"query": "alpha"})time.sleep(0.15)- self.tool_start_callback("call-b", "web_search", {"query": "beta"})+ start("call-b", "web_search", {"query": "beta"})time.sleep(0.15)# Complete the second same-name call first. Correlation by tool name# would incorrectly mark call-a as failed here.- self.tool_complete_callback(- "call-b", "web_search", {"query": "beta"}, '{"error": "boom"}'- )+ complete("call-b", "web_search", {"query": "beta"}, '{"error": "boom"}')time.sleep(0.15)- self.tool_complete_callback(- "call-a", "web_search", {"query": "alpha"}, '{"success": true}'- )+ complete("call-a", "web_search", {"query": "alpha"}, '{"success": true}')time.sleep(0.15)return {"final_response": "done", "messages": [], "api_calls": 1}@@ -1062,14 +1062,13 @@ async def _run_with_agent(async def test_slack_native_progress_correlates_concurrent_duplicate_tools_by_id(monkeypatch, tmp_path):+ # No display config: Slack's tier default (tool_progress off) keeps the TEXT lane quiet while+ # the card lane stays on. An operator-written ``off`` is a different thing (see below).adapter, result = await _run_with_agent(monkeypatch,tmp_path,DuplicateNativeToolsAgent,session_id="sess-native-ids",- config_data={- "display": {"platforms": {"slack": {"tool_progress": "off"}}}- },platform=Platform.SLACK,chat_id="C1",thread_id="thread-1",@@ -1132,6 +1131,64 @@ async def test_slack_native_failure_keeps_editing_one_live_text_fallback(assert adapter.native_stops == 1+ "display_cfg",+ [+ {"platforms": {"slack": {"tool_progress": "off"}}},+ {"tool_progress": "off"},+ {"tool_progress_overrides": {"slack": "off"}},+ ],+ ids=["platform-override", "global", "legacy-overrides"],+)+async def test_slack_operator_tool_progress_off_disables_task_cards(monkeypatch, tmp_path, display_cfg):+ # Task cards ARE tool progress rendered natively. When the operator writes ``off`` (not the+ # tier default), neither the card lane nor its text fallback may publish anything.+ adapter, result = await _run_with_agent(+ monkeypatch,+ tmp_path,+ DuplicateNativeToolsAgent,+ session_id="sess-native-operator-off",+ config_data={"display": display_cfg},+ platform=Platform.SLACK,+ chat_id="D1",+ chat_type="dm",+ thread_id=None,+ adapter_cls=NativeTaskCardAdapter,+ user_id="U1",+ scope_id="T1",+ )++ assert result["final_response"] == "done"+ assert adapter.native_updates == []+ assert adapter.native_stops == 0+ assert adapter.sent == []+ assert adapter.edits == []+++async def test_slack_operator_tool_progress_new_keeps_task_cards(monkeypatch, tmp_path):+ # An explicit non-off mode keeps the native card lane engaged (text lane stays swallowed by it).+ adapter, result = await _run_with_agent(+ monkeypatch,+ tmp_path,+ DuplicateNativeToolsAgent,+ session_id="sess-native-operator-new",+ config_data={"display": {"platforms": {"slack": {"tool_progress": "new"}}}},+ platform=Platform.SLACK,+ chat_id="C1",+ thread_id="thread-1",+ adapter_cls=NativeTaskCardAdapter,+ user_id="U1",+ scope_id="T1",+ )++ assert result["final_response"] == "done"+ assert adapter.native_updates+ assert adapter.sent == []+ assert adapter.native_stops == 1++@pytest.mark.asyncioasync def test_retryable_overflow_edit_keeps_editable_bubble_identity(monkeypatch, tmp_path):"""A transient split edit must retain can_edit and the current message ID."""diff --git a/website/docs/user-guide/messaging/slack.md b/website/docs/user-guide/messaging/slack.mdindex 37f98e8c9c8..dc7fe35a1b6 100644--- a/website/docs/user-guide/messaging/slack.md+++ b/website/docs/user-guide/messaging/slack.md@@ -468,7 +468,7 @@ platforms:| `platforms.slack.extra.unfurl_media` | Slack default | Set to `false` to suppress automatic media previews while preserving clickable links. Same caption-ordering and streaming notes as `unfurl_links`. || `platforms.slack.extra.rich_blocks` | `false` | When `true`, agent messages are rendered as [Block Kit](https://docs.slack.dev/block-kit/) blocks (headers, dividers, true nested lists, and native tables). A plain-text fallback is always sent. Tables over Slack's limits fall back to aligned monospace. No app reinstall required — it's a send-side change only. || `platforms.slack.extra.feedback_buttons` | `false` | When `true` with `rich_blocks`, appends Slack-native feedback controls to final replies. |-| `platforms.slack.extra.native_task_cards` | `false` | When `true`, renders live tool calls as Slack-native plan/task cards. This is an explicit progress opt-in independent of Slack's default `tool_progress: off`; native API failures fall back to one continuously edited text update. |+| `platforms.slack.extra.native_task_cards` | `false` | When `true`, renders live tool calls as Slack-native plan/task cards. Cards work with Slack's built-in default `tool_progress: off`; an explicitly configured `display.tool_progress: off` (global or `display.platforms.slack`) disables cards too. Native API failures fall back to one continuously edited text update. || `platforms.slack.extra.suggested_prompts` | `[]` | Up to four `{title, message}` prompts for Agent/Assistant DM entry points; accepts either a list or `{title, prompts}`. || `platforms.slack.extra.assistant_thread_titles` | `true` | When `true`, names Agent/Assistant DM threads from the first user message. || `platforms.slack.extra.allow_bots` | `"none"` | Controls messages from other Slack bots: `"none"` ignores them, `"mentions"` accepts a bot message only when **that message itself** @mentions Hermes, and `"all"` accepts all of them. Use `"mentions"` for the safest bot-to-bot collaboration mode. See [Accepting messages from other bots](#accepting-messages-from-other-bots-allow_bots). |@@ -574,8 +574,11 @@ platforms:native_task_cards: true```-- This is an explicit progress opt-in — it works even though Slack's default- is `tool_progress: off` (text bubbles spam channels; native cards don't).+- Cards are the Slack rendering of tool progress. They work with Slack's+ built-in default `tool_progress: off` (text bubbles spam channels; native+ cards don't). Writing `tool_progress: off` yourself, globally or under+ `display.platforms.slack`, turns cards off as well; `new` or `all` keeps+ them.- Concurrent calls to the same tool are correlated by real tool-call ID, soparallel `web_search` calls each get their own row with the right status.- If the native stream can't start or update, Hermes falls back to a single