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(core): make the chat-operation index migration's refusal actionable

raullopez-sandboxc15565acbcde
diff --git a/core/switch_core/migrations/versions/f4a9c2e7b153_rooms_chat_operation_unique.py b/core/switch_core/migrations/versions/f4a9c2e7b153_rooms_chat_operation_unique.py
index 47befcf90..e68b0f2cd 100644
--- a/core/switch_core/migrations/versions/f4a9c2e7b153_rooms_chat_operation_unique.py
+++ b/core/switch_core/migrations/versions/f4a9c2e7b153_rooms_chat_operation_unique.py
@@ -33,8 +33,11 @@ def upgrade() -> None:
if duplicates:
raise RuntimeError(
f"rooms: {duplicates} Switch Console create request(s) made more "
- "than one room. Delete or archive the extra rooms (same "
- "metadata->>'chat_operation_id') and upgrade again."
+ "than one room. Delete the extra rooms (archived rooms count too) "
+ "and upgrade again. To list them, or to check before deploying: "
+ "SELECT tenant_id, metadata ->> 'chat_operation_id', array_agg(id) "
+ "FROM rooms WHERE metadata ? 'chat_operation_id' "
+ "GROUP BY 1, 2 HAVING count(*) > 1;"
)
op.create_index(
"uq_rooms_chat_operation_id",