Skip to content

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

Follow main: the organizations migration and the retry command

Petr Bauch62d688a526da
diff --git a/core/switch_core/bridges/agent/commands.py b/core/switch_core/bridges/agent/commands.py
index ae7923552..4757dd994 100644
--- a/core/switch_core/bridges/agent/commands.py
+++ b/core/switch_core/bridges/agent/commands.py
@@ -19,7 +19,6 @@ from switch_core.aliases import (
check_alias_collisions,
validate_alias_format,
)
-from switch_core.authz import Principal, administers_tenant, require_manage
from switch_core.bridges.agent.protocol.agent_core import (
AgentExistsError,
AgentRenameRefused,
@@ -521,9 +520,14 @@ async def _manages_room(
if room is not None and room.owner_id == user_id:
return True
user = await session.get(User, user_id)
- role = await users.tenant_role(session, client.tenant_id, user_id)
- if user is not None and administers_tenant(
- is_operator=user.role == "admin", tenant_role=role
+ if user is not None and await administers_on_record(
+ session,
+ client.session_factory,
+ users,
+ user,
+ target_type="room",
+ target_id=room_id,
+ details={"event": "chat_command", "command": "retry"},
):
return True
return False
diff --git a/core/switch_core/migrations/versions/238c68b7306e_organizations.py b/core/switch_core/migrations/versions/238c68b7306e_organizations.py
index 9e6a73648..5c5030d2e 100644
--- a/core/switch_core/migrations/versions/238c68b7306e_organizations.py
+++ b/core/switch_core/migrations/versions/238c68b7306e_organizations.py
@@ -19,7 +19,7 @@ why the column is nullable; the revision that makes it `NOT NULL` gives those
workspaces one first.
Revision ID: 238c68b7306e
-Revises: e5a9c3d71f08
+Revises: b7e1d4c9a2f6
Create Date: 2026-10-28 00:00:00.000000
"""
@@ -30,7 +30,7 @@ import sqlalchemy as sa
from alembic import op
revision: str = "238c68b7306e"
-down_revision: str | Sequence[str] | None = "e5a9c3d71f08"
+down_revision: str | Sequence[str] | None = "b7e1d4c9a2f6"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
expand_only: bool = True
diff --git a/core/tests/switch_core/test_migration_organizations.py b/core/tests/switch_core/test_migration_organizations.py
index 4de3f2b21..7b9eae433 100644
--- a/core/tests/switch_core/test_migration_organizations.py
+++ b/core/tests/switch_core/test_migration_organizations.py
@@ -16,7 +16,7 @@ from tests.switch_core.test_migration_operator_owns_tenant_zero import (
_upgrade_to,
)
-_PRE_MIGRATION_REVISION = "e5a9c3d71f08"
+_PRE_MIGRATION_REVISION = "b7e1d4c9a2f6"
_MIGRATION_UNDER_TEST = "238c68b7306e"
_TENANT_ZERO_ID = "00000000-0000-0000-0000-000000000000"