Skip to content

πŸ™Œ OpenHands: AI-Driven Development

refactor: move ConversationTrigger to app_conversation_models and remove unused data models (#14156)

Tim O'Farrella89811f95220
diff --git a/openhands/app_server/app_conversation/app_conversation_models.py b/openhands/app_server/app_conversation/app_conversation_models.py
index 1dc208c3d8..f393e8c09f 100644
--- a/openhands/app_server/app_conversation/app_conversation_models.py
+++ b/openhands/app_server/app_conversation/app_conversation_models.py
@@ -15,13 +15,26 @@ from openhands.integrations.service_types import ProviderType, SuggestedTask
from openhands.sdk.conversation import ConversationExecutionStatus
from openhands.sdk.llm import MetricsSnapshot
from openhands.sdk.plugin import PluginSource
-from openhands.storage.data_models.conversation_metadata import ConversationTrigger
from openhands.storage.data_models.settings import SandboxGroupingStrategy
# Re-export SandboxGroupingStrategy for backward compatibility
__all__ = ['SandboxGroupingStrategy']
+class ConversationTrigger(Enum):
+ RESOLVER = 'resolver'
+ GUI = 'gui'
+ SUGGESTED_TASK = 'suggested_task'
+ REMOTE_API_KEY = 'openhands_api'
+ SLACK = 'slack'
+ MICROAGENT_MANAGEMENT = 'microagent_management'
+ JIRA = 'jira'
+ JIRA_DC = 'jira_dc'
+ LINEAR = 'linear'
+ BITBUCKET = 'bitbucket'
+ AUTOMATION = 'automation'
+
+
class AgentType(Enum):
"""Agent type for conversation."""
diff --git a/openhands/storage/data_models/conversation_metadata.py b/openhands/storage/data_models/conversation_metadata.py
index c59c119410..8f3c6718f6 100644
--- a/openhands/storage/data_models/conversation_metadata.py
+++ b/openhands/storage/data_models/conversation_metadata.py
@@ -1,22 +1,13 @@
from dataclasses import dataclass, field
from datetime import datetime, timezone
-from enum import Enum
+from openhands.app_server.app_conversation.app_conversation_models import (
+ ConversationTrigger,
+)
from openhands.integrations.service_types import ProviderType
-
-class ConversationTrigger(Enum):
- RESOLVER = 'resolver'
- GUI = 'gui'
- SUGGESTED_TASK = 'suggested_task'
- REMOTE_API_KEY = 'openhands_api'
- SLACK = 'slack'
- MICROAGENT_MANAGEMENT = 'microagent_management'
- JIRA = 'jira'
- JIRA_DC = 'jira_dc'
- LINEAR = 'linear'
- BITBUCKET = 'bitbucket'
- AUTOMATION = 'automation'
+# Re-export for backward compatibility
+__all__ = ['ConversationTrigger', 'ConversationMetadata']
@dataclass
diff --git a/openhands/storage/data_models/conversation_metadata_result_set.py b/openhands/storage/data_models/conversation_metadata_result_set.py
deleted file mode 100644
index 6f93827258..0000000000
--- a/openhands/storage/data_models/conversation_metadata_result_set.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from dataclasses import dataclass, field
-
-from openhands.storage.data_models.conversation_metadata import ConversationMetadata
-
-
-@dataclass
-class ConversationMetadataResultSet:
- results: list[ConversationMetadata] = field(default_factory=list)
- next_page_id: str | None = None
diff --git a/openhands/storage/data_models/conversation_status.py b/openhands/storage/data_models/conversation_status.py
deleted file mode 100644
index 9681d4d5ca..0000000000
--- a/openhands/storage/data_models/conversation_status.py
+++ /dev/null
@@ -1,23 +0,0 @@
-"""
-This class is similar to the RuntimeStatus defined in the runtime api. (When this class was defined
-a RuntimeStatus class already existed in OpenHands which serves a completely different purpose) Some of
-the status definitions do not match up:
-
-STOPPED/paused - the runtime is not running but may be restarted
-ARCHIVED/stopped - the runtime is not running and will not restart due to deleted files.
-"""
-
-from enum import Enum
-
-
-class ConversationStatus(Enum):
- # The conversation is starting
- STARTING = 'STARTING'
- # The conversation is running - the agent may be working or idle
- RUNNING = 'RUNNING'
- # The conversation has stopped (This is synonymous with `paused` in the runtime API.)
- STOPPED = 'STOPPED'
- # The conversation has been archived and cannot be restarted.
- ARCHIVED = 'ARCHIVED'
- # Something has gone wrong with the conversation (The runtime rather than the agent)
- ERROR = 'ERROR'