wooden-umbrella-84098
11/18/2025, 8:27 PMchilly-france-44439
11/18/2025, 8:28 PMopenhands-agent-serverwooden-umbrella-84098
11/18/2025, 8:30 PMwooden-umbrella-84098
11/18/2025, 8:30 PMwooden-umbrella-84098
11/18/2025, 8:31 PMpython cve_scan.py ./test_repo/
Traceback (most recent call last):
File "/root/git/cve-demo/cve_scan.py", line 13, in <module>
from src.cve_orchestrator import main
File "/root/git/cve-demo/src/cve_orchestrator.py", line 15, in <module>
from src.scanner_agent import CVEScanner
File "/root/git/cve-demo/src/scanner_agent.py", line 12, in <module>
from openhands.workspace import DockerWorkspace
File "/root/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/openhands/workspace/__init__.py", line 3, in <module>
from .docker import DockerWorkspace
File "/root/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/openhands/workspace/docker/__init__.py", line 3, in <module>
from .workspace import DockerWorkspace
File "/root/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/openhands/workspace/docker/workspace.py", line 14, in <module>
from openhands.agent_server.docker.build import (
File "/root/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/openhands/agent_server/docker/build.py", line 310, in <module>
_DEFAULT_GIT_REF, _DEFAULT_GIT_SHA = _git_info()
^^^^^^^^^^^
File "/root/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/openhands/agent_server/docker/build.py", line 265, in _git_info
sdk_root = _default_sdk_project_root()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/openhands/agent_server/docker/build.py", line 132, in _default_sdk_project_root
raise RuntimeError(
RuntimeError: Could not resolve the OpenHands UV workspace root.
Expected repo layout:
pyproject.toml (with [tool.uv.workspace].members including openhands/* subprojects)
openhands-sdk/pyproject.toml
openhands-tools/pyproject.toml
openhands-workspace/pyproject.toml
openhands-agent-server/pyproject.toml
Run this from inside the repo.
/root/.asdf/installs/python/3.12.7/wooden-umbrella-84098
11/18/2025, 8:32 PMchilly-france-44439
11/18/2025, 8:35 PMDockerWorkspace probably shouldn't be trying to do buildswe really need this for fast debugging iterations - but i think the issue you run into is a bug that we should fix. If you are not building image, we should not run into this error. @nutritious-balloon-65098 please create an issue in OpenHands/software-agent-sdk. We should NOT try to fetch
_default_sdk_project_root() when we didn't explicitly run buildnutritious-balloon-65098
11/18/2025, 8:35 PMwooden-umbrella-84098
11/18/2025, 8:36 PMwooden-umbrella-84098
11/18/2025, 8:36 PMchilly-france-44439
11/18/2025, 8:38 PMDockerWorkspace ; it is the only workspace that allow you pass in either base_image OR server_image (pre-build images)wooden-umbrella-84098
11/18/2025, 8:39 PMwooden-umbrella-84098
11/18/2025, 8:41 PMbase_image? Or can we do the build elsewhere and just pass server_image?chilly-france-44439
11/18/2025, 8:47 PMwooden-umbrella-84098
11/18/2025, 8:50 PMwooden-umbrella-84098
11/18/2025, 8:51 PMchilly-france-44439
11/18/2025, 8:55 PMmaybe we could at least create a separate BaseImageDockerWorkspace for better separation?This should be possible!
chilly-france-44439
11/18/2025, 8:55 PMwooden-umbrella-84098
11/18/2025, 8:55 PMnutritious-balloon-65098
11/18/2025, 10:13 PMopenhands/agent_server/docker/build.py
3. Creating a well-informed GitHub issue
Summary of the Issue to be Reported
Based on your description, the issue is:
Problem: DockerWorkspace is calling _default_sdk_project_root() at import time (in openhands/agent_server/docker/build.py line 310), even when not explicitly building images. This causes a RuntimeError when the code is used outside of the OpenHands UV workspace environment.
Expected Behavior: The _default_sdk_project_root() function should only be called when actually building images, not during module import.
Additional Context:
⢠The error occurs when importing DockerWorkspace in user code
⢠openhands-agent-server should potentially be added to pyproject.toml dependencies
⢠DockerWorkspace should assume images are already built rather than attempting to build them
Recommendation
Since I couldn't access the repository due to network issues, I recommend you manually create the issue at https://github.com/OpenHands/software-agent-sdk/issues/new with the details above, including the full stack trace you provided in the conversation.
<sub>View full conversation</sub>nutritious-balloon-65098
11/18/2025, 10:17 PMDockerWorkspace cannot be imported in user code outside the OpenHands UV workspace because _default_sdk_project_root() is called at module import time, even when no image building is intended.
2. Root Cause: In openhands-agent-server/openhands/agent_server/docker/build.py, lines 310-311 initialize module-level variables (_DEFAULT_GIT_REF, _DEFAULT_GIT_SHA, _DEFAULT_PACKAGE_VERSION) at import time, which triggers calls to _default_sdk_project_root().
3. Expected Behavior: These functions should only be called when explicitly building images, not during module import.
4. Proposed Solutions:
⦠Lazy initialization of the module-level variables
⦠Conditional computation only when build operations are invoked
⦠Graceful fallback to defaults instead of raising exceptions at import time
5. Additional Issue: Noted that openhands-agent-server is missing from the dependencies in openhands-workspace/pyproject.toml despite being imported.
6. Impact: This prevents external developers from using openhands-workspace with pre-built images in their own projects.
The issue includes the full error traceback you provided, code references to the problematic lines, and comprehensive context to help the maintainers understand and fix the bug.
<sub>View full conversation</sub>calm-artist-7206
11/18/2025, 10:29 PMchilly-france-44439
11/18/2025, 10:30 PMcalm-artist-7206
11/18/2025, 10:32 PM