Skip to content

DockerDevWorkspace inherits non-None server_image default, breaking base_image usage #2242

Closed

Description

@simonrosenberg

Bug

DockerDevWorkspace inherits server_image's default value of "ghcr.io/openhands/agent-server:latest-python" from its parent class DockerWorkspace. This means that constructing a DockerDevWorkspace with only base_image causes the _validate_images validator to fail, because both base_image and server_image are non-None.

# This fails with: "Exactly one of 'base_image' or 'server_image' must be set."
DockerDevWorkspace(base_image="python:3.13", target="source")

Root Cause

In DockerWorkspace (openhands-workspace/openhands/workspace/docker/workspace.py):

server_image: str | None = Field(
    default="ghcr.io/openhands/agent-server:latest-python",
    ...
)

DockerDevWorkspace (openhands-workspace/openhands/workspace/docker/dev_workspace.py) never overrides this default, so server_image is always non-None unless the caller explicitly passes server_image=None.

The validator then rejects the instance:

if (self.base_image is None) == (self.server_image is None):
    raise ValueError("Exactly one of 'base_image' or 'server_image' must be set.")

Impact

Every downstream consumer using DockerDevWorkspace with base_image must pass server_image=None as a workaround. For example, OpenHands/benchmarks had to apply this fix: OpenHands/benchmarks@63cb3a1

Suggested Fix

Override the server_image field default in DockerDevWorkspace:

class DockerDevWorkspace(DockerWorkspace):
    server_image: str | None = Field(
        default=None,
        description="Pre-built agent server image. Mutually exclusive with base_image.",
    )
    ...

This way callers can simply do:

DockerDevWorkspace(base_image="python:3.13", target="source")

without needing to explicitly null out server_image.

Activity

  1. added a commit that references this issue on Feb 28, 2026
    663ab6b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions