feat: add SANDBOX_STARTUP_GRACE_SECONDS env var for configurable startup timeout (#12741)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Xingyao Wang
2026-02-07 06:12:29 +08:00
committed by GitHub
parent 54d156122c
commit f139a9970b

View File

@@ -205,6 +205,13 @@ def config_from_env() -> AppServerConfig:
docker_sandbox_kwargs['container_url_pattern'] = os.environ[ docker_sandbox_kwargs['container_url_pattern'] = os.environ[
'SANDBOX_CONTAINER_URL_PATTERN' 'SANDBOX_CONTAINER_URL_PATTERN'
] ]
# Allow configuring sandbox startup grace period
# This is useful for slower machines or cloud environments where
# the agent-server container takes longer to initialize
if os.getenv('SANDBOX_STARTUP_GRACE_SECONDS'):
docker_sandbox_kwargs['startup_grace_seconds'] = int(
os.environ['SANDBOX_STARTUP_GRACE_SECONDS']
)
# Parse SANDBOX_VOLUMES and convert to VolumeMount objects # Parse SANDBOX_VOLUMES and convert to VolumeMount objects
# This is set by the CLI's --mount-cwd flag # This is set by the CLI's --mount-cwd flag
sandbox_volumes = os.getenv('SANDBOX_VOLUMES') sandbox_volumes = os.getenv('SANDBOX_VOLUMES')