diff --git a/plugin/adapter.py b/plugin/adapter.py index c08065d..cb4091d 100644 --- a/plugin/adapter.py +++ b/plugin/adapter.py @@ -3384,24 +3384,35 @@ class RocketChatAdapter(BasePlatformAdapter): f"in {c['room_name']} ({severity}: {explanation})" ) - text = ( - f"⚠️ **Keyword-Konflikt erkannt** ({keyword_label}-Keywords):\n\n" - + "\n".join(conflict_lines) - + "\n\n👉 Möchtest Du die Keywords trotzdem verwenden oder andere wählen?" - ) + # V8.4.2.1: INFO-Konflikte sind reine Hinweise — keine Buttons + all_info = all(c["conflict_type"] == "INFO" for c in conflicts) - _build = self._get_build_custom_buttons() - buttons = _build( - ["1️⃣ Trotzdem verwenden", "2️⃣ Anderes Keyword"], - prefix=f"CONFLICT:{rid}", - style="primary", - ) - attachments = [{ - "color": "#f5a623", - "title": "Keyword-Konflikt auflösen", - "actions": buttons, - }] - await self._post_message_with_retry(operator_room_id, text, attachments=attachments) + if all_info: + text = ( + f"ℹ️ **Keyword-Hinweis** ({keyword_label}-Keywords):\n\n" + + "\n".join(conflict_lines) + + "\n\n💡 Der Butler wird im anderen Raum nachfragen. Keine Aktion nötig." + ) + await self._post_message_with_retry(operator_room_id, text) + else: + text = ( + f"⚠️ **Keyword-Konflikt erkannt** ({keyword_label}-Keywords):\n\n" + + "\n".join(conflict_lines) + + "\n\n👉 Möchtest Du die Keywords trotzdem verwenden oder andere wählen?" + ) + + _build = self._get_build_custom_buttons() + buttons = _build( + ["1️⃣ Trotzdem verwenden", "2️⃣ Anderes Keyword"], + prefix=f"CONFLICT:{rid}", + style="primary", + ) + attachments = [{ + "color": "#f5a623", + "title": "Keyword-Konflikt auflösen", + "actions": buttons, + }] + await self._post_message_with_retry(operator_room_id, text, attachments=attachments) async def _ask_onboarding_question(self, operator_room_id: str) -> None: """Sendet die aktuelle Interview-Frage an den Operator.""" diff --git a/plugin/archivar/tests/test_v8_4_2.py b/plugin/archivar/tests/test_v8_4_2.py index 04367f6..381f7a4 100644 --- a/plugin/archivar/tests/test_v8_4_2.py +++ b/plugin/archivar/tests/test_v8_4_2.py @@ -192,13 +192,22 @@ def _build_mock_adapter(room_map_path: str): """Build a RocketChatAdapter with mocked external dependencies. Uses __new__ to skip __init__ (same pattern as test_v8_3_4.py). + V8.4.2.1: Isoliert ArchivarState via /tmp/archivar_test_state.json + um persistierte State-Leaks zwischen Testläufen zu verhindern. """ os.environ["MULTIROOM_AGENT"] = "true" os.environ["ARCHIVAR_ROOM_MAP_PATH"] = room_map_path + os.environ["ARCHIVAR_STATE_PATH"] = "/tmp/archivar_test_state.json" os.environ["ROCKETCHAT_BASE_URL"] = "https://rocket.example.com" os.environ["ROCKETCHAT_USER"] = "testbot" os.environ["ROCKETCHAT_PASSWORD"] = "testpass" + # Clean leftover state from previous runs + try: + os.remove("/tmp/archivar_test_state.json") + except FileNotFoundError: + pass + from plugin.adapter import RocketChatAdapter, RocketChatREST from archivar.conversation_history import ConversationHistory from archivar.multiroom_context import MultiRoomContextRing @@ -389,7 +398,7 @@ class TestV842OnboardingConflictResolution(unittest.TestCase): self.assertIn("WARNUNG", text) def test_conflict_buttons_sent_for_context_vs_100(self): - """Kontext-Keyword vs 100%-Keyword → INFO-Buttons.""" + """Kontext-Keyword vs 100%-Keyword → INFO-Hinweis, KEINE Buttons.""" adapter = _build_mock_adapter(str(self.temp_path)) adapter._post_message_with_retry = AsyncMock(return_value=True) adapter._get_build_custom_buttons = MagicMock(return_value=MagicMock(return_value=[])) @@ -429,8 +438,14 @@ class TestV842OnboardingConflictResolution(unittest.TestCase): )) self.assertTrue(adapter._post_message_with_retry.called) - text = adapter._post_message_with_retry.call_args[0][1] + call_args = adapter._post_message_with_retry.call_args + text = call_args[0][1] self.assertIn("INFO", text) + # V8.4.2.1: INFO sendet KEINE Buttons — nur Text-Hinweis + self.assertIn("ℹ️", text) + self.assertIn("Keine Aktion nötig", text) + # Keine attachments übergeben + self.assertEqual(len(call_args[0]), 2) # nur (room_id, text), kein attachments def test_keep_anyway_proceeds_to_next_question(self): """'Trotzdem verwenden' → Keyword gespeichert, nächste Frage."""