fix(slack): harden parent-text wake check against None + restore fixture parity

Follow-up rework on the #51627 cherry-pick:
- Guard the 5th wake check (parent-mentioned-bot, #24848) against a None
  parent_text — _fetch_thread_parent_text is typed to return str but tests
  (and defensive callers) can surface None; 'in None' raised TypeError.
- Drop the PR's fixture-level _fetch_thread_parent_text/_fetch_thread_context
  AsyncMocks from TestThreadReplyHandling/TestAssistantThreadLifecycle: main's
  #24848 tests exercise the real parent-text path via conversations_replies
  side effects, and the blanket mocks broke them.
- _resolve_user_is_bot reworked to the workspace-scoped (team_id, user_id)
  cache key introduced by the multi-workspace name cache on main.
This commit is contained in:
Teknium 2026-07-22 08:09:52 -07:00
parent 3f08201bac
commit 2168df37b8
2 changed files with 1 additions and 5 deletions

View file

@ -4088,7 +4088,7 @@ class SlackAdapter(BasePlatformAdapter):
team_id=team_id,
strip_bot_mention=False,
)
if f"<@{bot_uid}>" in parent_text:
if parent_text and f"<@{bot_uid}>" in parent_text:
# Remember the thread so later replies skip the fetch.
if not self._slack_strict_mention():
self._register_mentioned_thread(event_thread_ts)

View file

@ -4024,8 +4024,6 @@ class TestThreadReplyHandling:
a._bot_user_id = "U_BOT"
a._team_bot_user_ids = {"T_TEAM": "U_BOT"}
a._running = True
a._fetch_thread_parent_text = AsyncMock(return_value=None)
a._fetch_thread_context = AsyncMock(return_value="")
a.handle_message = AsyncMock()
a.set_session_store(mock_session_store)
return a
@ -4410,8 +4408,6 @@ class TestAssistantThreadLifecycle:
a._bot_user_id = "U_BOT"
a._team_bot_user_ids = {"T_TEAM": "U_BOT"}
a._running = True
a._fetch_thread_parent_text = AsyncMock(return_value=None)
a._fetch_thread_context = AsyncMock(return_value="")
a.handle_message = AsyncMock()
a.set_session_store(mock_session_store)
return a