Datasets:
Some SWE-rebench-V2 images keep newer releases of the project under test, and in some of them most of the reference patch's added code is readable
Hi, and thanks for releasing SWE-rebench-V2. We plan to train a coding agent with reinforcement learning on its tasks, and before training we checked whether an agent can find the reference fix inside the task images. Below is a leakage path we found, and the tasks where we confirmed that at least half of the lines added by the reference patch can be read from it.
Leakage path
Some images contain another release of the project under test, and some of those releases already include the reference fix. They sit in two places:
- pip cache: the images for Python tasks set
PIP_CACHE_DIR=/workspace/.cache/pip, and every package pip downloaded during the build stays there, sometimes including a newer release of the project under test itself.- The images we checked run as root by default, and the directory is mode 0755, so an agent can read it.
- Cache entries are
.bodyfiles named by hash. Their names do not show the package name or version; you only see those by opening the file as a zip or tar (for example<project>-<version>.dist-info). So searching for.whlfiles by name finds nothing.
- Another installation of the project: some images have a different version of the project under test installed elsewhere, either in an extra conda environment (such as
swebench_matterhorn) or in the site-packages of the image's/usr/localPython. When the project under test is conda or setuptools, the one that ships with the image (in the conda base environment or the/usr/localPython) also falls into this category.
How we decide the fix is "readable": three filters
- The pip cache or another installation contains a release of the project under test.
- That release's git tag history contains the merge commit of the task's fix PR (checked with GitHub compare; the result is
aheadoridentical). Version numbers alone can mislead. - Of the lines the reference patch adds to non-test
.pyfiles (at least 20 characters, not comments, absent from base), at least half appear, ignoring whitespace, in the file at the same path in that release tag's source. A file that was later moved or renamed counts as not readable.
Tasks that pass only the second filter had their code rewritten after the fix was merged, or the file was moved; we do not count them as readable.
Results
The results below refer to the image digests listed in the appendices (checked on 2026-11-03).
- Reference patch code readable from the pip cache: 6 tasks: keras-20609, keras-19924, keras-19863, quacc-1689, more-itertools-892, celery-8984.
- Reference patch code readable from another installation of the project: 7 tasks: rich-2031, attrs-1321, kedro-kubeflow-202, conda-8015, pyflakes-745, setuptools-1100, setuptools-1389.
- Also setuptools-4911: its other installation (setuptools 72.1.0 in the conda base environment) predates the fix, but the fix happens to restore code that was removed later, so that installation already contains the code.
Except for keras-19863, which comes from the random sample below, we found these tasks while checking a subset of SWE-rebench-V2, so the list does not cover the full table. Separately, we randomly sampled 200 of the 32,079 rows and pulled 199 images (one image no longer exists on Docker Hub). Of those 199, 50 are Python images, and all 50 carry the pip cache (none of the non-Python images do). Only 2 of those 50 have a release of the project under test in the cache, and 1 has readable reference patch code (keras-19863).
Per-task versions, line counts and image digests are in Appendices A and B.
We have not observed a model exploiting this path; this is only a report of a possible leakage path.
Suggestions
- Could the last build step simply delete
/workspace/.cache/pip, or could the build setPIP_NO_CACHE_DIR=1so that no cache is kept in the first place? If uv is used, also runuv cache clean. - Could unneeded installations of the project (Appendix B) be removed, for example those in the
swebench_matterhornenvironment? When the project under test is a tool that ships with the image, such as conda or setuptools, that installation may not be removable; those tasks might need to be flagged instead.
Appendix A: pip cache (14 tasks: 12 from the subset we checked, 2 from the random sample)
"fix lines readable" = lines the reference patch adds to non-test .py files (at least 20 characters, not comments, absent from base) that appear in the file at the same path in the release tag's source tree, ignoring whitespace; a file that was later moved or renamed counts as not readable. Counts use the release tag's source on GitHub, not the files inside the image. "compare" is GitHub compare from the fix PR's merge commit to the release tag.
| task | found in | cached release | installed at base | fix PR | release tag | compare (merge…tag) | fix lines readable | verdict | image checked 2026-11-03 |
|---|---|---|---|---|---|---|---|---|---|
quantum-accelerators__quacc-1689 |
subset | 0.6.6 | 0.6.6 (version string already set at base) | Quantum-Accelerators/quacc#1689 | v0.6.6 | identical | 20/20 | fix code readable | docker.io/swerebenchv2/quantum-accelerators-quacc:1689-e7c3d4f@sha256:c6a8114c3dbbd686bd27fd0e98518b7bab31bbd37919a3d2cd2f39d6dfef6447 |
keras-team__keras-20609 |
subset | 3.12.1 | 3.7.0 | keras-team/keras#20609 | v3.12.1 | ahead | 20/29 | fix code readable | docker.io/swerebenchv2/keras-team-keras:20609-1597013@sha256:966e9dada6508a1aa977fbdcb78ab1ec5336330bdd26e674bbf763c54b43212c |
more-itertools__more-itertools-892 |
subset | 10.8.0 | 10.3.0 | more-itertools/more-itertools#892 | v10.8.0 | ahead | 3/3 | fix code readable | docker.io/swerebenchv2/more-itertools-more-itertools:892-1ae91eb@sha256:d1a197b9e55dea1950d65138ea2fc863b25d13200606271b2974b3f406fad6d5 |
keras-team__keras-19924 |
subset | 3.12.1 | 3.4.0 | keras-team/keras#19924 | v3.12.1 | ahead | 3/4 | fix code readable | docker.io/swerebenchv2/keras-team-keras:19924-a2e9a52@sha256:850885108cda5ab59d5ee89be48b77b3f1b82846d703f90ec44c66d5f25b6ff6 |
celery__celery-8984 |
subset | 5.6.2 | 5.4.0 | celery/celery#8984 | v5.6.2 | ahead | 2/2 | fix code readable | docker.io/swerebenchv2/celery-celery:8984-04af085@sha256:1633c8cdef1743a8166159623c6fd810404df64ba22967a475d2a2b0679880cb |
takluyver__flit-168 |
subset | 3.9.0 | 3.9.0 (separate install; work tree is 0.13) | pypa/flit#168 | 3.9.0 | ahead | 0/6 | fix in release history, files later moved; not readable at the same path | docker.io/swerebenchv2/takluyver-flit:168-29dbe93@sha256:5a0627f930157956a2a45fdbc85eceee39f53fb3d80ae84a65496c6b95388fd9 |
keras-team__keras-20296 |
subset | 3.12.1 | 3.6.0 | keras-team/keras#20296 | v3.12.1 | ahead | 0/11 | fix in release history, code later rewritten; not readable | docker.io/swerebenchv2/keras-team-keras:20296-ef407db@sha256:fac1385ee442bbd4e272e69af3d517c30eb09ab2d0d17c763869137224893469 |
keras-team__keras-20550 |
subset | 3.12.1 | 3.7.0 | keras-team/keras#20550 | v3.12.1 | ahead | 0/2 | fix in release history, code later rewritten; not readable | docker.io/swerebenchv2/keras-team-keras:20550-553521e@sha256:d1330b3908105dede90016e62f4b9347d03988199688b25fddad067d8715e3b7 |
celery__celery-8383 |
subset | 5.6.2 | 5.3.1 | celery/celery#8383 | v5.6.2 | ahead | 0/2 | fix in release history, code later rewritten; not readable | docker.io/swerebenchv2/celery-celery:8383-78ab64e@sha256:f6e6ca1c1cc83dcdd87708bb12e205cd77dc81b8b3f21933501a987fd9d32981 |
celery__celery-9331 |
subset | 5.6.2 | 5.5.0rc1 | celery/celery#9331 | v5.6.2 | ahead | 0/1 | fix in release history, code later rewritten; not readable | docker.io/swerebenchv2/celery-celery:9331-b3cd498@sha256:62ec98313efa0a04b84fa31ff4567e969cb0115aee37c1ed3fd58244de40af28 |
kennethreitz__pipenv-976 |
subset | 2023.10.3 | 8.2.7 | pypa/pipenv#976 | v2023.10.3 | ahead | 0/5 | fix in release history, code later rewritten; not readable | docker.io/swerebenchv2/kennethreitz-pipenv:976-b1be8f7@sha256:138d1110c321ee973e0c4574a81410cc65867d258eb3310693e6cda18a16db64 |
sdispater__tomlkit-71 |
subset | 0.14.0 | not installed | python-poetry/tomlkit#71 | 0.14.0 | ahead | 0/1 | fix in release history, code later rewritten; not readable | docker.io/swerebenchv2/sdispater-tomlkit:71-f90b668@sha256:b69090a1deb8960bac2f55290502e105bdc1482596697c1fb4fc4007ff0e297d |
keras-team__keras-19863 |
random sample | 3.12.1 | 3.3.3 | keras-team/keras#19863 | v3.12.1 | ahead | 6/6 | fix code readable | docker.io/swerebenchv2/keras-team-keras:19863-f6cf6a0@sha256:b84cfd7a39278bba9a3b455d96babc8c172bf6d09884955079bcb050f1fee13d |
pytest-dev__pluggy-314 |
random sample | 1.6.0 | 1.0.0.dev60+g4c5d666e1 | pytest-dev/pluggy#314 | 1.6.0 | ahead | 1/7 | partly readable | docker.io/swerebenchv2/pytest-dev-pluggy:314-4c5d666@sha256:dcfb5d71d97225e9574b8e9e5e6e2ba50264cafcaa0c1c9c669255afba9ba3b9 |
Appendix B: another installation of the project (13 tasks; images checked 2026-11-03)
Columns as in Appendix A, with the installation's version and location instead of the cache. pypa__packaging-29: the release history diverged from the fix, so it is not a leak. pypa__setuptools-1389: the image also has setuptools 72.1.0 in the conda base environment (and under /opt/conda/pkgs) and 75.1.0 in swebench_matterhorn; we counted only the Python 3.7 installation (68.0.0).
| task | installed version | location | fix PR | release tag | compare (merge…tag) | fix lines readable | verdict | image checked 2026-11-03 |
|---|---|---|---|---|---|---|---|---|
getindata__kedro-kubeflow-202 |
0.9.0 | /usr/local/lib/python3.10/site-packages/kedro_kubeflow |
getindata/kedro-kubeflow#202 | 0.9.0 | ahead | 13/13 | fix code readable | docker.io/swerebenchv2/getindata-kedro-kubeflow:202-4cb366c@sha256:774acfc074719d306e568ff30749d026a65a53c7fa9cea6bcbbae55e649ea42a |
pycqa__pyflakes-745 |
3.1.0 | /usr/local/lib/python3.10/site-packages/pyflakes |
PyCQA/pyflakes#745 | 3.1.0 | ahead | 3/3 | fix code readable | docker.io/swerebenchv2/pycqa-pyflakes:745-2c64ae4@sha256:d6b6f3a7f74262a7c2d80552b947e705572500d2ce210035887ffd27e0eb7c94 |
pypa__setuptools-1100 |
68.0.0 | /usr/local/lib/python3.7/site-packages/setuptools |
pypa/setuptools#1100 | v68.0.0 | ahead | 3/3 | fix code readable | docker.io/swerebenchv2/pypa-setuptools:1100-f26bf18@sha256:0fa1978460ca1b2417755d65f1fa56049c205ba31b8354f8f59cf59dc5735868 |
pypa__setuptools-1389 |
68.0.0 | /usr/local/lib/python3.7/site-packages/setuptools |
pypa/setuptools#1389 | v68.0.0 | ahead | 2/2 | fix code readable | docker.io/swerebenchv2/pypa-setuptools:1389-85593de@sha256:4b7c4f36d2c8ddb7211399f8f9b83d44f39d195c88806868085e46a9e57b1e22 |
python-attrs__attrs-1321 |
24.2.0 | /opt/conda/envs/swebench_matterhorn/lib/python3.12/site-packages/attr |
python-attrs/attrs#1321 | 24.2.0 | ahead | 16/16 | fix code readable | docker.io/swerebenchv2/python-attrs-attrs:1321-fd7538f@sha256:3e949c5dd2557c542d20524c697f7e6ffd86cbf22356bef7cc9e59fd05bd6af6 |
textualize__rich-2031 |
13.8.1 | /opt/conda/envs/swebench_matterhorn/lib/python3.12/site-packages/rich |
Textualize/rich#2031 | v13.8.1 | ahead | 29/30 | fix code readable | docker.io/swerebenchv2/textualize-rich:2031-8e649fe@sha256:0fe162eeb316c3d5060eadb2ab08f4e4edf5f206c8ab9437375598fe42682f83 |
qiskit__qiskit-terra-6658 |
2.3.0 | /usr/local/lib/python3.10/site-packages/qiskit |
Qiskit/qiskit#6658 | 2.3.0 | ahead | 2/8 | partly readable (one of two files later moved) | docker.io/swerebenchv2/qiskit-qiskit-terra:6658-21b875d@sha256:0c7d77c10cac39934d9c306371dfd55811340e12faeb6983c4b54f99f0f68423 |
conda__conda-8015 |
24.7.1 | /opt/conda/lib/python3.12/site-packages/conda/opt/conda/pkgs/conda-24.7.1-py312h06a4308_0/lib/python3.12/site-packages/conda |
conda/conda#8015 | 24.7.1 | ahead | 44/68 | fix code readable | docker.io/swerebenchv2/conda-conda:8015-b3d8da6@sha256:765cbd0785375e081c60fa999b36b018c2817af971997dffab67cbc4acf4eee1 |
gitpython-developers__gitpython-1264 |
3.1.43 | /opt/conda/envs/swebench_matterhorn/lib/python3.12/site-packages/git |
gitpython-developers/GitPython#1264 | 3.1.43 | ahead | 4/9 | partly readable | docker.io/swerebenchv2/gitpython-developers-gitpython:1264-bb02e12@sha256:7db2d5aee77a84b66e2f6f792064f4c4dd128581fdd2198c9c2c2ae428815e86 |
conda__conda-7162 |
24.7.1 | /opt/conda/lib/python3.12/site-packages/conda/opt/conda/pkgs/conda-24.7.1-py312h06a4308_0/lib/python3.12/site-packages/conda |
conda/conda#7162 | 24.7.1 | ahead | 1/4 | partly readable | docker.io/swerebenchv2/conda-conda:7162-660f35a@sha256:537a0506a0adf518b56610c1b6aaf94f5021011d5d0492e94ff28dafe8b31db0 |
pypa__setuptools-1365 |
68.0.0 | /usr/local/lib/python3.7/site-packages/setuptools |
pypa/setuptools#1365 | v68.0.0 | ahead | 0/16 | not readable at the same path (file later moved) | docker.io/swerebenchv2/pypa-setuptools:1365-5dddf7f@sha256:8ec09d576ce1fbf4082621c1a684bc2b2f82f4a59012e7c87f053ab206e26c0e |
pypa__packaging-29 |
24.1 | /opt/conda/envs/swebench_matterhorn/lib/python3.12/site-packages/packaging/opt/conda/lib/python3.12/site-packages/packaging/opt/conda/pkgs/packaging-24.1-py312h06a4308_0/lib/python3.12/site-packages/packaging |
pypa/packaging#29 | 24.1 | diverged | 0/2 | not a leak: release history diverged from the fix | docker.io/swerebenchv2/pypa-packaging:29-02b5d22@sha256:bc8842066f6bc927b30c5f0cac3bbcebe5f521874a10a883239ddf56ba05041d |
pypa__setuptools-4911 |
72.1.0 | /opt/conda/lib/python3.12/site-packages/setuptools |
pypa/setuptools#4911 | v72.1.0 | behind | 10/16 | special: this installation predates the fix; the fix restores code removed later, so the installation already has that code | docker.io/swerebenchv2/pypa-setuptools:4911-5450f57@sha256:d1b59042beefec6a44cc3d8c1abd985c2c2552f12a9be289ff736d031dfe556c |
Appendix C: read-only reproduction
Every docker run uses the upstream image by digest, offline (--network none) and with --rm, and prints only paths, versions, commit hashes and counts. Platform: linux/amd64. Work dir: /<repo name>.
1. Find the project's release in pip's HTTP cache. Save this script as scan_pip_http_cache.py:
# scan_pip_http_cache.py — run inside the container: python3 - <project-name> < scan_pip_http_cache.py
import os, re, sys, tarfile, zipfile
try:
import importlib.metadata as md
except ImportError:
md = None
want = re.sub(r"[-_.]+", "-", sys.argv[1].lower())
DIST = re.compile(r"(?:[^/]+/)?([A-Za-z0-9_.-]+?)-([0-9][^/]*?)\.(?:dist-info|egg-info)(?:/|$)")
SDIST = re.compile(r"([A-Za-z0-9_.-]+)-([0-9][^/]*)/(?:setup\.py|pyproject\.toml)$")
roots = []
for dp, dn, _ in os.walk("/"):
if dp.startswith(("/proc", "/sys", "/dev")) or dp.count("/") > 6:
dn[:] = []; continue
for d in list(dn):
p = os.path.join(dp, d)
if p.endswith(("/.cache/pip", "/.cache/uv")) or d == "pip-cache":
roots.append(p); dn.remove(d)
print("cache dirs:", roots)
for root in roots:
for dp, _, fn in os.walk(root):
for f in fn:
p = os.path.join(dp, f)
try:
head = open(p, "rb").read(2)
names = (zipfile.ZipFile(p).namelist() if head == b"PK"
else tarfile.open(p).getnames() if head == b"\x1f\x8b" else [])
except Exception:
continue
for nm in names:
m = DIST.match(nm) or SDIST.match(nm)
if m and re.sub(r"[-_.]+", "-", m.group(1).lower()) == want:
print("cached:", m.group(1), m.group(2), "<-", p); break
try:
print("installed:", md.version(want) if md else "unknown")
except Exception as e:
print("installed: none (%s)" % type(e).__name__)
# keras-team__keras-20609: expected "cached: keras 3.12.1" and "installed: 3.7.0"
docker run --rm -i --network none --user root --entrypoint python3 \
docker.io/swerebenchv2/keras-team-keras@sha256:966e9dada6508a1aa977fbdcb78ab1ec5336330bdd26e674bbf763c54b43212c \
- keras < scan_pip_http_cache.py
2. Check that the release contains the fix PR's merge commit (no Docker needed):
SHA=$(gh api repos/keras-team/keras/pulls/20609 --jq .merge_commit_sha)
gh api repos/keras-team/keras/compare/$SHA...v3.12.1 --jq .status # "ahead" or "identical"
3. Count the fix lines that are readable at the same path. Save the row's patch field as fix.patch, check out the project at the row's base_commit as base/, and check out the release tag as rel/ (for example git clone --depth 1 --branch v3.12.1 https://github.com/keras-team/keras rel). Use the tag's source tree rather than an unpacked wheel: a wheel drops the src/ prefix of src-layout projects, so the same-path lookup would miss. Then run:
# count_fix_lines.py: usage: python3 count_fix_lines.py fix.patch BASE_DIR RELEASE_DIR
# fix.patch : the row's `patch` field saved to a file
# BASE_DIR : the project's source tree at the row's base_commit
# RELEASE_DIR : the project's source tree at the release tag
# Counts the lines the patch adds to non-test .py files (>= 20 characters, not comments,
# absent from the base version of that file) and how many of them appear in the file at
# the same path in the release, ignoring whitespace. A file that was later moved or renamed
# counts as not readable. Prints counts only.
import os, re, sys
patch, base, rel = sys.argv[1:4]
norm = lambda s: re.sub(r"\s+", "", s)
def is_test(p):
b, P = os.path.basename(p), "/" + p
return ("/tests/" in P or "/test/" in P or "/testing/" in P
or b.startswith("test_") or b.endswith("_test.py") or b == "conftest.py")
def read(root, path):
p = os.path.join(root, path)
return norm(open(p, errors="replace").read()) if os.path.exists(p) else None
files, cur = {}, None
for line in open(patch, errors="replace"):
m = re.match(r"diff --git a/\S+ b/(\S+)", line)
if m:
cur = m.group(1); files.setdefault(cur, []); continue
if cur and line.startswith("+") and not line.startswith("+++"):
files[cur].append(line[1:])
n = k = 0
for path, added in files.items():
if is_test(path) or not path.endswith(".py"):
continue
btxt = read(base, path) or ""
rtxt = read(rel, path)
for a in added:
s = a.strip()
if len(s) < 20 or s.startswith("#") or norm(s) in btxt:
continue
n += 1
k += rtxt is not None and norm(s) in rtxt
print(f"fix lines readable at the same path: {k}/{n}")
python3 count_fix_lines.py fix.patch base rel # keras-team__keras-20609: 20/29
4. Another installation of the project (python-attrs__attrs-1321): list its version and which files differ from the work tree. No file content is printed.
docker run --rm --network none --entrypoint sh \
docker.io/swerebenchv2/python-attrs-attrs@sha256:3e949c5dd2557c542d20524c697f7e6ffd86cbf22356bef7cc9e59fd05bd6af6 -c '
SP=/opt/conda/envs/swebench_matterhorn/lib/python3.12/site-packages
ls -d $SP/attrs-*.dist-info
cd /attrs && git rev-parse HEAD
diff -rq --exclude=__pycache__ /attrs/src/attr $SP/attr'
Hey, thanks a lot, this is super insightful!
We’ve published a cleaned version on Harbor, SWE-rebench V2.1 RL, which fixes issues like the ones you found, including newer copies of the project leaking the fix.
we’re checking the pip-cache path for the next update, next week.
tasks: https://hub.harborframework.com/datasets/ibragim-badertdinov/swe-rebench-v2.1-rl
article: https://x.com/ibragim_bad/status/2118378057731920053
please write your x handles or names, so I can give you shoutout next week with the update post!