Add --pull flag to control image pull policy - #123
Merged
Conversation
Adds a --pull flag with four modes to control OCI image pulling: - always: check registry before VM boots (blocks start) - background: use cached image instantly, refresh in background (default) - if-not-present: use cache if available, pull on miss - never: cache only, fail if not cached (airgapped/CI) The "background" default gives zero-latency starts while keeping images fresh within one session lag. The registry check and optional extraction happen in a fire-and-forget goroutine after the VM boots. Implementation requires no go-microvm changes: - "always" deletes the ref index entry before microvm.Run(), forcing a registry manifest fetch while the digest cache avoids re-extraction - "never" injects a neverPullFetcher via WithImageFetcher that errors on cache miss - "background" spawns a goroutine after VM start that does the same ref-delete + PullWithFetcher flow asynchronously Closes #86 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
--pullflag with four modes:always,background(default),if-not-present,neverbackground(default) uses cached image for instant VM start, refreshes from registry in a background goroutine so the next run picks up any newer imagealwayschecks registry synchronously before VM boots (blocks start ~100-500ms)if-not-presentuses cache if available, pulls on miss (previous implicit behavior)neveruses cache only, fails if not cached (airgapped/offline/CI)image.pull) with CLI override;bbox config initdocuments the new section--no-image-cache+--pull=neverconflict earlyWithImageFetcherand ref index manipulationCloses #86
Test plan
task fmt— no formatting issuestask lint— 0 issuestask test— all 27 packages pass (15 new tests across 3 packages)bbox claude-code --pull alwaysblocks on registry checkbbox claude-code --pull backgroundstarts instantly, logs background refreshbbox claude-code --pull neverfails if image not cachedbbox claude-code --no-image-cache --pull nevererrors immediatelyimage.pull: alwaysis respected, CLI overrides it🤖 Generated with Claude Code