Skip to content

Commit cbe32a1

Browse files
Fix bash timeout issue caused by interactive git clone prompts (OpenHands#9148)
Co-authored-by: openhands <[email protected]>
1 parent 432d882 commit cbe32a1

File tree

8 files changed

+46
-5
lines changed

8 files changed

+46
-5
lines changed

openhands/runtime/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,9 @@ def get_microagents_from_org_or_user(
706706
# Get authenticated URL and do a shallow clone (--depth 1) for efficiency
707707
remote_url = self._get_authenticated_git_url(org_openhands_repo)
708708

709-
clone_cmd = f'git clone --depth 1 {remote_url} {org_repo_dir}'
709+
clone_cmd = (
710+
f'GIT_TERMINAL_PROMPT=0 git clone --depth 1 {remote_url} {org_repo_dir}'
711+
)
710712

711713
action = CmdRunAction(command=clone_cmd)
712714
obs = self.run_action(action)

openhands/runtime/impl/daytona/daytona_runtime.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from openhands.core.config.openhands_config import OpenHandsConfig
1515
from openhands.events.stream import EventStream
16+
from openhands.integrations.provider import PROVIDER_TOKEN_TYPE
1617
from openhands.runtime.impl.action_execution.action_execution_client import (
1718
ActionExecutionClient,
1819
)
@@ -42,6 +43,8 @@ def __init__(
4243
status_callback: Callable | None = None,
4344
attach_to_existing: bool = False,
4445
headless_mode: bool = True,
46+
user_id: str | None = None,
47+
git_provider_tokens: PROVIDER_TOKEN_TYPE | None = None,
4548
):
4649
assert config.daytona_api_key, 'Daytona API key is required'
4750

@@ -74,6 +77,8 @@ def __init__(
7477
status_callback,
7578
attach_to_existing,
7679
headless_mode,
80+
user_id,
81+
git_provider_tokens,
7782
)
7883

7984
def _get_workspace(self) -> Workspace | None:

openhands/runtime/impl/docker/docker_runtime.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from openhands.core.logger import DEBUG, DEBUG_RUNTIME
1818
from openhands.core.logger import openhands_logger as logger
1919
from openhands.events import EventStream
20+
from openhands.integrations.provider import PROVIDER_TOKEN_TYPE
2021
from openhands.runtime.builder import DockerRuntimeBuilder
2122
from openhands.runtime.impl.action_execution.action_execution_client import (
2223
ActionExecutionClient,
@@ -86,6 +87,8 @@ def __init__(
8687
status_callback: Callable | None = None,
8788
attach_to_existing: bool = False,
8889
headless_mode: bool = True,
90+
user_id: str | None = None,
91+
git_provider_tokens: PROVIDER_TOKEN_TYPE | None = None,
8992
main_module: str = DEFAULT_MAIN_MODULE,
9093
):
9194
if not DockerRuntime._shutdown_listener_id:
@@ -132,6 +135,8 @@ def __init__(
132135
status_callback,
133136
attach_to_existing,
134137
headless_mode,
138+
user_id,
139+
git_provider_tokens,
135140
)
136141

137142
# Log runtime_extra_deps after base class initialization so self.sid is available

openhands/runtime/impl/e2b/e2b_runtime.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,42 @@
1212
Observation,
1313
)
1414
from openhands.events.stream import EventStream
15-
from openhands.runtime.base import Runtime
15+
from openhands.integrations.provider import PROVIDER_TOKEN_TYPE
16+
from openhands.runtime.impl.action_execution.action_execution_client import (
17+
ActionExecutionClient,
18+
)
1619
from openhands.runtime.impl.e2b.filestore import E2BFileStore
1720
from openhands.runtime.impl.e2b.sandbox import E2BSandbox
1821
from openhands.runtime.plugins import PluginRequirement
1922
from openhands.runtime.utils.files import insert_lines, read_lines
2023

2124

22-
class E2BRuntime(Runtime):
25+
class E2BRuntime(ActionExecutionClient):
2326
def __init__(
2427
self,
2528
config: OpenHandsConfig,
2629
event_stream: EventStream,
2730
sid: str = 'default',
2831
plugins: list[PluginRequirement] | None = None,
29-
sandbox: E2BSandbox | None = None,
32+
env_vars: dict[str, str] | None = None,
3033
status_callback: Callable | None = None,
34+
attach_to_existing: bool = False,
35+
headless_mode: bool = True,
36+
user_id: str | None = None,
37+
git_provider_tokens: PROVIDER_TOKEN_TYPE | None = None,
38+
sandbox: E2BSandbox | None = None,
3139
):
3240
super().__init__(
3341
config,
3442
event_stream,
3543
sid,
3644
plugins,
37-
status_callback=status_callback,
45+
env_vars,
46+
status_callback,
47+
attach_to_existing,
48+
headless_mode,
49+
user_id,
50+
git_provider_tokens,
3851
)
3952
if sandbox is None:
4053
self.sandbox = E2BSandbox()

openhands/runtime/impl/local/local_runtime.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
Observation,
2626
)
2727
from openhands.events.serialization import event_to_dict, observation_from_dict
28+
from openhands.integrations.provider import PROVIDER_TOKEN_TYPE
2829
from openhands.runtime.impl.action_execution.action_execution_client import (
2930
ActionExecutionClient,
3031
)
@@ -145,6 +146,8 @@ def __init__(
145146
status_callback: Callable[[str, str, str], None] | None = None,
146147
attach_to_existing: bool = False,
147148
headless_mode: bool = True,
149+
user_id: str | None = None,
150+
git_provider_tokens: PROVIDER_TOKEN_TYPE | None = None,
148151
) -> None:
149152
self.is_windows = sys.platform == 'win32'
150153
if self.is_windows:
@@ -194,6 +197,8 @@ def __init__(
194197
status_callback,
195198
attach_to_existing,
196199
headless_mode,
200+
user_id,
201+
git_provider_tokens,
197202
)
198203

199204
# If there is an API key in the environment we use this in requests to the runtime

openhands/runtime/impl/modal/modal_runtime.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from openhands.core.config import OpenHandsConfig
1111
from openhands.events import EventStream
12+
from openhands.integrations.provider import PROVIDER_TOKEN_TYPE
1213
from openhands.runtime.impl.action_execution.action_execution_client import (
1314
ActionExecutionClient,
1415
)
@@ -53,6 +54,8 @@ def __init__(
5354
status_callback: Callable | None = None,
5455
attach_to_existing: bool = False,
5556
headless_mode: bool = True,
57+
user_id: str | None = None,
58+
git_provider_tokens: PROVIDER_TOKEN_TYPE | None = None,
5659
):
5760
assert config.modal_api_token_id, 'Modal API token id is required'
5861
assert config.modal_api_token_secret, 'Modal API token secret is required'
@@ -100,6 +103,8 @@ def __init__(
100103
status_callback,
101104
attach_to_existing,
102105
headless_mode,
106+
user_id,
107+
git_provider_tokens,
103108
)
104109

105110
async def connect(self):

openhands/runtime/impl/runloop/runloop_runtime.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from openhands.core.config import OpenHandsConfig
1010
from openhands.core.logger import openhands_logger as logger
1111
from openhands.events import EventStream
12+
from openhands.integrations.provider import PROVIDER_TOKEN_TYPE
1213
from openhands.runtime.impl.action_execution.action_execution_client import (
1314
ActionExecutionClient,
1415
)
@@ -36,6 +37,8 @@ def __init__(
3637
status_callback: Callable | None = None,
3738
attach_to_existing: bool = False,
3839
headless_mode: bool = True,
40+
user_id: str | None = None,
41+
git_provider_tokens: PROVIDER_TOKEN_TYPE | None = None,
3942
):
4043
assert config.runloop_api_key is not None, 'Runloop API key is required'
4144
self.devbox: DevboxView | None = None
@@ -53,6 +56,8 @@ def __init__(
5356
status_callback,
5457
attach_to_existing,
5558
headless_mode,
59+
user_id,
60+
git_provider_tokens,
5661
)
5762
# Buffer for container logs
5863
self._vscode_url: str | None = None

openhands/server/session/agent_session.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ async def _create_runtime(
366366
headless_mode=False,
367367
attach_to_existing=False,
368368
env_vars=env_vars,
369+
git_provider_tokens=git_provider_tokens,
369370
)
370371

371372
# FIXME: this sleep is a terrible hack.

0 commit comments

Comments
 (0)