Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Fix CI: open the hand-off lock in a tenant session

raullopez-sandboxbb2a35f10a92
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/chat-platform-logos.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/chat-platform-logos.test.tsx
index d805ca028..e605b42ac 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/chat-platform-logos.test.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/chat-platform-logos.test.tsx
@@ -56,11 +56,11 @@ describe('messaging-app logos in chat', () => {
expect(apps()).toEqual([
'Slack (logo, inline)',
'Microsoft Teams (logo, inline)',
- 'Mattermost (logo, inline)',
+ 'Discord (logo, inline)',
'Telegram (logo, inline)',
]);
expect(container!.textContent?.replace(/\s+/g, ' ')).toContain(
- 'Slack, Microsoft Teams, Mattermost and Telegram'
+ 'Slack, Microsoft Teams, Discord and Telegram'
);
expect(container!.textContent).not.toContain('switchdash');
});
diff --git a/core/switch_core/chats/service.py b/core/switch_core/chats/service.py
index f15ba68b7..9e4db22bf 100644
--- a/core/switch_core/chats/service.py
+++ b/core/switch_core/chats/service.py
@@ -1502,7 +1502,7 @@ class ChatService:
)
return room
operation_id = self._operation_id(tenant_id, user.id, request_id)
- async with self._provisioning_one_at_a_time(operation_id):
+ async with self._provisioning_one_at_a_time(tenant_id, operation_id):
async with tenant_session(self.session_factory, tenant_id) as session:
found = await self._room_of_operation(session, operation_id)
if found is None:
@@ -1570,13 +1570,13 @@ class ChatService:
@asynccontextmanager
async def _provisioning_one_at_a_time(
- self, operation_id: str
+ self, tenant_id: str, operation_id: str
) -> AsyncIterator[None]:
"""At most one attempt at an operation's room at once, across every
server process: a session-level advisory lock, released with the
connection if the process dies."""
key = func.hashtext(f"chat-create:{operation_id}")
- async with self.session_factory() as session:
+ async with tenant_session(self.session_factory, tenant_id) as session:
await session.execute(select(func.pg_advisory_lock(key)))
try:
yield