fix(sandbox): fall back to 'latest' tag when image name has no colon#2962
Open
chinesepowered wants to merge 1 commit intoQwenLM:mainfrom
Open
fix(sandbox): fall back to 'latest' tag when image name has no colon#2962chinesepowered wants to merge 1 commit intoQwenLM:mainfrom
chinesepowered wants to merge 1 commit intoQwenLM:mainfrom
Conversation
If the sandbox image name has no explicit :tag and QWEN_SANDBOX_IMAGE_TAG
is unset, imageName.split(':')[1] returns undefined, producing a bogus
build target like 'myimage:undefined'. Fall back to 'latest' to match
Docker's conventional default.
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.
Fall back to
latesttag in sandbox build when image name has no colon.TLDR
scripts/build_sandbox.jsresolved the image tag viaimageName.split(':')[1]with no fallback. IfimageNamehas no explicit tag andQWEN_SANDBOX_IMAGE_TAGis unset,split(':')[1]returnsundefined, producing a literal"myimage:undefined"build target that Docker/Podman reject with a confusing error. This PR adds a'latest'fallback to match Docker's conventional default.Screenshots / Video Demo
N/A — build script fix, no user-facing UI.
Dive Deeper
Before:
When a user passes
-i myimage(no tag) and has noQWEN_SANDBOX_IMAGE_TAGset:imageName.split(':')[1]→undefinedimageTag→undefinedfinalImageName→"myimage:undefined"docker build -t myimage:undefined ...fails with an invalid reference format errorIn practice the default image name in
packages/cli/package.json(cliPkgJson.config.sandboxImageUri) does contain a tag, so this bug bites only users who override the image via the-i/--imageflag and forget to include a colon-tag. The symptom is a build failure with an opaque "invalid reference format" error pointing atundefined.After:
'latest'is the established Docker default when no tag is specified, so this matches user expectations for untagged image references.Modified file:
scripts/build_sandbox.js— add'latest'fallbackReviewer Test Plan
node scripts/build_sandbox.js -i "test-image"(no colon) — verify the build command usestest-image:latestnode scripts/build_sandbox.js -i "test-image:v2"— verify tag is stillv2QWEN_SANDBOX_IMAGE_TAG=custom node scripts/build_sandbox.js -i "test-image"— verify env var still wins-i, no env var) — should behave identically to before since the defaultsandboxImageUrihas a tagTesting Matrix