Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Throw error if an illegal sandbox type is used (#1087)

Jim Sud4ce4ea5416b
diff --git a/opendevin/controller/command_manager.py b/opendevin/controller/command_manager.py
index eae3d3d2a2..8405e6d04f 100644
--- a/opendevin/controller/command_manager.py
+++ b/opendevin/controller/command_manager.py
@@ -18,16 +18,19 @@ class CommandManager:
container_image: str | None = None,
):
self.directory = directory
- if config.get(ConfigType.SANDBOX_TYPE).lower() == 'exec':
+ sandbox_type = config.get(ConfigType.SANDBOX_TYPE).lower()
+ if sandbox_type == 'exec':
self.shell = DockerExecBox(
sid=(sid or 'default'), workspace_dir=directory, container_image=container_image
)
- elif config.get('SANDBOX_TYPE').lower() == 'local':
+ elif sandbox_type == 'local':
self.shell = LocalBox(workspace_dir=directory)
- else:
+ elif sandbox_type == 'ssh':
self.shell = DockerSSHBox(
sid=(sid or 'default'), workspace_dir=directory, container_image=container_image
)
+ else:
+ raise ValueError(f'Invalid sandbox type: {sandbox_type}')
def run_command(self, command: str, background=False) -> CmdOutputObservation:
if background: