Add image build-or-wait helpers - #130
Merged
Merged
Conversation
Dingway98
marked this pull request as ready for review
September 27, 2026 01:53
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 80d1ea1. Configure here.
NikhilShahi
approved these changes
Sep 27, 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
Concurrent callers currently have to implement image lookup, naming, and build-conflict handling themselves. Add sync and async
sandboxes.get_or_build_image()to reuse a ready image, join a compatible in-progress build, or create one from a Dockerfile context or local Docker image.Changes
reused,joined, orcreatedwith the resolved image/build identifiers.find_ready_image()lookup, including completed images awaiting backup, and expose the shared naming helper throughhyperbrowser.image_builds.Validation
pytest tests --ignore=tests/sandbox/e2e -q: 555 passed, including typing checks. Ruff lint and changed-file formatting passed. GitHub checks for the updated commit passed Python 3.8–3.14, typing, and package validation.Note
Medium Risk
New orchestration composes non-atomic lookup plus build APIs and local Docker identity inspection; mistakes could cause duplicate builds or wrong-name publishes, though digest/context mutation checks and conflict joining reduce that risk.
Overview
Adds sync/async
sandboxes.get_or_build_image()so callers can resolve a sandbox image from a Dockerfile context or local Docker image without hand-rolling cache keys, lookups, and build-conflict handling. It derives a stableimage_namefrom context fingerprint or image digest (plus platform and normalizedimage_init), then reuses a ready team image, joins a compatibleimage_build_in_progress409, or submits a new build; results are returned asSandboxImageBuildResolution(reused/joined/created).Supporting pieces include paginated
find_ready_image(), sharedimage_resolutionhelpers and publichyperbrowser.image_builds.image_build_name,docker_image_digest()with clearer Docker API 1.49+ errors, andexpected_image_digestchecks on docker-image imports.force_build, optional precomputed fingerprints/digests, per-caller wait/upload timeouts, and non-cancellation of backend builds on client timeout are documented; explicit-name build APIs are unchanged. Version bumps to 1.9.0 with README and broad tests.Reviewed by Cursor Bugbot for commit 144e913. Bugbot is set up for automated code reviews on this repo. Configure here.