Repository navigation
SWE-bench baked sandbox image: Dockerfile emitter + OCP BuildConfig (Plan B Task 3) - #124
Merged
Merged
Conversation
Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
Swap pip install conda-pack for the conda install path verified end-to-end in docs/notes/swebench-image-facts.md; add a test guard asserting the conda recipe and rejecting the pip form. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
SWE-bench installs the repo editable (pip install -e /testbed) inside the testbed conda env; conda pack refuses editable packages by default, which failed the OCP build at the matplotlib env stage. Pass --ignore-editable-packages to drop the dangling /testbed link (the repo is reprovided at runtime via the worktree, Task 5 / Plan C). Test asserts the flag is present in every env stage. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
SWE-bench testbed envs are mixed conda+pip; pip installs clobber conda-managed files (numpy-base, packaging, pillow, ...), so conda pack's consistency check fails at build time (matplotlib env stage). Add --ignore-missing-files alongside --ignore-editable-packages — the standard combo for a best-effort pack of a dirty conda+pip env. Test asserts both flags in every env stage. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
conda-pack writes bin/conda-unpack with a shebang pointing at the original prefix (/opt/miniconda3/envs/testbed/bin/python), absent in the ubuntu assembled base, so invoking it directly exits 127 (bad interpreter) at the first env unpack. Call the relocated env's own python explicitly before conda-unpack so it resolves sys.prefix from the new location. Test asserts the env-python invocation for each of the 3 env dirs. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
conda-pack --ignore-missing-files shipped a corrupt numpy for mixed conda+pip envs (matplotlib/sklearn numpy import failed in the Task-3b verify gate; django was fine). Pivot to 'conda create --clone testbed -n <env_dir>' per env stage, then COPY each cloned env to the same /opt/miniconda3/envs/<env_dir> path in the assembled stage (no pack/unpack/tar, no relocation — clone writes self-consistent prefixes). Add git config --system safe.directory '*' since repos are cloned as root but the pod runs UID 65532. Test asserts the clone command, same-path COPYs, safe.directory, and a regression guard rejecting all conda-pack machinery. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
The BuildConfig output tag was hardcoded 3of15 and would masquerade if built at a different --limit (review M1). Add a --print-tag mode that prints <deckHash>-<N>of<total> from a single source (slice_tag, N = actual selected count capped at total) so the build driver can patch the output tag per build; note this in the manifest (committed value stays a valid default). Test asserts --print-tag --limit 3 and --limit 15 against the bake-list's deckHash + envs.length. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
… builds Single-shot 15-env builds get evicted (15 base eval images can't coexist in buildah). Support building the full image in sequential batches of 5, each FROM the prior pushed image: --offset M slices envs[M:M+N]; --base IMG sets the assembled FROM (default ubuntu:22.04); base tooling (apt + git safe.directory) auto-emits only on the default ubuntu base and is skipped when --base is set (--base-tools/--no-base-tools override). Repo clones are now idempotent (test -d || git clone) since repos recur across batches. deck-slice label + --print-tag are cumulative (offset+selected), so batches tag 5of15/10of15/15of15 and the final image reads 15of15. Default --emit --limit 3 behavior preserved (ubuntu base, tools present, offset 0). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
pdettori
force-pushed
the
feat/swebench-image
branch
from
July 15, 2026 13:53
8fc2b21 to
1730247
Compare
Member
Author
Full 15-env slice built + validated on OCP 4.20The complete committed-deck image is built and verified (updating the "build in progress" note in the PR body):
Build shape: the 15-env image can't be built single-shot on the default 128 GB-ephemeral worker nodes (all 15 base eval images can't coexist in buildah storage → pod eviction). It was built via iterative accumulation — 5 sequential batches of 3, each Assisted-By: Claude Code |
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
Plan B Task 3 — the baked SWE-bench sandbox image tooling. Additive, off-by-default; no runtime harness behavior changes. Builds on #117 (deck + bake-list).
Because SWE-bench Verified publishes only per-instance eval images (no per-env images — see
docs/notes/swebench-image-facts.md), the image is composed by pulling one representative per-instance image per env-key group and cloning its conda env into the assembled image.What's included
deploy/knative/build-swebench-sandbox.sh— a bake-list-driven emitter that prints a multi-stage Dockerfile for an N-env-key slice (--emit --limit N;--print-tagderives the slice tag). Each env stage doesconda create --clone testbed -n <env_dir>; the assembled stageCOPYs each env to the identical/opt/miniconda3/envs/<env_dir>path (no relocation), mirror-clones each unique repo to/repos/<repo>.git, setsgit safe.directory, labels the image with the deck hash + slice, and runs asUSER 65532.deploy/knative/swebench-sandbox-buildconfig.yaml— OpenShift ImageStream + Docker-strategy BuildConfig (Binary source) → internal registry. The driver patches the output tag per build via--print-tag.experiments/test/swebench-sandbox-build.test.ts— hermetic structural test (11/11): pins the clone command, same-path COPY, per-envinstance_image_key, deterministic slice selection, labels/user, and a regression guard rejecting the abandoned conda-pack machinery.Live-validated on OCP 4.20 (native amd64)
The emitted Dockerfile was built via the BuildConfig and pushed to the internal registry, and a pod from the image was verified:
swebench-sandbox:ff962cb83fe5c624-3of15, ~4 GB): all 3 envs import numpy (django/matplotlib/scikit-learn), all repo mirrors bare, git+ripgrep present, runs as 65532.Why the conda-pack → conda-clone pivot
The live gate showed
conda-pack(even with--ignore-editable-packages --ignore-missing-files) produces a corrupt numpy in SWE-bench's mixed conda+pip envs (verified: the original images import numpy fine; the packed relocation didn't). Switching toconda create --clone+ same-path COPY preserves all files faithfully and fixed all three envs. The 5 fix commits document that journey; squash on merge if preferred.Follow-ups (non-blocking)
bin/pythonby absolute path (the assembled image has no base conda; imports are validated that way).Assisted-By: Claude Code