From a63001e1066ecf53e34c010fe6414513a3bd2bf4 Mon Sep 17 00:00:00 2001 From: openhands Date: Tue, 23 Dec 2025 04:15:00 +0000 Subject: [PATCH] Fix duplicate class registration by using consistent import paths The SQLSharedConversationInfoServiceInjector class was being registered twice because the same module was being imported via two different paths: - enterprise.server.sharing.sql_shared_conversation_info_service - server.sharing.sql_shared_conversation_info_service This happened because the enterprise pyproject.toml defines packages without the 'enterprise.' prefix (e.g., 'server' not 'enterprise.server'), and the PYTHONPATH includes both '.' and the poetry virtualenv. Fixed by changing all imports to use the canonical 'server.sharing.xxx' path that matches the package configuration. Co-authored-by: openhands --- enterprise/server/sharing/filesystem_shared_event_service.py | 2 +- enterprise/server/sharing/shared_conversation_router.py | 3 +-- enterprise/server/sharing/shared_event_router.py | 5 ++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/enterprise/server/sharing/filesystem_shared_event_service.py b/enterprise/server/sharing/filesystem_shared_event_service.py index 6adbaece12..0f0903bc61 100644 --- a/enterprise/server/sharing/filesystem_shared_event_service.py +++ b/enterprise/server/sharing/filesystem_shared_event_service.py @@ -23,7 +23,7 @@ from server.sharing.shared_event_service import ( SharedEventServiceInjector, ) -from enterprise.server.sharing.sql_shared_conversation_info_service import ( +from server.sharing.sql_shared_conversation_info_service import ( SQLSharedConversationInfoService, ) from openhands.agent_server.models import EventPage, EventSortOrder diff --git a/enterprise/server/sharing/shared_conversation_router.py b/enterprise/server/sharing/shared_conversation_router.py index 789933b149..26fe047e6d 100644 --- a/enterprise/server/sharing/shared_conversation_router.py +++ b/enterprise/server/sharing/shared_conversation_router.py @@ -13,8 +13,7 @@ from server.sharing.shared_conversation_models import ( SharedConversationPage, SharedConversationSortOrder, ) - -from enterprise.server.sharing.sql_shared_conversation_info_service import ( +from server.sharing.sql_shared_conversation_info_service import ( SQLSharedConversationInfoServiceInjector, ) diff --git a/enterprise/server/sharing/shared_event_router.py b/enterprise/server/sharing/shared_event_router.py index 4048bf63a8..233c379dfa 100644 --- a/enterprise/server/sharing/shared_event_router.py +++ b/enterprise/server/sharing/shared_event_router.py @@ -5,11 +5,10 @@ from typing import Annotated from uuid import UUID from fastapi import APIRouter, Depends, Query -from server.sharing.shared_event_service import SharedEventService - -from enterprise.server.sharing.filesystem_shared_event_service import ( +from server.sharing.filesystem_shared_event_service import ( SharedEventServiceImplInjector, ) +from server.sharing.shared_event_service import SharedEventService from openhands.agent_server.models import EventPage, EventSortOrder from openhands.app_server.event_callback.event_callback_models import EventKind from openhands.sdk import Event