Repository navigation
refactor(env): run stock MCR images, prepare the sandbox on the fly - #202
Merged
Merged
Conversation
Bala (0xba1a)
force-pushed
the
bala/env-distro-refactor
branch
2 times, most recently
from
October 22, 2026 10:32
0c4c69f to
fab2f7a
Compare
Bala (0xba1a)
force-pushed
the
bala/env-distro-refactor
branch
from
October 27, 2026 10:45
fab2f7a to
3c593f9
Compare
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (98.24%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #202 +/- ##
==========================================
+ Coverage 76.12% 76.48% +0.36%
==========================================
Files 45 46 +1
Lines 3057 3113 +56
==========================================
+ Hits 2327 2381 +54
- Misses 730 732 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Kavya Sree Kaitepalli (KavyaSree2610)
approved these changes
Oct 28, 2026
Stop building and publishing a custom shell-server image. Sandboxes now run an unmodified image from the Microsoft Container Registry (default: mcr.microsoft.com/devcontainers/python:3.11, the old image's base) and are prepared when the environment starts: - shell_server/: the distro-agnostic server (dockerShell.py, ShellCommunicator.py, moved unchanged from image_builder/) plus prepare.sh, which installs missing prerequisites with apt-get, tdnf, dnf or yum, removes accounts holding the agent's uid/gid and the devcontainer 'vscode' sudo user, creates the unprivileged `agent` account, and pip-installs fastapi/uvicorn/pydantic into a root-owned venv at /opt/microbots/venv. - LocalDockerEnvironment starts the image idle (`sleep infinity` under init), copies shell_server/ into /opt/microbots (root-owned) over the root control plane, runs prepare.sh, launches dockerShell.py as root (it still drops to `agent`), and waits until the server answers instead of sleeping. Setup failures stop the container. - images.py: DEBIAN_IMAGE / DEFAULT_IMAGE constants. - Remove the Dockerfile, the Docker Hub publish workflow and the CI image build; CI pulls the stock image instead. Preparation takes ~9s on the default image (pip install). Any image with sh, bash and python3 or a supported package manager works. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bala (0xba1a)
force-pushed
the
bala/env-distro-refactor
branch
from
October 28, 2026 08:19
3c593f9 to
731c3e5
Compare
Kavya Sree Kaitepalli (KavyaSree2610)
approved these changes
Oct 28, 2026
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop building and publishing a custom shell-server image. Sandboxes now run an unmodified image from the Microsoft Container Registry, and Microbots prepares it when the environment starts.
mcr.microsoft.com/devcontainers/python:3.11, the base of the old custom image, so bots get the same toolset as before.image. The sandbox's distribution is never configured; later PRs read it from the container's/etc/os-releasewhen they need it.This is the first PR in a stack, based on
main.How a stock image becomes a sandbox
LocalDockerEnvironment.start()now:sleep infinityunderinit, sodocker stopis prompt).local_docker/shell_server/into/opt/microbots, owned by root so the bot cannot patch its own server.shell_server/prepare.shas root over thedocker execcontrol plane. The script is idempotent and:python3/venv,useradd/usermod/groupmod,mount,git) withapt-get,tdnf,dnforyum;vscodeuser (the old Dockerfile did the same);agentaccount,/var/log/microbots, and git'ssafe.directory;fastapi,uvicornandpydanticinto a root-owned venv at/opt/microbots/venv, isolated from the agent's Python.dockerShell.pyas root from that venv. It still drops toagentbefore running any bot command.sleep(2).If any setup step fails, the container is stopped and the error includes the script output or the server log.
Changes
shell_server/:dockerShell.pyandShellCommunicator.pyare moved unchanged fromimage_builder/(including Wrap commands to avoid entire bash failing #195's command wrapping), andprepare.shis new.images.py:DEBIAN_IMAGEandDEFAULT_IMAGEconstants.image_builder/Dockerfile, the Docker Hub publish workflow (dockerBuildPush.yml), and the CI buildx/cache/build steps. CI now pulls the stock image. The remaining workflow actions keep Pin GitHub Actions to full-length commit SHAs #193's pinned SHAs.shell_server,images), plus the logging example.Trade-off
Each start now does network work: about 9 seconds on the default image for the pip install of the server's dependencies. In exchange, no image has to be built or published, and any MCR image can be used.
Testing
prepare.shsyntax. 680 passed. The 6 failures intest_microbot.py::TestMicrobotUnitand 4 errors intest_memory_tool_integration.pyalso occur onmainand come from my local environment.test/environment/local_docker) on the stock default image: 10 passed.mcr.microsoft.com/azurelinux/base/core:3.0withREAD_ONLYandREAD_WRITEmounts. The shell runs asagent, it cannot usesudoor modify/opt/microbots, and files it writes on the host belong to the host user.prepare.shis included in the built wheel.Upcoming PRs in this stack
/etc/os-release.AZURELINUX_IMAGE=mcr.microsoft.com/azurelinux/base/core:3.0), with animageoption on the bots.root_accessfor the sandbox shell.rpm/mock/azldevtool definitions.session_optionsand skill tracking, so it can use a repository's agent skills (for example Azure Linux'sazldev-*).