is agent-server even published to pypi?
# proj-sdk
w
is agent-server even published to pypi?
c
yes, it is
openhands-agent-server
w
OK. This feels like a weird dependency though--DockerWorkspace probably shouldn't be trying to do builds
at the very least I think openhands-agent-server should be in the pyproject.toml
seems to be causing a lot of weird errors for me
Copy code
python 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/
IMO DockerWorkspace should assume that the image its using has already been built
c
DockerWorkspace probably shouldn't be trying to do builds
we 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 build
n
I'm on it! Xingyao Wang can track my progress here.
w
I bet we can put the build logic elsewhere and keep the rapid iteration cycles
the more we put logic meant for internal development into the external-facing library, the more bugs like this will crop up
c
happy to hear your thoughts / suggestions -- the Docker logic is very much only related to
DockerWorkspace
; it is the only workspace that allow you pass in either base_image OR server_image (pre-build images)
w
what's the development loop you need?
Do we really need DockerWorkspace to take in
base_image
? Or can we do the build elsewhere and just pass
server_image
?
c
I think we've come across this multiple times -- The primary need comes from evaluation / developing new agent-server images - especially when you are integrating new benchmarks, you basically use the base images provided by the authors and start an eval run - you need to build an image on the fly to check if it works, if not, you will need to go back to edit Dockerfile (maybe install some dependency) then try again. If "base_image" is supported, the flow will just be: 1. change Dockerfile 2. re-run script 3. repeat until done šŸ‘† this is the flow we use in our V0 development If we throw away the build logic, we will need to: 1. change Dockerfile 2. manually run a build command AND you need to carefully set tags for the target docker image (based on base image name + current SDK version for reproducibility) 3. put the new image name into the script 4. re-run script 5. repeat until down
w
my main concern is that we're intermingling complicated internal/dev logic with external-facing logic, which needs to be stable and well-supported maybe we could at least create a separate BaseImageDockerWorkspace for better separation?
we could keep that private/experimental, and be more confident about the DockerWorkspace that 99% of users will need
c
maybe we could at least create a separate BaseImageDockerWorkspace for better separation?
This should be possible!
just need to wait for github to back online to have OH fix thisšŸ˜…
lolsob 1
w
sg! in general I'd try and keep internal/dev logic separated out as much as possible from the user-facing stuff šŸ™‚
n
I apologize, but I was unable to complete the task of creating an issue in the OpenHands/software-agent-sdk repository. The git clone operation appears to be hanging and not completing, which prevented me from: 1. Exploring the repository structure to understand the codebase 2. Examining the problematic code in
openhands/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>
Summary I have successfully created a GitHub issue in the OpenHands/software-agent-sdk repository documenting the bug you described. Issue created: https://github.com/OpenHands/software-agent-sdk/issues/1196 Title: "DockerWorkspace imports fail outside UV workspace: _default_sdk_project_root() called at module import time" What was documented in the issue: 1. The Problem:
DockerWorkspace
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>
c
@chilly-france-44439 This... sounds like Gemini, is it? šŸ˜…
c
haha no, it is sonnet lolsob
c
Ha! Sonnet aware of limitations and with no rockets? Must be 4.5 (new)
nod 1