feat: add argument --base-container-image to resolver (#7612)

Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
This commit is contained in:
Tetsuuuuuuu
2025-04-21 23:01:03 +09:00
committed by GitHub
parent a792f84a83
commit 50426edaa1
8 changed files with 67 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ from typing import Any, Awaitable, TextIO
from pydantic import SecretStr
from tqdm import tqdm
import openhands
from openhands.core.config import LLMConfig
from openhands.core.logger import openhands_logger as logger
from openhands.integrations.service_types import ProviderType
@@ -59,6 +60,7 @@ async def resolve_issues(
num_workers: int,
output_dir: str,
llm_config: LLMConfig,
base_container_image: str | None,
runtime_container_image: str,
prompt_template: str,
issue_type: str,
@@ -199,6 +201,7 @@ async def resolve_issues(
max_iterations,
llm_config,
output_dir,
base_container_image,
runtime_container_image,
prompt_template,
issue_handler,
@@ -249,6 +252,12 @@ def main() -> None:
default=None,
help='Github or Gitlab username to access the repository.',
)
parser.add_argument(
'--base-container-image',
type=str,
default=None,
help='Base container image to use.',
)
parser.add_argument(
'--runtime-container-image',
type=str,
@@ -331,9 +340,21 @@ def main() -> None:
my_args = parser.parse_args()
base_container_image = my_args.base_container_image
runtime_container_image = my_args.runtime_container_image
if runtime_container_image is None:
runtime_container_image = 'ghcr.io/all-hands-ai/runtime:0.33.0-nikolaik'
if runtime_container_image is not None and base_container_image is not None:
raise ValueError('Cannot provide both runtime and base container images.')
if (
runtime_container_image is None
and base_container_image is None
and not my_args.is_experimental
):
runtime_container_image = (
f'ghcr.io/all-hands-ai/runtime:{openhands.__version__}-nikolaik'
)
owner, repo = my_args.selected_repo.split('/')
token = my_args.token or os.getenv('GITHUB_TOKEN') or os.getenv('GITLAB_TOKEN')
@@ -386,6 +407,7 @@ def main() -> None:
token=token,
username=username,
platform=platform,
base_container_image=base_container_image,
runtime_container_image=runtime_container_image,
max_iterations=my_args.max_iterations,
limit_issues=my_args.limit_issues,

View File

@@ -167,6 +167,7 @@ async def process_issue(
max_iterations: int,
llm_config: LLMConfig,
output_dir: str,
base_container_image: str | None,
runtime_container_image: str | None,
prompt_template: str,
issue_handler: ServiceContextIssue | ServiceContextPR,
@@ -195,6 +196,7 @@ async def process_issue(
# they're set by default if nothing else overrides them
# FIXME we should remove them here
sandbox_config = SandboxConfig(
base_container_image=base_container_image,
runtime_container_image=runtime_container_image,
enable_auto_lint=False,
use_host_network=False,
@@ -360,6 +362,7 @@ async def resolve_issue(
max_iterations: int,
output_dir: str,
llm_config: LLMConfig,
base_container_image: str | None,
runtime_container_image: str | None,
prompt_template: str,
issue_type: str,
@@ -525,6 +528,7 @@ async def resolve_issue(
max_iterations,
llm_config,
output_dir,
base_container_image,
runtime_container_image,
prompt_template,
issue_handler,
@@ -567,6 +571,12 @@ def main() -> None:
default=None,
help='username to access the repository.',
)
parser.add_argument(
'--base-container-image',
type=str,
default=None,
help='base container image to use.',
)
parser.add_argument(
'--runtime-container-image',
type=str,
@@ -649,8 +659,18 @@ def main() -> None:
my_args = parser.parse_args()
base_container_image = my_args.base_container_image
runtime_container_image = my_args.runtime_container_image
if runtime_container_image is None and not my_args.is_experimental:
if runtime_container_image is not None and base_container_image is not None:
raise ValueError('Cannot provide both runtime and base container images.')
if (
runtime_container_image is None
and base_container_image is None
and not my_args.is_experimental
):
runtime_container_image = (
f'ghcr.io/all-hands-ai/runtime:{openhands.__version__}-nikolaik'
)
@@ -714,6 +734,7 @@ def main() -> None:
token=token,
username=username,
platform=platform,
base_container_image=base_container_image,
runtime_container_image=runtime_container_image,
max_iterations=my_args.max_iterations,
output_dir=my_args.output_dir,