Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: remove org_id from ownership assertion in save_app_conversation_info (#14727)

Tim O'Farrell65ae6bdabeea
diff --git a/enterprise/server/utils/saas_app_conversation_info_injector.py b/enterprise/server/utils/saas_app_conversation_info_injector.py
index dbc523c0b5..533e1bbdcd 100644
--- a/enterprise/server/utils/saas_app_conversation_info_injector.py
+++ b/enterprise/server/utils/saas_app_conversation_info_injector.py
@@ -392,9 +392,11 @@ class SaasSQLAppConversationInfoService(SQLAppConversationInfoService):
)
saas_result = await self.db_session.execute(saas_query)
existing_saas_metadata = saas_result.scalar_one_or_none()
- assert existing_saas_metadata is None or (
- existing_saas_metadata.user_id == user_id_uuid
- and existing_saas_metadata.org_id == org_id
+
+ # org_id is not asserted: it falls back to user.current_org_id, which changes when the user switches orgs.
+ assert (
+ existing_saas_metadata is None
+ or existing_saas_metadata.user_id == user_id_uuid
)
if not existing_saas_metadata: