Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
A client starting in no room is logged at info, not error
Petr Bauch168223834e9c
diff --git a/core/switch_core/transport/postgres.py b/core/switch_core/transport/postgres.pyindex 558e36e68..83f073380 100644--- a/core/switch_core/transport/postgres.py+++ b/core/switch_core/transport/postgres.py@@ -331,13 +331,14 @@ class PostgresTransport:try:async with self._reading_rooms:rooms = await self.joined_rooms()+ # Normal for a new workspace's admin client and for an+ # agent not placed in a room yet: an invite starts its+ # first room. Kept as a pointer for a client that stays+ # silent: membership is the client_rooms table.if not rooms:- logger.error(- "Client %s is receiving but is a member of no room: "- "it will hear nothing until something adds it to "- "one. Membership is the client_rooms table, so a "- "client whose rows were never written is silent "- "rather than broken",+ logger.info(+ "Client %s is receiving in no room yet; it hears "+ "nothing until it is added to one (client_rooms)",self.user_id,)await self._watch_joined(rooms)diff --git a/core/tests/switch_core/transport/test_start_statements.py b/core/tests/switch_core/transport/test_start_statements.pyindex 5df2416a0..0d89d09cb 100644--- a/core/tests/switch_core/transport/test_start_statements.py+++ b/core/tests/switch_core/transport/test_start_statements.py@@ -10,6 +10,7 @@ from cursors it stores, writing the ones it has none for.from __future__ import annotationsimport asyncio+import loggingfrom collections.abc import AsyncIterator, Awaitable, Callableimport pytest@@ -18,6 +19,7 @@ from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmakerfrom switch_core.db.models import ClientRoom, Roomfrom switch_core.db.stores.message_store import MessageStorefrom switch_core.transport.cursors import DeliveryProgress, FromHead+from switch_core.transport.postgres import logger as transport_loggerfrom tests.ownership import start_holderfrom tests.switch_core.statement_counts import StatementCountsfrom tests.switch_core.transport.test_postgres_transport import (@@ -164,3 +166,25 @@ async def test_a_failed_batch_read_releases_every_claim(assert transport._watching == {}assert transport._cursors == {}+++async def test_starting_in_no_room_is_not_reported_as_a_problem(+ session_factory: async_sessionmaker[AsyncSession],+ caplog: pytest.LogCaptureFixture,+) -> None:+ """A new workspace's admin client, or an agent not placed anywhere yet,+ starts in no room. That is a state, not a fault, and must not reach the+ warning or error log that alerting and the end-to-end harness read."""+ client_id, user_id, _ = await _client_in_rooms(session_factory, 0)+ transport = _transport(session_factory, client_id=client_id, user_id=user_id)+ with caplog.at_level(logging.INFO, logger=transport_logger.name):+ task = asyncio.create_task(transport.receive_forever(FromHead(MessageStore())))+ for _ in range(300):+ if any(user_id in record.getMessage() for record in caplog.records):+ break+ await asyncio.sleep(0.01)+ await transport.close()+ task.cancel()++ about_it = [record for record in caplog.records if user_id in record.getMessage()]+ assert [record.levelno for record in about_it] == [logging.INFO]