diff --git a/openhands/core/main.py b/openhands/core/main.py index f2555766f8..43a07a02db 100644 --- a/openhands/core/main.py +++ b/openhands/core/main.py @@ -139,7 +139,7 @@ async def run_controller( selected_repository=config.sandbox.selected_repo, repo_directory=repo_directory, conversation_instructions=conversation_instructions, - working_dir=config.workspace_mount_path_in_sandbox, + working_dir=str(runtime.workspace_root), ) # Add MCP tools to the agent diff --git a/tests/unit/core/config/test_config.py b/tests/unit/core/config/test_config.py index 8fcb7d2ee6..78abd5b804 100644 --- a/tests/unit/core/config/test_config.py +++ b/tests/unit/core/config/test_config.py @@ -443,6 +443,8 @@ def test_sandbox_volumes(monkeypatch, default_config): 'SANDBOX_VOLUMES', '/host/path1:/container/path1,/host/path2:/container/path2:ro', ) + # Clear any existing workspace mount path to test default behavior + monkeypatch.delenv('WORKSPACE_MOUNT_PATH_IN_SANDBOX', raising=False) load_from_env(default_config, os.environ) finalize_config(default_config) @@ -465,6 +467,8 @@ def test_sandbox_volumes(monkeypatch, default_config): def test_sandbox_volumes_with_mode(monkeypatch, default_config): # Test SANDBOX_VOLUMES with read-only mode (no explicit /workspace mount) monkeypatch.setenv('SANDBOX_VOLUMES', '/host/path1:/container/path1:ro') + # Clear any existing workspace mount path to test default behavior + monkeypatch.delenv('WORKSPACE_MOUNT_PATH_IN_SANDBOX', raising=False) load_from_env(default_config, os.environ) finalize_config(default_config) diff --git a/tests/unit/test_state_metrics_exposure.py b/tests/unit/test_state_metrics_exposure.py index a6ec4b23e0..24b89eaefb 100644 --- a/tests/unit/test_state_metrics_exposure.py +++ b/tests/unit/test_state_metrics_exposure.py @@ -27,6 +27,7 @@ class FakeEventStream: class FakeRuntime: def __init__(self): self.event_stream = FakeEventStream() + self.workspace_root = '/workspace' async def connect(self): return None