Enable runtime image build for resolver's experimental feature (#5972)

This commit is contained in:
Ryan H. Tran
2025-01-13 05:21:34 +07:00
committed by GitHub
parent 873dddb4e8
commit 23f40a1c01
2 changed files with 15 additions and 11 deletions

View File

@@ -184,6 +184,7 @@ jobs:
}); });
- name: Install OpenHands - name: Install OpenHands
id: install_openhands
uses: actions/github-script@v7 uses: actions/github-script@v7
env: env:
COMMENT_BODY: ${{ github.event.comment.body || '' }} COMMENT_BODY: ${{ github.event.comment.body || '' }}
@@ -196,7 +197,6 @@ jobs:
const reviewBody = process.env.REVIEW_BODY.trim(); const reviewBody = process.env.REVIEW_BODY.trim();
const labelName = process.env.LABEL_NAME.trim(); const labelName = process.env.LABEL_NAME.trim();
const eventName = process.env.EVENT_NAME.trim(); const eventName = process.env.EVENT_NAME.trim();
// Check conditions // Check conditions
const isExperimentalLabel = labelName === "fix-me-experimental"; const isExperimentalLabel = labelName === "fix-me-experimental";
const isIssueCommentExperimental = const isIssueCommentExperimental =
@@ -205,6 +205,9 @@ jobs:
const isReviewCommentExperimental = const isReviewCommentExperimental =
eventName === "pull_request_review" && reviewBody.includes("@openhands-agent-exp"); eventName === "pull_request_review" && reviewBody.includes("@openhands-agent-exp");
// Set output variable
core.setOutput('isExperimental', isExperimentalLabel || isIssueCommentExperimental || isReviewCommentExperimental);
// Perform package installation // Perform package installation
if (isExperimentalLabel || isIssueCommentExperimental || isReviewCommentExperimental) { if (isExperimentalLabel || isIssueCommentExperimental || isReviewCommentExperimental) {
console.log("Installing experimental OpenHands..."); console.log("Installing experimental OpenHands...");
@@ -230,7 +233,8 @@ jobs:
--issue-number ${{ env.ISSUE_NUMBER }} \ --issue-number ${{ env.ISSUE_NUMBER }} \
--issue-type ${{ env.ISSUE_TYPE }} \ --issue-type ${{ env.ISSUE_TYPE }} \
--max-iterations ${{ env.MAX_ITERATIONS }} \ --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 - name: Check resolution result
id: check_result id: check_result

View File

@@ -14,12 +14,7 @@ from termcolor import colored
import openhands import openhands
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import AgentConfig, AppConfig, LLMConfig, SandboxConfig
AgentConfig,
AppConfig,
LLMConfig,
SandboxConfig,
)
from openhands.core.logger import openhands_logger as logger from openhands.core.logger import openhands_logger as logger
from openhands.core.main import create_runtime, run_controller from openhands.core.main import create_runtime, run_controller
from openhands.events.action import CmdRunAction, MessageAction from openhands.events.action import CmdRunAction, MessageAction
@@ -153,7 +148,7 @@ async def process_issue(
max_iterations: int, max_iterations: int,
llm_config: LLMConfig, llm_config: LLMConfig,
output_dir: str, output_dir: str,
runtime_container_image: str, runtime_container_image: str | None,
prompt_template: str, prompt_template: str,
issue_handler: IssueHandlerInterface, issue_handler: IssueHandlerInterface,
repo_instruction: str | None = None, repo_instruction: str | None = None,
@@ -306,7 +301,7 @@ async def resolve_issue(
max_iterations: int, max_iterations: int,
output_dir: str, output_dir: str,
llm_config: LLMConfig, llm_config: LLMConfig,
runtime_container_image: str, runtime_container_image: str | None,
prompt_template: str, prompt_template: str,
issue_type: str, issue_type: str,
repo_instruction: str | None, repo_instruction: str | None,
@@ -583,11 +578,16 @@ def main():
default=None, default=None,
help="Target branch to pull and create PR against (for PRs). If not specified, uses the PR's base branch.", 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() my_args = parser.parse_args()
runtime_container_image = my_args.runtime_container_image 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 = ( runtime_container_image = (
f'ghcr.io/all-hands-ai/runtime:{openhands.__version__}-nikolaik' f'ghcr.io/all-hands-ai/runtime:{openhands.__version__}-nikolaik'
) )