diff --git a/tests/gateway/test_notice_rendering.py b/tests/gateway/test_notice_rendering.py index 89a5435a507..3ba731f32e4 100644 --- a/tests/gateway/test_notice_rendering.py +++ b/tests/gateway/test_notice_rendering.py @@ -107,6 +107,10 @@ def _make_source(platform_value="telegram", chat_id="555", user_id="u1"): src.platform = plat src.chat_id = chat_id src.user_id = user_id + # Real SessionSource.profile is None (single-profile) or a str; a MagicMock + # auto-attribute would read as a truthy "stamped profile" and trip the + # fail-closed path in _adapter_for_source (see AGENTS.md pitfall #17). + src.profile = None return src diff --git a/tests/gateway/test_queue_consumption.py b/tests/gateway/test_queue_consumption.py index ec1b0dedc83..857da98da71 100644 --- a/tests/gateway/test_queue_consumption.py +++ b/tests/gateway/test_queue_consumption.py @@ -382,7 +382,9 @@ class TestBusyInputModeQueueFifo: return runner, adapter def _text_event(self, text: str) -> MessageEvent: - source = MagicMock(chat_id="c1", platform=Platform.TELEGRAM) + # profile=None: a MagicMock auto-attribute reads as a truthy stamped + # profile and trips fail-closed adapter resolution (AGENTS.md #17). + source = MagicMock(chat_id="c1", platform=Platform.TELEGRAM, profile=None) return MessageEvent( text=text, message_type=MessageType.TEXT, @@ -433,7 +435,7 @@ class TestBusyInputModeQueueFifo: runner, adapter = self._make_runner_and_adapter() session_key = "telegram:user:burst" - source = MagicMock(chat_id="c1", platform=Platform.TELEGRAM) + source = MagicMock(chat_id="c1", platform=Platform.TELEGRAM, profile=None) for i in range(3): runner._queue_or_replace_pending_event( session_key,