The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): no text tool progress when a Slack chat cannot host a task card
Victor Kyriazakos3412490ad1ab
diff --git a/gateway/run_turn_runner.py b/gateway/run_turn_runner.pyindex 837492da3a8..c328fdd35a3 100644--- a/gateway/run_turn_runner.py+++ b/gateway/run_turn_runner.py@@ -34,6 +34,17 @@ if TYPE_CHECKING: # string annotations only; never imported at runtime (cycle)# Log-record parity with the origin module.logger = logging.getLogger("gateway.run")+# Card-lane failures that describe the DESTINATION, not a transient outage. Native Slack+# (`No Slack thread target`) and the relay connector (`slack task_card requires a thread anchor`)+# both refuse cards for un-threaded chats; the refusal repeats on every event of the turn.+_CARD_DESTINATION_UNSUPPORTED_MARKERS = ("thread anchor", "thread target")+++def _card_destination_unsupported(result: Any) -> bool:+ """True when a failed task-card send means this chat cannot host a card at all."""+ error = str(getattr(result, "error", "") or "").lower()+ return any(marker in error for marker in _CARD_DESTINATION_UNSUPPORTED_MARKERS)+def _renders_exec_approval_buttons(adapter_cls: type) -> bool:"""True when the adapter class renders native approval buttons. BasePlatformAdapter subclasses@@ -418,6 +429,18 @@ class TurnRunner:)returnst.native_failed = True+ if _card_destination_unsupported(result):+ # The destination itself cannot host a card (flat DM: no thread anchor). This is+ # a property of the chat, not a transient outage, and it repeats on every event.+ # Degrading to text would deliver tool progress the operator never enabled+ # (Slack's default is off), so the lane goes silent for this turn.+ st.egress_declined = True+ logger.info(+ "Slack native task cards are unsupported for this destination "+ "(%s); tool progress stays off for this turn",+ getattr(result, "error", "unknown error"),+ )+ returnlogger.warning("Slack native task-card progress failed; falling back ""to an editable text update: %s", getattr(result, "error", "unknown error"),diff --git a/tests/gateway/test_run_progress_topics.py b/tests/gateway/test_run_progress_topics.pyindex b82f1db4fb4..2cb9c772cb6 100644--- a/tests/gateway/test_run_progress_topics.py+++ b/tests/gateway/test_run_progress_topics.py@@ -1131,6 +1131,15 @@ async def test_slack_native_failure_keeps_editing_one_live_text_fallback(assert adapter.native_stops == 1+class UnsupportedDestinationTaskCardAdapter(NativeTaskCardAdapter):+ """Relay connector shape for a flat Slack DM: cards need a thread anchor, so the+ connector rejects every card frame with a deterministic unsupported-destination error."""++ async def send_native_task_card_progress(self, *args, **kwargs) -> SendResult:+ await super().send_native_task_card_progress(*args, **kwargs)+ return SendResult(success=False, error="slack task_card requires a thread anchor")++@pytest.mark.asyncio@pytest.mark.parametrize("display_cfg",@@ -1189,6 +1198,34 @@ async def test_slack_operator_tool_progress_new_keeps_task_cards(monkeypatch, tmassert adapter.native_stops == 1+async def test_slack_unsupported_card_destination_does_not_degrade_to_text_progress(+ monkeypatch, tmp_path+):+ # Flat Slack DM, no operator config (tier default: tool_progress off). The connector cannot+ # render a card without a thread anchor; that is a property of the destination, not a+ # transient native failure, so the lane must NOT fall back to text tool progress the operator+ # never asked for. Transient failures keep the fallback (see the test above).+ adapter, result = await _run_with_agent(+ monkeypatch,+ tmp_path,+ DuplicateNativeToolsAgent,+ session_id="sess-native-unsupported-dest",+ platform=Platform.SLACK,+ chat_id="D1",+ chat_type="dm",+ thread_id=None,+ adapter_cls=UnsupportedDestinationTaskCardAdapter,+ user_id="U1",+ scope_id="T1",+ )++ assert result["final_response"] == "done"+ assert len(adapter.native_updates) == 1+ assert adapter.sent == []+ assert adapter.edits == []++@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 dc7fe35a1b6..65caa90e27c 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. 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.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; chats that cannot host a card (flat DMs with `reply_in_thread: false`) show no tool progress. || `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). |@@ -579,6 +579,9 @@ platforms:cards don't). Writing `tool_progress: off` yourself, globally or under`display.platforms.slack`, turns cards off as well; `new` or `all` keepsthem.+- Cards need a thread. In flat DMs (`reply_in_thread: false`) Slack cannot+ render them, and Hermes shows no tool progress rather than degrading to text+ bubbles you did not enable.- 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