mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-23 16:36:23 +00:00
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:
parent
79f2872ba7
commit
7e42f0143c
2 changed files with 1 additions and 5 deletions
|
|
@ -3820,7 +3820,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)
|
||||
|
|
|
|||
|
|
@ -3538,8 +3538,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
|
||||
|
|
@ -3924,8 +3922,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue