diff --git a/openhands/runtime/utils/runtime_build.py b/openhands/runtime/utils/runtime_build.py index 65702d15df..ada1a148af 100644 --- a/openhands/runtime/utils/runtime_build.py +++ b/openhands/runtime/utils/runtime_build.py @@ -280,6 +280,11 @@ def prep_build_folder( ), ) + # Copy the 'microagents' directory (Microagents) + shutil.copytree( + Path(project_root, 'microagents'), Path(build_folder, 'code', 'microagents') + ) + # Copy pyproject.toml and poetry.lock files for file in ['pyproject.toml', 'poetry.lock']: src = Path(openhands_source_dir, file) diff --git a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 b/openhands/runtime/utils/runtime_templates/Dockerfile.j2 index de98f77733..2a4c7efa9f 100644 --- a/openhands/runtime/utils/runtime_templates/Dockerfile.j2 +++ b/openhands/runtime/utils/runtime_templates/Dockerfile.j2 @@ -239,7 +239,8 @@ COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/ # ================================================================ RUN if [ -d /openhands/code/openhands ]; then rm -rf /openhands/code/openhands; fi COPY ./code/pyproject.toml ./code/poetry.lock /openhands/code/ - +RUN if [ -d /openhands/code/microagents ]; then rm -rf /openhands/code/microagents; fi +COPY ./code/microagents /openhands/code/microagents COPY ./code/openhands /openhands/code/openhands RUN chmod a+rwx /openhands/code/openhands/__init__.py diff --git a/tests/unit/test_runtime_build.py b/tests/unit/test_runtime_build.py index 2ee8d17e52..46d50f6ef7 100644 --- a/tests/unit/test_runtime_build.py +++ b/tests/unit/test_runtime_build.py @@ -89,8 +89,8 @@ def test_prep_build_folder(temp_dir): extra_deps=None, ) - # make sure that the code was copied - shutil_mock.copytree.assert_called_once() + # make sure that the code (openhands/) and microagents folder were copied + assert shutil_mock.copytree.call_count == 2 assert shutil_mock.copy2.call_count == 2 # Now check dockerfile is in the folder