Skip to content

Commit

Permalink
Add github_user_id
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj committed Feb 11, 2025
1 parent 60bd44c commit 39dfed7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion openhands/runtime/impl/docker/docker_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(
status_callback: Callable | None = None,
attach_to_existing: bool = False,
headless_mode: bool = True,
github_user_id: str | None = None,
):
if not DockerRuntime._shutdown_listener_id:
DockerRuntime._shutdown_listener_id = add_shutdown_listener(
Expand All @@ -89,7 +90,8 @@ def __init__(
else:
self.instance_id = sid
self._container_port = find_available_tcp_port()
self.container_name = CONTAINER_NAME_PREFIX + self.instance_id
self.github_user_id = github_user_id or 'default'
self.container_name = CONTAINER_NAME_PREFIX + self.github_user_id + '-' + self.instance_id
self.docker_client: docker.DockerClient = self._init_docker_client()
if not attach_to_existing:
try:
Expand Down Expand Up @@ -123,6 +125,7 @@ def __init__(
status_callback,
attach_to_existing,
headless_mode,
github_user_id,
)

# Log runtime_extra_deps after base class initialization so self.sid is available
Expand Down
3 changes: 2 additions & 1 deletion openhands/server/session/agent_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from openhands.runtime import get_runtime_cls
from openhands.runtime.base import Runtime
from openhands.runtime.impl.remote.remote_runtime import RemoteRuntime
from openhands.runtime.impl.docker.docker_runtime import DockerRuntime
from openhands.security import SecurityAnalyzer, options
from openhands.storage.files import FileStore
from openhands.utils.async_utils import call_sync_from_async
Expand Down Expand Up @@ -208,7 +209,7 @@ async def _create_runtime(
)

kwargs = {}
if runtime_cls == RemoteRuntime:
if runtime_cls in [RemoteRuntime, DockerRuntime]:
kwargs['github_user_id'] = self.github_user_id

self.runtime = runtime_cls(
Expand Down

0 comments on commit 39dfed7

Please sign in to comment.