Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove unused core.schema package and KubernetesConfig (#14208)

Tim O'Farrellbc4706524aee
diff --git a/enterprise/integrations/models.py b/enterprise/integrations/models.py
index da701f8cd2..10cc61b3fc 100644
--- a/enterprise/integrations/models.py
+++ b/enterprise/integrations/models.py
@@ -3,8 +3,6 @@ from typing import Any
from pydantic import BaseModel
-from openhands.core.schema import AgentState
-
class SourceType(str, Enum):
GITHUB = 'github'
@@ -42,21 +40,3 @@ class JobContext(BaseModel):
base_api_url: str = ''
issue_title: str = ''
issue_description: str = ''
-
-
-class JobResult:
- result: str
- explanation: str
-
-
-class GithubResolverJob:
- type: SourceType
- status: AgentState
- result: JobResult
- owner: str
- repo: str
- installation_token: str
- issue_number: int
- runtime_id: int
- created_at: int
- completed_at: int
diff --git a/openhands/core/config/kubernetes_config.py b/openhands/core/config/kubernetes_config.py
deleted file mode 100644
index 8845de8613..0000000000
--- a/openhands/core/config/kubernetes_config.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# IMPORTANT: LEGACY V0 CODE - Deprecated since version 1.0.0, scheduled for removal April 1, 2026
-# This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1.
-# OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application server. Please refer to:
-# - V1 agentic core (SDK): https://github.com/OpenHands/software-agent-sdk
-# - V1 application server (in this repo): openhands/app_server/
-# Unless you are working on deprecation, please avoid extending this legacy file and consult the V1 codepaths above.
-# Tag: Legacy-V0
-from pydantic import BaseModel, ConfigDict, Field, ValidationError
-
-
-class KubernetesConfig(BaseModel):
- """Configuration for Kubernetes runtime.
-
- Attributes:
- namespace: The Kubernetes namespace to use for OpenHands resources
- ingress_domain: Domain for ingress resources
- pvc_storage_size: Size of the persistent volume claim (e.g. "2Gi")
- pvc_storage_class: Storage class for persistent volume claims
- resource_cpu_request: CPU request for runtime pods
- resource_memory_request: Memory request for runtime pods
- resource_memory_limit: Memory limit for runtime pods
- image_pull_secret: Optional name of image pull secret for private registries
- ingress_tls_secret: Optional name of TLS secret for ingress
- node_selector_key: Optional node selector key for pod scheduling
- node_selector_val: Optional node selector value for pod scheduling
- tolerations_yaml: Optional YAML string defining pod tolerations
- """
-
- namespace: str = Field(
- default='default',
- description='The Kubernetes namespace to use for OpenHands resources',
- )
- ingress_domain: str = Field(
- default='localhost', description='Domain for ingress resources'
- )
- pvc_storage_size: str = Field(
- default='2Gi', description='Size of the persistent volume claim'
- )
- pvc_storage_class: str | None = Field(
- default=None, description='Storage class for persistent volume claims'
- )
- resource_cpu_request: str = Field(
- default='1', description='CPU request for runtime pods'
- )
- resource_memory_request: str = Field(
- default='1Gi', description='Memory request for runtime pods'
- )
- resource_memory_limit: str = Field(
- default='2Gi', description='Memory limit for runtime pods'
- )
- image_pull_secret: str | None = Field(
- default=None,
- description='Optional name of image pull secret for private registries',
- )
- ingress_tls_secret: str | None = Field(
- default=None, description='Optional name of TLS secret for ingress'
- )
- node_selector_key: str | None = Field(
- default=None, description='Optional node selector key for pod scheduling'
- )
- node_selector_val: str | None = Field(
- default=None, description='Optional node selector value for pod scheduling'
- )
- tolerations_yaml: str | None = Field(
- default=None, description='Optional YAML string defining pod tolerations'
- )
- privileged: bool = Field(
- default=False,
- description='Run the runtime sandbox container in privileged mode for use with docker-in-docker',
- )
-
- model_config = ConfigDict(extra='forbid')
-
- @classmethod
- def from_toml_section(cls, data: dict) -> dict[str, 'KubernetesConfig']:
- """Create a mapping of KubernetesConfig instances from a toml dictionary representing the [kubernetes] section.
-
- The configuration is built from all keys in data.
-
- Returns:
- dict[str, KubernetesConfig]: A mapping where the key "kubernetes" corresponds to the [kubernetes] configuration
- """
- # Initialize the result mapping
- kubernetes_mapping: dict[str, KubernetesConfig] = {}
-
- # Try to create the configuration instance
- try:
- kubernetes_mapping['kubernetes'] = cls.model_validate(data)
- except ValidationError as e:
- raise ValueError(f'Invalid kubernetes configuration: {e}')
-
- return kubernetes_mapping
diff --git a/openhands/core/config/openhands_config.py b/openhands/core/config/openhands_config.py
index 3c91a38baf..1b0d19b190 100644
--- a/openhands/core/config/openhands_config.py
+++ b/openhands/core/config/openhands_config.py
@@ -19,7 +19,6 @@ from openhands.core.config.config_utils import (
model_defaults_to_dict,
)
from openhands.core.config.extended_config import ExtendedConfig
-from openhands.core.config.kubernetes_config import KubernetesConfig
from openhands.core.config.llm_config import LLMConfig
from openhands.core.config.mcp_config import MCPConfig
from openhands.core.config.sandbox_config import SandboxConfig
@@ -119,7 +118,6 @@ class OpenHandsConfig(BaseModel):
)
mcp_host: str = Field(default=f'localhost:{os.getenv("port", 3000)}')
mcp: MCPConfig = Field(default_factory=MCPConfig)
- kubernetes: KubernetesConfig = Field(default_factory=KubernetesConfig)
git_user_name: str = Field(
default='openhands', description='Git user name for commits made by the agent'
)
diff --git a/openhands/core/config/utils.py b/openhands/core/config/utils.py
index 63bb2140b6..1656be5508 100644
--- a/openhands/core/config/utils.py
+++ b/openhands/core/config/utils.py
@@ -25,7 +25,6 @@ from openhands.core import logger
from openhands.core.config.agent_config import AgentConfig
from openhands.core.config.arg_utils import get_headless_parser
from openhands.core.config.extended_config import ExtendedConfig
-from openhands.core.config.kubernetes_config import KubernetesConfig
from openhands.core.config.llm_config import LLMConfig
from openhands.core.config.mcp_config import mcp_config_from_toml
from openhands.core.config.openhands_config import OpenHandsConfig
@@ -254,19 +253,6 @@ def load_from_toml(cfg: OpenHandsConfig, toml_file: str = 'config.toml') -> None
except ValueError:
raise ValueError('Error in MCP sections in config.toml')
- # Process kubernetes section if present
- if 'kubernetes' in toml_config:
- try:
- kubernetes_mapping = KubernetesConfig.from_toml_section(
- toml_config['kubernetes']
- )
- if 'kubernetes' in kubernetes_mapping:
- cfg.kubernetes = kubernetes_mapping['kubernetes']
- except (TypeError, KeyError, ValidationError) as e:
- logger.openhands_logger.warning(
- f'Cannot parse [kubernetes] config from toml, values have not been applied.\nError: {e}'
- )
-
# Process extended section if present
if 'extended' in toml_config:
try:
@@ -277,8 +263,8 @@ def load_from_toml(cfg: OpenHandsConfig, toml_file: str = 'config.toml') -> None
)
# Check for unknown sections
- # Note: 'condenser' and 'model_routing' are kept for backwards compatibility
- # with old config files - they are silently ignored
+ # Note: 'condenser', 'model_routing', and 'kubernetes' are kept for backwards
+ # compatibility with old config files - they are silently ignored
known_sections = {
'core',
'extended',
@@ -288,7 +274,7 @@ def load_from_toml(cfg: OpenHandsConfig, toml_file: str = 'config.toml') -> None
'sandbox',
'condenser', # Legacy, ignored
'mcp',
- 'kubernetes',
+ 'kubernetes', # Legacy, ignored
'model_routing', # Legacy, ignored
}
for key in toml_config:
diff --git a/openhands/core/schema/__init__.py b/openhands/core/schema/__init__.py
deleted file mode 100644
index 6c90382968..0000000000
--- a/openhands/core/schema/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from openhands.core.schema.agent import AgentState
-
-__all__ = [
- 'AgentState',
-]
diff --git a/openhands/core/schema/agent.py b/openhands/core/schema/agent.py
deleted file mode 100644
index 6a240fef4e..0000000000
--- a/openhands/core/schema/agent.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# IMPORTANT: LEGACY V0 CODE - Deprecated since version 1.0.0, scheduled for removal April 1, 2026
-# This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1.
-# OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application server. Please refer to:
-# - V1 agentic core (SDK): https://github.com/OpenHands/software-agent-sdk
-# - V1 application server (in this repo): openhands/app_server/
-# Unless you are working on deprecation, please avoid extending this legacy file and consult the V1 codepaths above.
-# Tag: Legacy-V0
-from enum import Enum
-
-
-class AgentState(str, Enum):
- LOADING = 'loading'
- """The agent is loading.
- """
-
- RUNNING = 'running'
- """The agent is running.
- """
-
- AWAITING_USER_INPUT = 'awaiting_user_input'
- """The agent is awaiting user input.
- """
-
- PAUSED = 'paused'
- """The agent is paused.
- """
-
- STOPPED = 'stopped'
- """The agent is stopped.
- """
-
- FINISHED = 'finished'
- """The agent is finished with the current task.
- """
-
- REJECTED = 'rejected'
- """The agent rejects the task.
- """
-
- ERROR = 'error'
- """An error occurred during the task.
- """
-
- AWAITING_USER_CONFIRMATION = 'awaiting_user_confirmation'
- """The agent is awaiting user confirmation.
- """
-
- USER_CONFIRMED = 'user_confirmed'
- """The user confirmed the agent's action.
- """
-
- USER_REJECTED = 'user_rejected'
- """The user rejected the agent's action.
- """
-
- RATE_LIMITED = 'rate_limited'
- """The agent is rate limited.
- """
diff --git a/tests/unit/core/config/test_config.py b/tests/unit/core/config/test_config.py
index 33e69fdf2b..22f38f9add 100644
--- a/tests/unit/core/config/test_config.py
+++ b/tests/unit/core/config/test_config.py
@@ -541,7 +541,7 @@ def test_load_from_toml_partial_invalid(default_config, temp_toml_file, caplog):
debug = true
[llm]
-# Not set in `openhands/core/schema/config.py`
+# Not set in LLMConfig
invalid_field = "test"
model = "gpt-4"
diff --git a/tests/unit/core/config/test_kubernetes_config.py b/tests/unit/core/config/test_kubernetes_config.py
deleted file mode 100644
index 3bac845395..0000000000
--- a/tests/unit/core/config/test_kubernetes_config.py
+++ /dev/null
@@ -1,62 +0,0 @@
-import pytest
-from pydantic import ValidationError
-
-from openhands.core.config.kubernetes_config import KubernetesConfig
-
-
-def test_kubernetes_config_defaults():
- """Test that KubernetesConfig has correct default values."""
- config = KubernetesConfig()
- assert config.namespace == 'default'
- assert config.ingress_domain == 'localhost'
- assert config.pvc_storage_size == '2Gi'
- assert config.pvc_storage_class is None
- assert config.resource_cpu_request == '1'
- assert config.resource_memory_request == '1Gi'
- assert config.resource_memory_limit == '2Gi'
- assert config.image_pull_secret is None
- assert config.ingress_tls_secret is None
- assert config.node_selector_key is None
- assert config.node_selector_val is None
- assert config.tolerations_yaml is None
- assert config.privileged is False
-
-
-def test_kubernetes_config_custom_values():
- """Test that KubernetesConfig accepts custom values."""
- config = KubernetesConfig(
- namespace='test-ns',
- ingress_domain='test.example.com',
- pvc_storage_size='5Gi',
- pvc_storage_class='fast',
- resource_cpu_request='2',
- resource_memory_request='2Gi',
- resource_memory_limit='4Gi',
- image_pull_secret='pull-secret',
- ingress_tls_secret='tls-secret',
- node_selector_key='zone',
- node_selector_val='us-east-1',
- tolerations_yaml='- key: special\n value: true',
- privileged=True,
- )
-
- assert config.namespace == 'test-ns'
- assert config.ingress_domain == 'test.example.com'
- assert config.pvc_storage_size == '5Gi'
- assert config.pvc_storage_class == 'fast'
- assert config.resource_cpu_request == '2'
- assert config.resource_memory_request == '2Gi'
- assert config.resource_memory_limit == '4Gi'
- assert config.image_pull_secret == 'pull-secret'
- assert config.ingress_tls_secret == 'tls-secret'
- assert config.node_selector_key == 'zone'
- assert config.node_selector_val == 'us-east-1'
- assert config.tolerations_yaml == '- key: special\n value: true'
- assert config.privileged is True
-
-
-def test_kubernetes_config_validation():
- """Test that KubernetesConfig validates input correctly."""
- # Test that extra fields are not allowed
- with pytest.raises(ValidationError):
- KubernetesConfig(extra_field='not allowed')