diff --git a/rock/sdk/sandbox/agent/iflow_cli.py b/rock/sdk/sandbox/agent/iflow_cli.py index 2f7063ac3..cc5248325 100644 --- a/rock/sdk/sandbox/agent/iflow_cli.py +++ b/rock/sdk/sandbox/agent/iflow_cli.py @@ -161,6 +161,17 @@ async def _install_npm(self): error_msg="npm installation failed", ) + await self._sandbox.arun( + cmd=( + "mv runtime-env /opt/nodejs && " + "ln -sf /opt/nodejs/bin/npm /usr/local/bin/npm && " + "ln -sf /opt/nodejs/bin/npx /usr/local/bin/npx && " + "ln -sf /opt/nodejs/bin/corepack /usr/local/bin/corepack && " + "ln -sf /opt/nodejs/bin/node /usr/local/bin/node" + ), + session=self.agent_session, + ) + elapsed_step = time.time() - step_start self._log_step("NPM installation finished", step_name="NPM Install", is_complete=True, elapsed=elapsed_step) @@ -202,6 +213,11 @@ async def _install_iflow_cli_package(self): error_msg="iflow-cli installation failed", ) + await self._sandbox.arun( + cmd="ln -s /opt/nodejs/bin/iflow /usr/local/bin/iflow", + session=self.agent_session, + ) + elapsed_step = time.time() - step_start self._log_step( "IFlow CLI installation finished", step_name="IFlow Install", is_complete=True, elapsed=elapsed_step diff --git a/rock/sdk/sandbox/agent/openhands.py b/rock/sdk/sandbox/agent/openhands.py index e3e86565a..a4f2feb91 100644 --- a/rock/sdk/sandbox/agent/openhands.py +++ b/rock/sdk/sandbox/agent/openhands.py @@ -163,13 +163,13 @@ class OpenhandsConfig(DefaultAgentConfig): # Command to clone Openhands/benchmarks repository and install dependencies openhands_sdk_install_cmd_list: list[str] = [ - f"/openhands/python/bin/pip config set global.index-url {env_vars.ROCK_PIP_INDEX_URL}", - "/openhands/python/bin/pip install openhands-agent-server==1.6.0 openhands-sdk==1.6.0", - "/openhands/python/bin/pip install openhands-tools==1.6.0 openhands-workspace==1.6.0", + f"/openhands/runtime-env/bin/pip config set global.index-url {env_vars.ROCK_PIP_INDEX_URL}", + "/openhands/runtime-env/bin/pip install openhands-agent-server==1.6.0 openhands-sdk==1.6.0", + "/openhands/runtime-env/bin/pip install openhands-tools==1.6.0 openhands-workspace==1.6.0", "rm -rf /openhands/benchmarks", "git clone -b features/local_workspace_fix_early_stop https://github.com/shayue-wt/benchmarks.git /openhands/benchmarks", - "/openhands/python/bin/pip install datasets huggingface-hub jinja2 pandas Pillow toml swebench", - "/openhands/python/bin/pip install tqdm 'unidiff>=0.7.5,<0.8.0' 'modal>=1.1.4' commit0 pytest-json-report", + "/openhands/runtime-env/bin/pip install datasets huggingface-hub jinja2 pandas Pillow toml swebench", + "/openhands/runtime-env/bin/pip install tqdm 'unidiff>=0.7.5,<0.8.0' 'modal>=1.1.4' commit0 pytest-json-report", ] python_install_timeout: int = 300 @@ -417,7 +417,7 @@ async def run( agent_run_cmd = ( f"cd {self.config.agent_workdir}/benchmarks && " "export PYTHONPATH='.' && " - f"{self.config.agent_workdir}/python/bin/python " + f"{self.config.agent_workdir}/runtime-env/bin/python " "./benchmarks/swebench/run_infer.py " ".llm_config.json --dataset eval --split test --note rock_rollout " f"--select ./{instance_config} --max-iterations {self.config.max_iteration}" diff --git a/rock/sdk/sandbox/agent/swe_agent.py b/rock/sdk/sandbox/agent/swe_agent.py index 3f9e0190e..a8edcf4a8 100644 --- a/rock/sdk/sandbox/agent/swe_agent.py +++ b/rock/sdk/sandbox/agent/swe_agent.py @@ -152,7 +152,7 @@ class SweAgentConfig(DefaultAgentConfig): swe_agent_workdir: str = "/tmp_sweagent" - python_install_cmd: str = env_vars.ROCK_RTENV_PYTHON_V31114_INSTALL_CMD + python_install_cmd: str = env_vars.ROCK_RTENV_PYTHON_V31212_INSTALL_CMD swe_agent_install_cmd: str = ( "[ -d SWE-agent ] && rm -rf SWE-agent; " @@ -273,7 +273,7 @@ async def _install_swe_agent_package(self): self._log_step("Installing SWE-agent repository", step_name="SWE-agent Install") swe_agent_install_cmd = ( - f"export PATH={self.config.swe_agent_workdir}/python/bin:$PATH && " + f"export PATH={self.config.swe_agent_workdir}/runtime-env/bin:$PATH && " f"cd {self.config.swe_agent_workdir} && " f"{self.config.swe_agent_install_cmd}" ) @@ -428,7 +428,7 @@ async def run( swe_agent_run_cmd = ( f"cd {self.config.swe_agent_workdir} && " - f"{self.config.swe_agent_workdir}/python/bin/sweagent run --config {config_filename}" + f"{self.config.swe_agent_workdir}/runtime-env/bin/sweagent run --config {config_filename}" ) full_cmd = f"bash -c {shlex.quote(swe_agent_run_cmd)}" logger.debug( diff --git a/rock/sdk/sandbox/model_service/base.py b/rock/sdk/sandbox/model_service/base.py index 1e96a3ec1..ebcc0ad4f 100644 --- a/rock/sdk/sandbox/model_service/base.py +++ b/rock/sdk/sandbox/model_service/base.py @@ -162,7 +162,7 @@ async def install(self) -> None: # Step 4: Install model service step_start_time = time.time() model_service_install_cmd = ( - f"export PATH={self.config.workdir}/python/bin:$PATH && " + f"export PATH={self.config.workdir}/runtime-env/bin:$PATH && " f"cd {self.config.workdir} && {self.config.model_service_install_cmd}" ) bash_service_cmd = f"bash -c {shlex.quote(model_service_install_cmd)}" @@ -219,8 +219,8 @@ async def start(self) -> None: start_cmd = ( f"export ROCK_LOGGING_PATH={self.config.logging_path} && " f"export ROCK_LOGGING_FILE_NAME={self.config.logging_file_name} && " - f"{self.config.workdir}/python/bin/{self.config.stop_cmd} && " - f"{self.config.workdir}/python/bin/{self.config.start_cmd.format(model_service_type=self.config.model_service_type)}" + f"{self.config.workdir}/runtime-env/bin/{self.config.stop_cmd} && " + f"{self.config.workdir}/runtime-env/bin/{self.config.start_cmd.format(model_service_type=self.config.model_service_type)}" ) bash_start_cmd = f"bash -c {shlex.quote(start_cmd)}" logger.debug(f"[{sandbox_id}] Model service Start command: {bash_start_cmd}") @@ -262,7 +262,7 @@ async def stop(self) -> None: try: logger.info(f"[{sandbox_id}] Stopping model service") - stop_cmd = f"{self.config.workdir}/python/bin/{self.config.stop_cmd}" + stop_cmd = f"{self.config.workdir}/runtime-env/bin/{self.config.stop_cmd}" bash_stop_cmd = f"bash -c {shlex.quote(stop_cmd)}" await self._sandbox.arun( @@ -301,7 +301,7 @@ async def watch_agent(self, pid: str) -> None: raise RuntimeError(error_msg) try: - watch_agent_cmd = f"{self.config.workdir}/python/bin/{self.config.watch_agent_cmd.format(pid=pid)}" + watch_agent_cmd = f"{self.config.workdir}/runtime-env/bin/{self.config.watch_agent_cmd.format(pid=pid)}" bash_watch_cmd = f"bash -c {shlex.quote(watch_agent_cmd)}" logger.debug(f"[{sandbox_id}] Model service watch agent with pid={pid}, cmd: {bash_watch_cmd}") @@ -369,7 +369,7 @@ async def anti_call_llm( else: cmd = self.config.anti_call_llm_cmd_no_response.format(index=index) - full_cmd = f"{self.config.workdir}/python/bin/{cmd}" + full_cmd = f"{self.config.workdir}/runtime-env/bin/{cmd}" bash_cmd = f"bash -c {shlex.quote(full_cmd)}" logger.debug(f"[{sandbox_id}] Executing command: {bash_cmd}") diff --git a/tests/integration/sdk/sandbox/agent/swe_agent/test_init.py b/tests/integration/sdk/sandbox/agent/swe_agent/test_init.py index 6a12d2cf3..a32519791 100644 --- a/tests/integration/sdk/sandbox/agent/swe_agent/test_init.py +++ b/tests/integration/sdk/sandbox/agent/swe_agent/test_init.py @@ -29,7 +29,6 @@ async def _verify_exists(sandbox: Sandbox, directory_path: str, items: set[str]) logger.info(f"Directory {directory_path} contents: {result.stdout}") -@pytest.mark.skip @pytest.mark.need_admin @SKIP_IF_NO_DOCKER @pytest.mark.asyncio @@ -52,14 +51,13 @@ async def test_swe_agent_initialization(sandbox_instance: Sandbox): await _verify_exists(sandbox_instance, "/", {agent_dir_name}) # 4. Verify agent installation directories - await _verify_exists(sandbox_instance, swe_agent_config.swe_agent_workdir, {"python", "SWE-agent"}) + await _verify_exists(sandbox_instance, swe_agent_config.swe_agent_workdir, {"runtime-env", "SWE-agent"}) # 5. Verify Python executables - python_bin_path = f"{swe_agent_config.swe_agent_workdir}/python/bin" + python_bin_path = f"{swe_agent_config.swe_agent_workdir}/runtime-env/bin" await _verify_exists(sandbox_instance, python_bin_path, {"sweagent"}) -@pytest.mark.skip @pytest.mark.need_admin @SKIP_IF_NO_DOCKER @pytest.mark.asyncio @@ -87,8 +85,8 @@ async def test_swe_agent_with_model_service(sandbox_instance: Sandbox): await _verify_exists(sandbox_instance, "/", {agent_dir_name, model_service_dir_name}) # 4. Verify agent installation directories - await _verify_exists(sandbox_instance, swe_agent_config.swe_agent_workdir, {"python", "SWE-agent"}) + await _verify_exists(sandbox_instance, swe_agent_config.swe_agent_workdir, {"runtime-env", "SWE-agent"}) # 5. Verify Python executables - python_bin_path = f"{swe_agent_config.swe_agent_workdir}/python/bin" + python_bin_path = f"{swe_agent_config.swe_agent_workdir}/runtime-env/bin" await _verify_exists(sandbox_instance, python_bin_path, {"sweagent"}) diff --git a/tests/integration/sdk/sandbox/agent/swe_agent/test_run.py b/tests/integration/sdk/sandbox/agent/swe_agent/test_run.py index efc0a5846..e3ebb3f4c 100644 --- a/tests/integration/sdk/sandbox/agent/swe_agent/test_run.py +++ b/tests/integration/sdk/sandbox/agent/swe_agent/test_run.py @@ -106,7 +106,6 @@ async def _init_git_repository(sandbox: Sandbox, repo_path: str) -> None: raise RuntimeError(f"Failed to execute: {cmd}") -@pytest.mark.skip @pytest.mark.need_admin @SKIP_IF_NO_DOCKER @pytest.mark.asyncio diff --git a/tests/integration/sdk/sandbox/model_service/test_model_service.py b/tests/integration/sdk/sandbox/model_service/test_model_service.py index 05f61fe33..4107dc5c8 100644 --- a/tests/integration/sdk/sandbox/model_service/test_model_service.py +++ b/tests/integration/sdk/sandbox/model_service/test_model_service.py @@ -10,7 +10,6 @@ logger = init_logger(__name__) -@pytest.mark.skip @pytest.mark.need_admin @SKIP_IF_NO_DOCKER @pytest.mark.asyncio @@ -36,10 +35,10 @@ async def test_model_service_install_and_start(sandbox_instance: Sandbox): logger.info(f"Work directory contents: {result.stdout}") assert result.exit_code == 0 assert "cpython31114.tar.gz" in result.stdout, "Tar archive file missing" - assert "python" in result.stdout, "Python directory missing" + assert "runtime-env" in result.stdout, "Python directory missing" # 5. Verify Python executables - python_bin_path = f"{model_service_config.workdir}/python/bin" + python_bin_path = f"{model_service_config.workdir}/runtime-env/bin" result = await sandbox_instance.execute(Command(command="ls", cwd=python_bin_path)) logger.info(f"Python bin directory contents: {result.stdout}") assert result.exit_code == 0