From 23f40a1c01ed81d4685ea054b609558f7843f26e Mon Sep 17 00:00:00 2001 From: "Ryan H. Tran" Date: Mon, 13 Jan 2025 05:21:34 +0700 Subject: [PATCH] Enable runtime image build for resolver's experimental feature (#5972) --- .github/workflows/openhands-resolver.yml | 8 ++++++-- openhands/resolver/resolve_issue.py | 18 +++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/openhands-resolver.yml b/.github/workflows/openhands-resolver.yml index 028316ee05..a9d90c38b1 100644 --- a/.github/workflows/openhands-resolver.yml +++ b/.github/workflows/openhands-resolver.yml @@ -184,6 +184,7 @@ jobs: }); - name: Install OpenHands + id: install_openhands uses: actions/github-script@v7 env: COMMENT_BODY: ${{ github.event.comment.body || '' }} @@ -196,7 +197,6 @@ jobs: const reviewBody = process.env.REVIEW_BODY.trim(); const labelName = process.env.LABEL_NAME.trim(); const eventName = process.env.EVENT_NAME.trim(); - // Check conditions const isExperimentalLabel = labelName === "fix-me-experimental"; const isIssueCommentExperimental = @@ -205,6 +205,9 @@ jobs: const isReviewCommentExperimental = eventName === "pull_request_review" && reviewBody.includes("@openhands-agent-exp"); + // Set output variable + core.setOutput('isExperimental', isExperimentalLabel || isIssueCommentExperimental || isReviewCommentExperimental); + // Perform package installation if (isExperimentalLabel || isIssueCommentExperimental || isReviewCommentExperimental) { console.log("Installing experimental OpenHands..."); @@ -230,7 +233,8 @@ jobs: --issue-number ${{ env.ISSUE_NUMBER }} \ --issue-type ${{ env.ISSUE_TYPE }} \ --max-iterations ${{ env.MAX_ITERATIONS }} \ - --comment-id ${{ env.COMMENT_ID }} + --comment-id ${{ env.COMMENT_ID }} \ + --is-experimental ${{ steps.install_openhands.outputs.isExperimental }} - name: Check resolution result id: check_result diff --git a/openhands/resolver/resolve_issue.py b/openhands/resolver/resolve_issue.py index 21036dbc29..f50b37d794 100644 --- a/openhands/resolver/resolve_issue.py +++ b/openhands/resolver/resolve_issue.py @@ -14,12 +14,7 @@ from termcolor import colored import openhands from openhands.controller.state.state import State -from openhands.core.config import ( - AgentConfig, - AppConfig, - LLMConfig, - SandboxConfig, -) +from openhands.core.config import AgentConfig, AppConfig, LLMConfig, SandboxConfig from openhands.core.logger import openhands_logger as logger from openhands.core.main import create_runtime, run_controller from openhands.events.action import CmdRunAction, MessageAction @@ -153,7 +148,7 @@ async def process_issue( max_iterations: int, llm_config: LLMConfig, output_dir: str, - runtime_container_image: str, + runtime_container_image: str | None, prompt_template: str, issue_handler: IssueHandlerInterface, repo_instruction: str | None = None, @@ -306,7 +301,7 @@ async def resolve_issue( max_iterations: int, output_dir: str, llm_config: LLMConfig, - runtime_container_image: str, + runtime_container_image: str | None, prompt_template: str, issue_type: str, repo_instruction: str | None, @@ -583,11 +578,16 @@ def main(): default=None, help="Target branch to pull and create PR against (for PRs). If not specified, uses the PR's base branch.", ) + parser.add_argument( + '--is-experimental', + type=lambda x: x.lower() == 'true', + help='Whether to run in experimental mode.', + ) my_args = parser.parse_args() runtime_container_image = my_args.runtime_container_image - if runtime_container_image is None: + if runtime_container_image is None and not my_args.is_experimental: runtime_container_image = ( f'ghcr.io/all-hands-ai/runtime:{openhands.__version__}-nikolaik' )