fix(smolmachines): build agent image in launch, not prepare #80
Reference in New Issue
Block a user
Delete Branch "smolmachines-build-in-launch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Starting a smolmachines agent from the dashboard rendered the
docker build+smolvm pack createoutput on top of the curses preflight modal — the build ran before the operator confirmedy/N. Docker'sprepareis pure resolution; smolmachines was inconsistent becausepreparecalled_ensure_smolmachine(build → save → crane push → pack create), several seconds of stderr noise before the prompt.Changes
_ensure_smolmachinemoves frombackend/smolmachines/prepare.pytobackend/smolmachines/launch.py. Plus_SMOLMACHINE_CACHE_DIR,_REPO_DIR, and the local-registry / smolvm imports it needs. The function runs immediately before_smolvm.machine_create, so the resulting.smolmachinesidecar path lands as a local inlaunch, not on the plan.SmolmachinesBottlePlan.agent_from_path: Path→agent_image_ref: str.preparestashes only the docker tag ($CLAUDE_BOTTLE_IMAGEorclaude-bottle:latest);launchresolves it into the artifact at bringup.This puts smolmachines on the same prepare-vs-launch boundary the docker backend uses. The dashboard's preflight summary draws first, the operator confirms, and then
launchruns — whose stderr is routed via_route_op_to_right_pane(in tmux) or viacurses.endwin(foreground handoff) so the build output lands cleanly.Tests
tests/unit/test_smolmachines_prepare_image.py→tests/unit/test_smolmachines_launch_image.py. Updated to import_ensure_smolmachinefromlaunchrather thanprepare.test_smolmachines_provision.py: plan fixture switchesagent_from_path→agent_image_ref.593 unit tests pass.
Stacking
Independent of PR #78 / PR #79 — touches only
backend/smolmachines/and its tests. Can merge in any order.