Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fixes or vscode token / url not being present (#9661)

Tim O'Farrellb99150c61611
diff --git a/openhands/runtime/base.py b/openhands/runtime/base.py
index b5f983dc28..854f3fc823 100644
--- a/openhands/runtime/base.py
+++ b/openhands/runtime/base.py
@@ -1089,7 +1089,7 @@ fi
return False
@classmethod
- def setup(cls, config: OpenHandsConfig):
+ def setup(cls, config: OpenHandsConfig, headless_mode: bool = False):
"""Set up the environment for runtimes to be created."""
@classmethod
diff --git a/openhands/runtime/impl/local/local_runtime.py b/openhands/runtime/impl/local/local_runtime.py
index 90b21954b6..9ad124aeb5 100644
--- a/openhands/runtime/impl/local/local_runtime.py
+++ b/openhands/runtime/impl/local/local_runtime.py
@@ -36,6 +36,7 @@ from openhands.runtime.impl.docker.docker_runtime import (
VSCODE_PORT_RANGE,
)
from openhands.runtime.plugins import PluginRequirement
+from openhands.runtime.plugins.vscode import VSCodeRequirement
from openhands.runtime.runtime_status import RuntimeStatus
from openhands.runtime.utils import find_available_tcp_port
from openhands.runtime.utils.command import get_action_execution_server_startup_command
@@ -379,7 +380,7 @@ class LocalRuntime(ActionExecutionClient):
_create_warm_server_in_background(self.config, self.plugins)
@classmethod
- def setup(cls, config: OpenHandsConfig):
+ def setup(cls, config: OpenHandsConfig, headless_mode: bool = False):
should_check_dependencies = os.getenv('SKIP_DEPENDENCY_CHECK', '') != '1'
if should_check_dependencies:
code_repo_path = os.path.dirname(os.path.dirname(openhands.__file__))
@@ -390,8 +391,13 @@ class LocalRuntime(ActionExecutionClient):
# Initialize warm servers if needed
if initial_num_warm_servers > 0 and len(_WARM_SERVERS) == 0:
plugins = _get_plugins(config)
+
+ # Copy the logic from Runtime where we add a VSCodePlugin on init if missing
+ if not headless_mode:
+ plugins.append(VSCodeRequirement())
+
for _ in range(initial_num_warm_servers):
- _create_warm_server_in_background(config, plugins)
+ _create_warm_server(config, plugins)
@tenacity.retry(
wait=tenacity.wait_fixed(2),
diff --git a/openhands/server/conversation_manager/docker_nested_conversation_manager.py b/openhands/server/conversation_manager/docker_nested_conversation_manager.py
index 4cc47adb44..a526656e7b 100644
--- a/openhands/server/conversation_manager/docker_nested_conversation_manager.py
+++ b/openhands/server/conversation_manager/docker_nested_conversation_manager.py
@@ -498,6 +498,7 @@ class DockerNestedConversationManager(ConversationManager):
env_vars['SESSION_API_KEY'] = self._get_session_api_key_for_conversation(sid)
# We need to be able to specify the nested conversation id within the nested runtime
env_vars['ALLOW_SET_CONVERSATION_ID'] = '1'
+ env_vars['WORKSPACE_BASE'] = '/workspace'
env_vars['SANDBOX_CLOSE_DELAY'] = '0'
env_vars['SKIP_DEPENDENCY_CHECK'] = '1'
env_vars['INITIAL_NUM_WARM_SERVERS'] = '1'