diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 36e30e18e..7270d67a8 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-client-${{ hashFiles('**/pyproject.toml') }} + key: ${{ runner.os }}-pip-client-${{ hashFiles('**/pyproject.toml', 'workspace/backend/requirements-test.txt') }} restore-keys: | ${{ runner.os }}-pip-client- @@ -39,6 +39,7 @@ jobs: python -m pip install --upgrade pip pip install pytest pytest-asyncio pytest-aiohttp pytest-mock pip install -e . + pip install -r workspace/backend/requirements-test.txt - name: Test ONM primitives run: pytest --tb=short -v tests/test_onm_addressing.py tests/test_onm_events.py tests/test_onm_pipeline.py diff --git a/src/openagents/mods/communication/simple_messaging/adapter.py b/src/openagents/mods/communication/simple_messaging/adapter.py index b81d838e2..573fca908 100644 --- a/src/openagents/mods/communication/simple_messaging/adapter.py +++ b/src/openagents/mods/communication/simple_messaging/adapter.py @@ -249,7 +249,7 @@ async def send_direct_message( # Create and send the message message = Event( - event_name="agent.direct_message.send", + event_name="thread.direct_message.send", source_id=self.agent_id, destination_id=target_agent_id, payload={ @@ -262,7 +262,10 @@ async def send_direct_message( # DO NOT add outbound messages to sender's threads - only recipients should process incoming messages # The message will be added to the recipient's thread when they receive it via process_incoming_direct_message - await self.connector.send_direct_message(message) + if hasattr(self.connector, "send_direct_message"): + await self.connector.send_direct_message(message) + else: + await self.connector.send_event(message) logger.debug(f"Sent direct message to {target_agent_id}") async def send_broadcast_message(self, content: Dict[str, Any]) -> None: @@ -287,7 +290,10 @@ async def send_broadcast_message(self, content: Dict[str, Any]) -> None: # Add message to the broadcast conversation thread message.thread_name = get_broadcast_event_thread_id() - await self.connector.send_broadcast_message(message) + if hasattr(self.connector, "send_broadcast_message"): + await self.connector.send_broadcast_message(message) + else: + await self.connector.send_event(message) logger.debug("Sent broadcast message") async def send_text_message(self, target_agent_id: str, text: str) -> None: diff --git a/src/openagents/mods/communication/simple_messaging/mod.py b/src/openagents/mods/communication/simple_messaging/mod.py index 17bad2c3f..5c687933c 100644 --- a/src/openagents/mods/communication/simple_messaging/mod.py +++ b/src/openagents/mods/communication/simple_messaging/mod.py @@ -37,6 +37,11 @@ def __init__(self, mod_name: str = "simple_messaging"): self.register_event_handler( self._handle_direct_message, "agent.direct_message.*" ) + # Also handle thread-namespaced DM events (used by adapters that + # target the workspace/thread messaging mod pipeline). + self.register_event_handler( + self._handle_direct_message, "thread.direct_message.*" + ) self.register_event_handler( self._handle_broadcast_message, "agent.broadcast_message.*" ) diff --git a/workspace/backend/requirements-test.txt b/workspace/backend/requirements-test.txt new file mode 100644 index 000000000..807f355aa --- /dev/null +++ b/workspace/backend/requirements-test.txt @@ -0,0 +1,8 @@ +# Minimal deps for running workspace backend tests in CI +fastapi>=0.115.0 +uvicorn>=0.30.0 +pydantic>=2.0.0 +sqlalchemy>=2.0.0 +python-dotenv>=1.0.0 +python-multipart>=0.0.9 +httpx>=0.25.0