@@ -905,12 +905,17 @@ def test_mention_thread_name_does_not_include_request_content() -> None:
905905def test_is_agent_thread_requires_bot_owned_thread () -> None :
906906 bot_owned_thread = object .__new__ (discord .Thread )
907907 bot_owned_thread .owner_id = 999
908+ bot_owned_thread .name = "Agent response"
908909 user_owned_prefixed_thread = object .__new__ (discord .Thread )
909910 user_owned_prefixed_thread .owner_id = 123
910- user_owned_prefixed_thread .name = "agent: renamed by user"
911+ user_owned_prefixed_thread .name = "Agent response"
912+ bot_owned_job_thread = object .__new__ (discord .Thread )
913+ bot_owned_job_thread .owner_id = 999
914+ bot_owned_job_thread .name = "[RECRUITING] Senior Engineer"
911915
912916 assert AgentCog ._is_agent_thread (bot_owned_thread , 999 ) is True
913917 assert AgentCog ._is_agent_thread (user_owned_prefixed_thread , 999 ) is False
918+ assert AgentCog ._is_agent_thread (bot_owned_job_thread , 999 ) is False
914919
915920
916921@pytest .mark .asyncio
@@ -1167,6 +1172,32 @@ async def test_agent_thread_reply_continues_without_mention() -> None:
11671172 cog ._audit_message_safe .assert_not_called ()
11681173
11691174
1175+ @pytest .mark .asyncio
1176+ async def test_bot_owned_non_agent_thread_reply_without_mention_is_ignored () -> None :
1177+ cog = AgentCog .__new__ (AgentCog )
1178+ cog .bot = SimpleNamespace (user = SimpleNamespace (id = 999 ))
1179+ cog ._post_agent_request = AsyncMock ()
1180+ cog ._audit_message_safe = Mock ()
1181+ channel = object .__new__ (discord .Thread )
1182+ channel .owner_id = 999
1183+ channel .name = "[RECRUITING] Senior Engineer"
1184+ message = SimpleNamespace (
1185+ id = 555 ,
1186+ content = "@Jon Knebel ?" ,
1187+ author = SimpleNamespace (id = 123 , bot = False , roles = []),
1188+ mentions = [SimpleNamespace (id = 111 )],
1189+ guild = SimpleNamespace (id = 456 ),
1190+ channel = channel ,
1191+ reply = AsyncMock (),
1192+ )
1193+
1194+ await cog .agent_mention (message )
1195+
1196+ cog ._post_agent_request .assert_not_awaited ()
1197+ message .reply .assert_not_awaited ()
1198+ cog ._audit_message_safe .assert_not_called ()
1199+
1200+
11701201@pytest .mark .asyncio
11711202async def test_agent_mention_routes_unlinked_member_report_to_ephemeral_command () -> (
11721203 None
0 commit comments