FWeindel commited on
Commit
4a334b9
·
verified ·
1 Parent(s): b6b4cff

Add MultiSWE v1 task data and validation evidence

Browse files

Adds the reconciled task and archive Parquets, dataset card, patcher, image manifest, and validation evidence. The card distinguishes 314 archived tasks from 46 pending decisions and reports incomplete checks.

multiswe_v1/README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # [MultiSWE](https://huggingface.co/datasets/PrimeIntellect/Multi-SWE-RL-Verified)
2
+
3
+ ## Dataset stats
4
+
5
+ - **Original tasks:** 2,232
6
+ - **Kept:** 1,872
7
+ - **Changed:** 1,872
8
+ - **Archived:** 314
9
+ - **Pending final inclusion or exclusion:** 46
10
+ - **Images:** 2,232 original per-task Docker image references, reduced to 339 shared image build contexts before exclusions and **290** for the kept tasks.
11
+
12
+ The kept set is not yet a fully validated release. Reconciliation of saved outcomes still finds 3 setup failures, 635 reference failures, 622 no-op failures and 22 tasks without complete stage 4 results among kept tasks; these groups overlap. Manual approvals are included in these counts. Historical passes do not certify compliance with the current validation settings.
13
+
14
+ ## Dataset characteristics
15
+
16
+ Real repository issue-solving tasks with a base checkout, issue instructions, upstream test patch and reference solution. Source: [PrimeIntellect/Multi-SWE-RL-Verified, revision `80de95c`](https://huggingface.co/datasets/PrimeIntellect/Multi-SWE-RL-Verified/tree/80de95c62ac792c99dcfa8e26569bcd7d036bdc3).
17
+
18
+ <details><summary>Domains</summary>
19
+
20
+ **Software Engineering; Debugging; Web and API Tooling; Build Systems.** Tasks span projects including Checkstyle, Mockito, SpotBugs, Hugo, etcd, SDL, Svelte, React Router and Nuxt.
21
+
22
+ </details>
23
+
24
+ <details><summary>Capabilities</summary>
25
+
26
+ **Exploration; Error Recovery; Specification Adherence.** Locate relevant code in unfamiliar repositories, reproduce a defect, modify the implementation and verify the repair against project tests. Some tasks require dependency or build-system changes.
27
+
28
+ </details>
29
+
30
+ **Intended benchmark transfer:** repository-level issue diagnosis and test-driven repairs in SWE-bench-style evaluations and terminal software-engineering tasks. This is an intended use, not a measured transfer result.
31
+
32
+ ## Per-stage breakdown
33
+
34
+ - **1. Build and setup: 1,872 changed, 8 archived.** Archived 8 tasks: 4 Nuxt setup OOMs, 1 Checkstyle setup failure and 3 Mockito image-build failures due to Maven dependency downloads.
35
+ - **2. Reference solution (reward 1): 62 changed, 269 archived.** Increased memory from 4 to 8 GiB for 58 tasks to prevent reference-solution OOMs. Restored missing Java regression-test inputs in 3 tasks; all 3 now pass reference and no-op validation. Fixed passing-test detection in 1 task so a missing line break no longer hides a passing test. Archived 180 tasks whose reference solution returned 0, 53 whose verifier could not execute successfully because of dependency, environment or test-execution errors, 32 that hit the memory limit with an 8 GiB configuration, and 4 whose verifier exceeded 30 minutes.
36
+ - **3. No-op baseline (reward 0): 0 changed, 37 archived.** Archived 29 tasks whose unchanged baseline scored 1 and 8 tasks that hit the memory limit at 8 GiB. All 8 had one passing reference result, but 4 also had attempts fail from OOM, so we archived them as not reliably solvable. Manually approved 422 false positives from the no-op checker, which could not confirm verifier execution; the corresponding reference solutions passed.
37
+ - **4. Rule-based checks: 1,871 changed, 0 archived.** Removed later or unrelated Git history from 1,871 kept tasks to prevent access to potential future fixes. Also cleared reflogs and unreachable objects and normalized tracked-file timestamps.
38
+
39
+ The strict check for exact solution-file copies in the agent environment passed for all 70 checked tasks selected to keep. The remaining 1,802 kept tasks have not completed this check.
40
+
41
+ ## Runtime and validation time
42
+
43
+ - **Runtime:** Apptainer on Helma; pinned grader `multi-swe-bench==1.1.2` with Python **3.11.13** inside task images.
44
+ - **Implementation:** [Marin Harbor `7faf878c14b6`](https://github.com/marin-community/harbor/tree/7faf878c14b6d72737579ec936ebf5f74ba3194d) plus [our runtime patches](https://github.com/MLI-lab/OT-next-data/tree/main/harbor_patches).
45
+ - **Task resources:** typically **4 CPUs and 4 GiB**, with task-specific exceptions. Increased 58 tasks from **4 to 8 GiB** with passing reference solutions. The verifier limit is **1,800 seconds**.
46
+ - **Task preparation:** median **13.5 s**, mean **19.5 s**, p95 **53.0 s** across all 2,232 original tasks, including container startup and setup.
47
+ - **Validation time:** summed stage wall time across the historical full run's 140 shards: setup **6.95 h**, reference **47.99 h**, no-op **46.88 h**, static checks **43.3 s**. These totals exclude queue waits, image preparation and separately recorded reruns; shards ran concurrently. Static timing predates the reference-solution leak check.
multiswe_v1/archive.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:532d9892979fb4af6dbe5d86d53db1feeadeca5c7ab965a930d0cebd1d152220
3
+ size 59989915
multiswe_v1/evidence/multiswe-v16-20261018.json ADDED
The diff for this file is too large to render. See raw diff
 
multiswe_v1/evidence/multiswe-v16-20261018.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf6dba4b2df081a0506ce12613d8208873f68d2deda13992d657a50abe41c5e3
3
+ size 1136493765
multiswe_v1/evidence/reconciled-results.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:376e58a6d0986ec44c041ffa0071f6e1ed102783db4776e2a1f08b92b8c31d1b
3
+ size 225421
multiswe_v1/images/manifest.json ADDED
The diff for this file is too large to render. See raw diff
 
multiswe_v1/patch.py ADDED
@@ -0,0 +1,1188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Bake a compatible, pinned grader into the pinned Multi-SWE task images."""
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import copy
6
+ import io
7
+ import hashlib
8
+ import json
9
+ import re
10
+ import subprocess
11
+ import shlex
12
+ from pathlib import Path, PurePosixPath
13
+ import sys
14
+ import tarfile
15
+
16
+ sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
17
+
18
+
19
+ # Embedded build inputs retain their exact bytes so image cache keys remain stable.
20
+ EMBEDDED_FILES = {
21
+ 'grader-requirements.txt': (
22
+ 'annotated-doc==0.0.5\n'
23
+ 'annotated-types==0.8.0\n'
24
+ 'anyio==4.15.1\n'
25
+ 'bashlex==0.18\n'
26
+ 'certifi==2026.7.22\n'
27
+ 'cffi==2.1.1\n'
28
+ 'charset-normalizer==3.5.2\n'
29
+ 'click==8.5.0\n'
30
+ 'cryptography==50.0.2\n'
31
+ 'dataclasses-json==0.6.7\n'
32
+ 'docker==7.2.0\n'
33
+ 'fastapi==0.142.2\n'
34
+ 'gitdb==4.0.12\n'
35
+ 'GitPython==3.2.0\n'
36
+ 'h11==0.16.0\n'
37
+ 'idna==3.20\n'
38
+ 'markdown-it-py==4.2.0\n'
39
+ 'marshmallow==3.26.2\n'
40
+ 'mdurl==0.1.2\n'
41
+ 'multi-swe-bench @ https://files.pythonhosted.org/packages/48/ad/6b7cda600a50392c790b14ee420b9a3bb318a982a298c05f2d1c066a434f/multi_swe_bench-1.1.2.tar.gz#sha256=44944bc6608d7d9b8d4390f3ce0a3b2c69122ea6be6e35766c6fde2328f50392\n'
42
+ 'mypy_extensions==1.1.0\n'
43
+ 'opentelemetry-api==1.45.1\n'
44
+ 'packaging==26.3\n'
45
+ 'pexpect==4.9.0\n'
46
+ 'pip==24.3.1\n'
47
+ 'ptyprocess==0.7.0\n'
48
+ 'pycparser==3.0\n'
49
+ 'pydantic==2.13.5\n'
50
+ 'pydantic_core==2.46.5\n'
51
+ 'PyGithub==2.10.0\n'
52
+ 'Pygments==2.21.0\n'
53
+ 'PyJWT==2.15.1\n'
54
+ 'PyNaCl==1.6.2\n'
55
+ 'python-multipart==0.0.32\n'
56
+ 'PyYAML==6.0.3\n'
57
+ 'requests==2.34.2\n'
58
+ 'rich==15.0.0\n'
59
+ 'setuptools==80.9.0\n'
60
+ 'smmap==5.0.3\n'
61
+ 'starlette==1.7.0\n'
62
+ 'swe-rex==1.4.0\n'
63
+ 'toml==0.10.2\n'
64
+ 'tqdm==4.70.1\n'
65
+ 'typing-inspect==0.9.0\n'
66
+ 'typing-inspection==0.4.4\n'
67
+ 'typing_extensions==4.16.0\n'
68
+ 'unidiff==1.0.1\n'
69
+ 'urllib3==2.8.0\n'
70
+ 'uvicorn==0.54.0\n'
71
+ ),
72
+ 'preinstall_cache_v8.py': (
73
+ '"""Install one exact baseline\'s dependencies during image construction."""\n'
74
+ 'import json\n'
75
+ 'import os\n'
76
+ 'from pathlib import Path\n'
77
+ 'import re\n'
78
+ 'import shlex\n'
79
+ 'import subprocess\n'
80
+ 'import sys\n'
81
+ 'import tempfile\n'
82
+ 'import time\n'
83
+ 'from urllib.parse import urlsplit\n'
84
+ 'from xml.sax.saxutils import escape\n'
85
+ '\n'
86
+ '\n'
87
+ "JUNIT_LOCAL_SNAPSHOT = '''gradle.projectsEvaluated {\n"
88
+ " def vintage = rootProject.findProject(':junit-vintage-engine')\n"
89
+ ' if (vintage != null) {\n'
90
+ ' rootProject.allprojects { p ->\n'
91
+ ' p.configurations.configureEach { c ->\n'
92
+ ' c.resolutionStrategy.dependencySubstitution.all { dep ->\n'
93
+ ' def requested = dep.requested\n'
94
+ ' if (requested instanceof org.gradle.api.artifacts.component.ModuleComponentSelector &&\n'
95
+ " requested.group == 'org.junit.vintage' &&\n"
96
+ " requested.module == 'junit-vintage-engine' &&\n"
97
+ ' requested.version == vintage.version.toString()) {\n'
98
+ " dep.useTarget(c.resolutionStrategy.dependencySubstitution.project(':junit-vintage-engine'))\n"
99
+ ' }\n'
100
+ ' }\n'
101
+ ' }\n'
102
+ ' }\n'
103
+ ' }\n'
104
+ '}\n'
105
+ "'''\n"
106
+ '\n'
107
+ '\n'
108
+ 'def javascript_install_script(spec):\n'
109
+ " script = spec['electron_proxy'] + '\\n' + spec['prepare']\n"
110
+ ' script = script.replace(\'bash /home/check_git_changes.sh\', \'test -z "$(git status --porcelain)"\')\n'
111
+ " script = re.sub(r'\\s*\\|\\|\\s*true\\b', '', script)\n"
112
+ " if spec['repo'] == 'material-ui' and spec['base_sha'] == '293b579ab1dc22770921e57d1e5a51f9b90bbec0':\n"
113
+ " script = 'export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1\\n' + script\n"
114
+ " if spec['repo'] == 'redux' and spec['base_sha'] == 'cefb03adfd672891e65166403cfc70709f73d6a8':\n"
115
+ ' # Skip only the root release/test hook, retaining dependency lifecycle scripts.\n'
116
+ ' disable = \'const fs=require("fs");const p=JSON.parse(fs.readFileSync("package.json"));delete p.scripts.prepublish;fs.writeFileSync("package.json",JSON.stringify(p));\'\n'
117
+ ' install = (\'( backup=$(mktemp); cp package.json "$backup"; \'\n'
118
+ ' \'trap \\\'cp "$backup" package.json; rm -f "$backup"\\\' EXIT; \'\n'
119
+ " 'node -e ' + shlex.quote(disable) + '; yarn install )')\n"
120
+ " script = re.sub(r'(?m)^yarn install\\s*$', lambda _: install, script)\n"
121
+ ' return script\n'
122
+ '\n'
123
+ '\n'
124
+ 'def preinstall(spec, configure_gradle_proxy):\n'
125
+ " repo = Path('/home') / spec['repo']\n"
126
+ " properties = Path(os.environ.get('GRADLE_USER_HOME', '/opt/multiswe-gradle')) / 'gradle.properties'\n"
127
+ ' original = properties.read_bytes() if properties.exists() else None\n'
128
+ ' original_mode = properties.stat().st_mode & 0o777 if properties.exists() else None\n'
129
+ " java = spec['repo'] in ('checkstyle', 'fastjson2', 'junit5', 'logstash', 'mockito', 'spotbugs')\n"
130
+ " with tempfile.TemporaryDirectory(prefix='multiswe-preinstall-') as temporary:\n"
131
+ ' try:\n'
132
+ ' if java:\n'
133
+ ' configure_gradle_proxy()\n'
134
+ " script = 'set -e\\ngit reset --hard\\ngit checkout ' + shlex.quote(spec['base_sha']) + '\\n'\n"
135
+ " if spec['repo'] in ('checkstyle', 'fastjson2'):\n"
136
+ " Path('/opt/multiswe-maven-settings.xml').write_text('<settings/>\\n')\n"
137
+ " settings = Path(temporary) / 'settings.xml'\n"
138
+ ' values = {}\n'
139
+ " for protocol in ('http', 'https'):\n"
140
+ " value = os.environ.get(protocol + '_proxy') or os.environ.get(protocol.upper() + '_PROXY')\n"
141
+ ' if value:\n'
142
+ ' url = urlsplit(value)\n'
143
+ ' # Maven proxy settings are temporary and never baked into the image.\n'
144
+ " values[protocol] = ('<proxy><id>' + protocol + '</id><active>true</active><protocol>' + protocol +\n"
145
+ " '</protocol><host>' + escape(url.hostname or '') + '</host><port>' + str(url.port or 80) +\n"
146
+ " '</port><nonProxyHosts>localhost|127.*|repo.maven.apache.org|repo1.maven.org</nonProxyHosts></proxy>')\n"
147
+ " settings.write_text('<settings><proxies>' + ''.join(values.values()) + '</proxies></settings>')\n"
148
+ " maven_args = ' -B -s ' + shlex.quote(str(settings)) + ' -Dmaven.repo.local=/opt/multiswe-maven '\n"
149
+ " if spec['repo'] == 'fastjson2':\n"
150
+ ' # Keep upstream profiles and packaging; execute graded tests only in the verifier.\n'
151
+ ' script = spec[\'prepare\'].replace(\'bash /home/check_git_changes.sh\', \'test -z "$(git status --porcelain)"\')\n'
152
+ " script = re.sub(r'\\s*\\|\\|\\s*true\\b', '', script)\n"
153
+ " script = script.replace('./mvnw ', './mvnw' + maven_args + '-DskipTests ')\n"
154
+ ' else:\n'
155
+ " script += 'mvn' + maven_args + '-DskipTests test\\n'\n"
156
+ ' else:\n'
157
+ " junit_flag = ''\n"
158
+ " if spec['repo'] == 'junit5':\n"
159
+ " local = Path('/opt/multiswe-junit-local.gradle')\n"
160
+ ' local.write_text(JUNIT_LOCAL_SNAPSHOT)\n'
161
+ " junit_flag = '--init-script ' + str(local) + ' '\n"
162
+ " init = Path(temporary) / 'test-runtime.gradle'\n"
163
+ " init.write_text('''gradle.projectsEvaluated {\n"
164
+ " rootProject.tasks.register('multisweInstallTestRuntime') {\n"
165
+ ' doLast {\n'
166
+ ' rootProject.allprojects.each { p ->\n'
167
+ ' p.tasks.withType(org.gradle.api.tasks.testing.Test).each { t ->\n'
168
+ ' t.classpath.files\n'
169
+ " if (t.hasProperty('javaLauncher')) t.javaLauncher.orNull\n"
170
+ ' }\n'
171
+ ' }\n'
172
+ ' }\n'
173
+ ' }\n'
174
+ " }''')\n"
175
+ " script += ('./gradlew --no-daemon --max-workers 2 ' + junit_flag + '--init-script ' +\n"
176
+ " shlex.quote(str(init)) + ' testClasses multisweInstallTestRuntime\\n')\n"
177
+ ' else:\n'
178
+ ' script = javascript_install_script(spec)\n'
179
+ " log = Path(temporary) / 'installation.log'\n"
180
+ ' started = time.monotonic()\n'
181
+ " print('Installing baseline dependencies for ' + spec['repo'] + '@' + spec['base_sha'], flush=True)\n"
182
+ " with log.open('w') as output:\n"
183
+ " with subprocess.Popen(['bash', '-euc', script], cwd=repo, stdout=subprocess.PIPE,\n"
184
+ " stderr=subprocess.STDOUT, text=True, errors='replace') as process:\n"
185
+ ' for line in process.stdout:\n'
186
+ ' output.write(line)\n'
187
+ " print(line, end='', flush=True)\n"
188
+ ' returncode = process.wait()\n'
189
+ " print(f'Baseline dependency installation exit={returncode}, seconds={time.monotonic()-started:.1f}', flush=True)\n"
190
+ ' if returncode:\n'
191
+ " lines = log.read_text(errors='replace')\n"
192
+ " marker = lines.find('* What went wrong:')\n"
193
+ " errors = [line for line in lines.splitlines() if line.startswith(('error ', '[ERROR]'))]\n"
194
+ " detail = lines[marker:marker + 1000] if marker >= 0 else '\\n'.join(errors[:4])[:1000] or lines[-1000:]\n"
195
+ " raise RuntimeError('Baseline dependency installation failed: ' + detail)\n"
196
+ " head = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=repo, text=True).strip()\n"
197
+ " if head != spec['base_sha']:\n"
198
+ " raise RuntimeError('Image checkout does not match the task baseline')\n"
199
+ " Path('/home/fix.patch').unlink(missing_ok=True)\n"
200
+ " Path('/opt/multiswe-preinstalled.json').write_text(json.dumps({\n"
201
+ " 'repo': spec['repo'], 'base_sha': head, 'baseline_test_command_removed': java,\n"
202
+ " }) + '\\n')\n"
203
+ ' finally:\n'
204
+ ' if java:\n'
205
+ ' if original is None:\n'
206
+ ' properties.unlink(missing_ok=True)\n'
207
+ ' else:\n'
208
+ ' properties.write_bytes(original)\n'
209
+ ' properties.chmod(original_mode)\n'
210
+ ),
211
+ 'preinstall.py': (
212
+ '"""Install one exact baseline\'s dependencies during image construction."""\n'
213
+ 'import json\n'
214
+ 'import os\n'
215
+ 'from pathlib import Path\n'
216
+ 'import re\n'
217
+ 'import shlex\n'
218
+ 'import subprocess\n'
219
+ 'import sys\n'
220
+ 'import tempfile\n'
221
+ 'import time\n'
222
+ 'from urllib.parse import urlsplit\n'
223
+ 'from xml.sax.saxutils import escape\n'
224
+ '\n'
225
+ '\n'
226
+ "JUNIT_LOCAL_SNAPSHOT = '''gradle.projectsEvaluated {\n"
227
+ " def vintage = rootProject.findProject(':junit-vintage-engine')\n"
228
+ ' if (vintage != null) {\n'
229
+ ' rootProject.allprojects { p ->\n'
230
+ ' p.configurations.configureEach { c ->\n'
231
+ ' c.resolutionStrategy.dependencySubstitution.all { dep ->\n'
232
+ ' def requested = dep.requested\n'
233
+ ' if (requested instanceof org.gradle.api.artifacts.component.ModuleComponentSelector &&\n'
234
+ " requested.group == 'org.junit.vintage' &&\n"
235
+ " requested.module == 'junit-vintage-engine' &&\n"
236
+ ' requested.version == vintage.version.toString()) {\n'
237
+ " dep.useTarget(c.resolutionStrategy.dependencySubstitution.project(':junit-vintage-engine'))\n"
238
+ ' }\n'
239
+ ' }\n'
240
+ ' }\n'
241
+ ' }\n'
242
+ ' }\n'
243
+ '}\n'
244
+ "'''\n"
245
+ '\n'
246
+ '\n'
247
+ 'def preinstall(spec, configure_gradle_proxy):\n'
248
+ " repo = Path('/home') / spec['repo']\n"
249
+ " properties = Path(os.environ.get('GRADLE_USER_HOME', '/opt/multiswe-gradle')) / 'gradle.properties'\n"
250
+ ' original = properties.read_bytes() if properties.exists() else None\n'
251
+ ' original_mode = properties.stat().st_mode & 0o777 if properties.exists() else None\n'
252
+ " java = spec['repo'] in ('checkstyle', 'fastjson2', 'junit5', 'logstash', 'mockito', 'spotbugs')\n"
253
+ " with tempfile.TemporaryDirectory(prefix='multiswe-preinstall-') as temporary:\n"
254
+ ' try:\n'
255
+ ' if java:\n'
256
+ ' configure_gradle_proxy()\n'
257
+ " script = 'set -e\\ngit reset --hard\\ngit checkout ' + shlex.quote(spec['base_sha']) + '\\n'\n"
258
+ " if spec['repo'] in ('checkstyle', 'fastjson2'):\n"
259
+ " Path('/opt/multiswe-maven-settings.xml').write_text('<settings/>\\n')\n"
260
+ " settings = Path(temporary) / 'settings.xml'\n"
261
+ ' values = {}\n'
262
+ " for protocol in ('http', 'https'):\n"
263
+ " value = os.environ.get(protocol + '_proxy') or os.environ.get(protocol.upper() + '_PROXY')\n"
264
+ ' if value:\n'
265
+ ' url = urlsplit(value)\n'
266
+ ' # Maven proxy settings are temporary and never baked into the image.\n'
267
+ " values[protocol] = ('<proxy><id>' + protocol + '</id><active>true</active><protocol>' + protocol +\n"
268
+ " '</protocol><host>' + escape(url.hostname or '') + '</host><port>' + str(url.port or 80) +\n"
269
+ " '</port><nonProxyHosts>localhost|127.*|repo.maven.apache.org|repo1.maven.org</nonProxyHosts></proxy>')\n"
270
+ " settings.write_text('<settings><proxies>' + ''.join(values.values()) + '</proxies></settings>')\n"
271
+ " maven_args = ' -B -s ' + shlex.quote(str(settings)) + ' -Dmaven.repo.local=/opt/multiswe-maven '\n"
272
+ " if spec['repo'] == 'fastjson2':\n"
273
+ ' # Keep upstream profiles and packaging; execute graded tests only in the verifier.\n'
274
+ ' script = spec[\'prepare\'].replace(\'bash /home/check_git_changes.sh\', \'test -z "$(git status --porcelain)"\')\n'
275
+ " script = re.sub(r'\\s*\\|\\|\\s*true\\b', '', script)\n"
276
+ " script = script.replace('./mvnw ', './mvnw' + maven_args + '-DskipTests ')\n"
277
+ ' else:\n'
278
+ " script += 'mvn' + maven_args + '-DskipTests test\\n'\n"
279
+ ' else:\n'
280
+ " junit_flag = ''\n"
281
+ " if spec['repo'] == 'junit5':\n"
282
+ " local = Path('/opt/multiswe-junit-local.gradle')\n"
283
+ ' local.write_text(JUNIT_LOCAL_SNAPSHOT)\n'
284
+ " junit_flag = '--init-script ' + str(local) + ' '\n"
285
+ " init = Path(temporary) / 'test-runtime.gradle'\n"
286
+ " init.write_text('''gradle.projectsEvaluated {\n"
287
+ " rootProject.tasks.register('multisweInstallTestRuntime') {\n"
288
+ ' doLast {\n'
289
+ ' rootProject.allprojects.each { p ->\n'
290
+ ' p.tasks.withType(org.gradle.api.tasks.testing.Test).each { t ->\n'
291
+ ' t.classpath.files\n'
292
+ " if (t.hasProperty('javaLauncher')) t.javaLauncher.orNull\n"
293
+ ' }\n'
294
+ ' }\n'
295
+ ' }\n'
296
+ ' }\n'
297
+ " }''')\n"
298
+ " script += ('./gradlew --no-daemon --max-workers 2 ' + junit_flag + '--init-script ' +\n"
299
+ " shlex.quote(str(init)) + ' testClasses multisweInstallTestRuntime\\n')\n"
300
+ ' else:\n'
301
+ " script = spec['electron_proxy'] + '\\n' + spec['prepare']\n"
302
+ ' script = script.replace(\'bash /home/check_git_changes.sh\', \'test -z "$(git status --porcelain)"\')\n'
303
+ ' # Image creation must not silently succeed with a broken install.\n'
304
+ " script = re.sub(r'\\s*\\|\\|\\s*true\\b', '', script)\n"
305
+ " if spec['repo'] == 'material-ui' and spec['base_sha'] == '293b579ab1dc22770921e57d1e5a51f9b90bbec0':\n"
306
+ " script = 'export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1\\n' + script\n"
307
+ " if spec['repo'] == 'redux' and spec['base_sha'] == 'cefb03adfd672891e65166403cfc70709f73d6a8':\n"
308
+ ' # Skip only the root release/test hook, retaining dependency lifecycle scripts.\n'
309
+ ' disable = \'const fs=require("fs");const p=JSON.parse(fs.readFileSync("package.json"));delete p.scripts.prepublish;fs.writeFileSync("package.json",JSON.stringify(p));\'\n'
310
+ ' install = (\'( backup=$(mktemp); cp package.json "$backup"; \'\n'
311
+ ' \'trap \\\'cp "$backup" package.json; rm -f "$backup"\\\' EXIT; \'\n'
312
+ " 'node -e ' + shlex.quote(disable) + '; yarn install )')\n"
313
+ " script = re.sub(r'(?m)^yarn install\\s*$', lambda _: install, script)\n"
314
+ " log = Path(temporary) / 'installation.log'\n"
315
+ ' started = time.monotonic()\n'
316
+ " print('Installing baseline dependencies for ' + spec['repo'] + '@' + spec['base_sha'], flush=True)\n"
317
+ " with log.open('w') as output:\n"
318
+ " with subprocess.Popen(['bash', '-euc', script], cwd=repo, stdout=subprocess.PIPE,\n"
319
+ " stderr=subprocess.STDOUT, text=True, errors='replace') as process:\n"
320
+ ' for line in process.stdout:\n'
321
+ ' output.write(line)\n'
322
+ " print(line, end='', flush=True)\n"
323
+ ' returncode = process.wait()\n'
324
+ " print(f'Baseline dependency installation exit={returncode}, seconds={time.monotonic()-started:.1f}', flush=True)\n"
325
+ ' if returncode:\n'
326
+ " lines = log.read_text(errors='replace')\n"
327
+ " marker = lines.find('* What went wrong:')\n"
328
+ " errors = [line for line in lines.splitlines() if line.startswith(('error ', '[ERROR]'))]\n"
329
+ " detail = lines[marker:marker + 1000] if marker >= 0 else '\\n'.join(errors[:4])[:1000] or lines[-1000:]\n"
330
+ " raise RuntimeError('Baseline dependency installation failed: ' + detail)\n"
331
+ " head = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=repo, text=True).strip()\n"
332
+ " if head != spec['base_sha']:\n"
333
+ " raise RuntimeError('Image checkout does not match the task baseline')\n"
334
+ " Path('/home/fix.patch').unlink(missing_ok=True)\n"
335
+ " Path('/opt/multiswe-preinstalled.json').write_text(json.dumps({\n"
336
+ " 'repo': spec['repo'], 'base_sha': head, 'baseline_test_command_removed': java,\n"
337
+ " }) + '\\n')\n"
338
+ ' finally:\n'
339
+ ' if java:\n'
340
+ ' if original is None:\n'
341
+ ' properties.unlink(missing_ok=True)\n'
342
+ ' else:\n'
343
+ ' properties.write_bytes(original)\n'
344
+ ' properties.chmod(original_mode)\n'
345
+ ),
346
+ 'extract_fix_patch.py': (
347
+ '"""Extract agent changes without staging dependency trees or overflowing argv."""\n'
348
+ 'import os\n'
349
+ 'from pathlib import Path\n'
350
+ 'import subprocess\n'
351
+ 'import sys\n'
352
+ '\n'
353
+ '\n'
354
+ 'def git(*args, **kwargs):\n'
355
+ " return subprocess.run(['git', '--literal-pathspecs', *args], check=True, **kwargs)\n"
356
+ '\n'
357
+ '\n'
358
+ 'def names(*args):\n'
359
+ " return [os.fsdecode(p) for p in git(*args, stdout=subprocess.PIPE).stdout.split(b'\\0') if p]\n"
360
+ '\n'
361
+ '\n'
362
+ 'def batches(paths):\n'
363
+ ' batch, size = [], 0\n'
364
+ ' for path in paths:\n'
365
+ ' length = len(os.fsencode(path)) + 1\n'
366
+ ' if batch and size + length > 32768:\n'
367
+ ' yield batch\n'
368
+ ' batch, size = [], 0\n'
369
+ ' batch.append(path)\n'
370
+ ' size += length\n'
371
+ ' if batch:\n'
372
+ ' yield batch\n'
373
+ '\n'
374
+ '\n'
375
+ 'def main():\n'
376
+ ' repo, base, output = sys.argv[1:4]\n'
377
+ ' os.chdir(repo)\n'
378
+ " baseline = Path(git('rev-parse', '--git-path', 'multiswe-setup-untracked', stdout=subprocess.PIPE,\n"
379
+ ' text=True).stdout.strip())\n'
380
+ " existing = set(os.fsdecode(p) for p in baseline.read_bytes().split(b'\\0') if p) if baseline.exists() else set()\n"
381
+ " untracked = [p for p in names('ls-files', '--others', '--exclude-standard', '-z') if p not in existing]\n"
382
+ ' for batch in batches(untracked):\n'
383
+ " git('add', '--intent-to-add', '--', *batch)\n"
384
+ " changed = names('diff', '--name-only', '--no-renames', '-z', base, '--')\n"
385
+ " # Preserve the upstream dataset's fix/test path split.\n"
386
+ " fixes = [p for p in changed if not any(s in p.lower() for s in ('test', 'e2e', 'testing'))]\n"
387
+ " with open(output, 'wb') as stream:\n"
388
+ ' for batch in batches(fixes):\n'
389
+ " git('diff', '--binary', '--no-renames', base, '--', *batch, stdout=stream)\n"
390
+ ' if len(changed) != len(fixes):\n'
391
+ " print(f'Dropped {len(changed) - len(fixes)} test-like file(s) from Multi-SWE fix patch.', file=sys.stderr)\n"
392
+ " git('reset', '--hard', base, stdout=subprocess.DEVNULL)\n"
393
+ ' for batch in batches(untracked):\n'
394
+ " git('clean', '-fd', '--', *batch, stdout=subprocess.DEVNULL)\n"
395
+ '\n'
396
+ '\n'
397
+ "if __name__ == '__main__':\n"
398
+ ' main()\n'
399
+ ),
400
+ 'gradle_proxy.py': (
401
+ '"""Configure Gradle\'s JVM proxy from the task runtime\'s proxy environment."""\n'
402
+ 'import os\n'
403
+ 'from pathlib import Path\n'
404
+ 'from urllib.parse import unquote, urlsplit\n'
405
+ 'from urllib.error import HTTPError\n'
406
+ 'from urllib.request import ProxyHandler, build_opener\n'
407
+ '\n'
408
+ '\n'
409
+ 'def properties(env):\n'
410
+ ' result = {}\n'
411
+ " for protocol in ('http', 'https'):\n"
412
+ " value = env.get(protocol + '_proxy') or env.get(protocol.upper() + '_PROXY')\n"
413
+ ' if not value:\n'
414
+ ' continue\n'
415
+ " url = urlsplit(value if '://' in value else 'http://' + value)\n"
416
+ " if url.scheme != 'http' or not url.hostname:\n"
417
+ " raise ValueError('Gradle proxy requires an HTTP proxy URL')\n"
418
+ " prefix = 'systemProp.' + protocol + '.'\n"
419
+ " result[prefix + 'proxyHost'] = url.hostname\n"
420
+ " result[prefix + 'proxyPort'] = str(url.port or 80)\n"
421
+ ' if url.username:\n'
422
+ " result[prefix + 'proxyUser'] = unquote(url.username)\n"
423
+ ' if url.password:\n'
424
+ " result[prefix + 'proxyPassword'] = unquote(url.password)\n"
425
+ ' if result:\n'
426
+ " hosts = ['localhost', '127.*', '[::1]']\n"
427
+ " for host in (env.get('no_proxy') or env.get('NO_PROXY') or '').split(','):\n"
428
+ ' host = host.strip()\n'
429
+ " if host and '/' not in host and ':' not in host:\n"
430
+ " hosts.append('*' + host if host.startswith('.') else host)\n"
431
+ " result['systemProp.http.nonProxyHosts'] = '|'.join(hosts)\n"
432
+ ' return result\n'
433
+ '\n'
434
+ '\n'
435
+ 'def main():\n'
436
+ ' values = properties(os.environ)\n'
437
+ ' if not values:\n'
438
+ ' return\n'
439
+ ' # Some cluster proxies share a rate-limited Maven Central exit IP. Bypass\n'
440
+ ' # only after observing 429 through that proxy and verifying direct access.\n'
441
+ " proxy = os.environ.get('https_proxy') or os.environ.get('HTTPS_PROXY')\n"
442
+ ' if proxy:\n'
443
+ " for host in ('repo.maven.apache.org', 'repo1.maven.org', 'plugins.gradle.org'):\n"
444
+ " prefix = 'm2' if host == 'plugins.gradle.org' else 'maven2'\n"
445
+ " url = f'https://{host}/{prefix}/org/jetbrains/kotlin/kotlin-stdlib/1.9.24/kotlin-stdlib-1.9.24.pom'\n"
446
+ ' try:\n'
447
+ " with build_opener(ProxyHandler({'https': proxy})).open(url, timeout=5) as response:\n"
448
+ ' response.read()\n'
449
+ ' except HTTPError as exc:\n'
450
+ ' if exc.code != 429:\n'
451
+ ' continue\n'
452
+ ' try:\n'
453
+ ' with build_opener(ProxyHandler({})).open(url, timeout=5) as response:\n'
454
+ " if response.status != 200 or b'<artifactId>kotlin-stdlib</artifactId>' not in response.read():\n"
455
+ ' continue\n'
456
+ ' except OSError:\n'
457
+ ' continue\n'
458
+ " values['systemProp.http.nonProxyHosts'] += '|' + host\n"
459
+ " print(f'Gradle: verified direct access to {host} after proxy HTTP 429')\n"
460
+ ' except OSError:\n'
461
+ ' pass\n'
462
+ " path = Path(os.environ.get('GRADLE_USER_HOME', str(Path.home() / '.gradle'))) / 'gradle.properties'\n"
463
+ ' path.parent.mkdir(parents=True, exist_ok=True)\n'
464
+ " old = path.read_text() if path.exists() else ''\n"
465
+ " keys = {line.split('=', 1)[0].strip() for line in old.splitlines() if '=' in line}\n"
466
+ ' def escape(value):\n'
467
+ " return value.replace('\\\\', '\\\\\\\\').replace('\\n', '\\\\n').replace('\\r', '\\\\r')\n"
468
+ " with path.open('a') as stream:\n"
469
+ " stream.write('\\n' + ''.join(k + '=' + escape(v) + '\\n' for k, v in values.items() if k not in keys))\n"
470
+ ' path.chmod(0o600)\n'
471
+ '\n'
472
+ '\n'
473
+ "if __name__ == '__main__':\n"
474
+ ' main()\n'
475
+ ),
476
+ 'base-images.lock.json': (
477
+ '{\n'
478
+ ' "mswebench/alibaba_m_fastjson2:base": "mswebench/alibaba_m_fastjson2@sha256:af5482f01949b8b689d00f164d45c574dc619c9a348ae74adf8eb7eb5b8a20ca",\n'
479
+ ' "mswebench/anuraghazra_m_github-readme-stats:base": "mswebench/anuraghazra_m_github-readme-stats@sha256:8cc48464ec40ca6304d07b4c0a7bd65a392cabf23d3aabec622560fd6c58d65b",\n'
480
+ ' "mswebench/axios_m_axios:base": "mswebench/axios_m_axios@sha256:7707c562abfc8595a28f4370ff8835c304d620bc3618d8d1e20882720fa8ea8d",\n'
481
+ ' "mswebench/beego_m_beego:base": "mswebench/beego_m_beego@sha256:8b348e45db6f04e6e397933927a21e2cca687cba38fa12f4f68bba93b5dc13b8",\n'
482
+ ' "mswebench/caddyserver_m_caddy:base": "mswebench/caddyserver_m_caddy@sha256:cd674d3f8f492fa313c35cf40963c22145c2c815f530494be978df77d777864b",\n'
483
+ ' "mswebench/caolan_m_async:base": "mswebench/caolan_m_async@sha256:6c518c36364ae5834bbf01e6c7e5f268a7198cae30215ce8ddd37d82690b426c",\n'
484
+ ' "mswebench/checkstyle_m_checkstyle:base": "mswebench/checkstyle_m_checkstyle@sha256:d7f2ab8f1c54085642ddc01064946e7f8be0c176552bd278c3bd955216049074",\n'
485
+ ' "mswebench/cli_m_cli:base": "mswebench/cli_m_cli@sha256:801072bdc63db1cc524260ff1b31a307445e19ea7bbae6a12835698161e8e324",\n'
486
+ ' "mswebench/colinhacks_m_zod:base": "mswebench/colinhacks_m_zod@sha256:a8b6079dbfa81eabfbf72d7bcdade218f7960fe5c6b4ae898e0090fe0b4f5feb",\n'
487
+ ' "mswebench/darkreader_m_darkreader:base": "mswebench/darkreader_m_darkreader@sha256:124d8e241413d9308777967251616cb8a35ba3f4852c5663f657d7231d3894d9",\n'
488
+ ' "mswebench/elastic_m_logstash:base": "mswebench/elastic_m_logstash@sha256:ea6fc649df945c3df403613ddce13e5e16c9daf9182f7156ed057ec50307cbab",\n'
489
+ ' "mswebench/etcd-io_m_etcd:base": "mswebench/etcd-io_m_etcd@sha256:f10c75dd319d11cc3611f46b32edff873f6b6df0e7f7c632f0af9733fa3ce0e1",\n'
490
+ ' "mswebench/expressjs_m_express:base": "mswebench/expressjs_m_express@sha256:cb2bfa48685954c0a7f246b062ecdde9b7067d09065c13d711981ab632d9db63",\n'
491
+ ' "mswebench/facebook_m_zstd:base": "mswebench/facebook_m_zstd@sha256:e585fef372bb5f6f97a7540d3e9fb38cb8a3a039190258e4b858bb77e39ec926",\n'
492
+ ' "mswebench/fatedier_m_frp:base": "mswebench/fatedier_m_frp@sha256:1eec40809c47003bd550517d2dc73fbe553f7d10c2fdd06db49e823269976a07",\n'
493
+ ' "mswebench/go-gorm_m_gorm:base": "mswebench/go-gorm_m_gorm@sha256:4dd9ceb1b54e3791ff71db5a908cbd06e4751f548e3d55497a6fe5d1695352f6",\n'
494
+ ' "mswebench/gohugoio_m_hugo:base": "mswebench/gohugoio_m_hugo@sha256:a6eb6ead11717756b25c2a98d1911c16e3d9a2df5daf637599c947ba87cd3f8f",\n'
495
+ ' "mswebench/google_m_zx:base": "mswebench/google_m_zx@sha256:8b62b706996794bf76dc165919412ad5fff0324022f9be8b056bbc7d4db81bc7",\n'
496
+ ' "mswebench/iamkun_m_dayjs:base": "mswebench/iamkun_m_dayjs@sha256:7bccb78f8161a2c5d0ae57b8aa55b90bcd0ac92106c2ad3b7967a4e9e122dd3a",\n'
497
+ ' "mswebench/istio_m_istio:base": "mswebench/istio_m_istio@sha256:328d3d151933b6b725634740063210ae6e96970ec1cb64bc6737aac45f019d8f",\n'
498
+ ' "mswebench/jesseduffield_m_lazygit:base": "mswebench/jesseduffield_m_lazygit@sha256:e8e4c31f8b7930614817dbe33fa9f7b31e00ba0804883ce3354cbb3b3e0279d8",\n'
499
+ ' "mswebench/jqlang_m_jq:base": "mswebench/jqlang_m_jq@sha256:8e3b31d703046a38bee2fe0ef27151d3bc44aaff2505fbba4e3da23ee667d2c3",\n'
500
+ ' "mswebench/junegunn_m_fzf:base": "mswebench/junegunn_m_fzf@sha256:137faf1d45214b55b05a21db2750fffe9d920216e8aed050bab3fe600069c160",\n'
501
+ ' "mswebench/junit-team_m_junit5:base": "mswebench/junit-team_m_junit5@sha256:2c1ca9b9c50cb132ac7e7798f68b89807cff7e67c1a9ac70ee83300475c96507",\n'
502
+ ' "mswebench/junit-team_m_junit5:base-JDK-17": "mswebench/junit-team_m_junit5@sha256:d3c8968c4988a2a2dcd0b4bd3f6c8d896d7c3e375269c35f87c190911d861d19",\n'
503
+ ' "mswebench/kong_m_insomnia:base": "mswebench/kong_m_insomnia@sha256:25593314d127cf0a82aaeb67d6aa2b2e6b957c7dcba94641ada7022b342d4c25",\n'
504
+ ' "mswebench/labstack_m_echo:base": "mswebench/labstack_m_echo@sha256:ede76736dd38fe3c39a90710eba3d902ed994f75928a77e8283fdd7e8a91f783",\n'
505
+ ' "mswebench/libsdl-org_m_sdl:base": "mswebench/libsdl-org_m_sdl@sha256:715635ef142b55d55d8e987cc1d9df2831749cbb4b6218c3c769c811527d398c",\n'
506
+ ' "mswebench/mockito_m_mockito:base": "mswebench/mockito_m_mockito@sha256:2e502e4a38aba9490958b640df9b80ef44f0ba6ff430ee544dc10fb2c56bfb60",\n'
507
+ ' "mswebench/mruby_m_mruby:base": "mswebench/mruby_m_mruby@sha256:94c5cee68f8565d2b8c39d7e0288dd2fef92ad6d9f7e1083ae35128a33923bbc",\n'
508
+ ' "mswebench/mruby_m_mruby:base-cpp-11": "mswebench/mruby_m_mruby@sha256:7532c8ef7f9fc425fcea2c9f8f5ded4b86dd160f6eef2428af4b2eaadb989ca0",\n'
509
+ ' "mswebench/mui_m_material-ui:base": "mswebench/mui_m_material-ui@sha256:8f0ca2539e9f4d116a2498980020b001da61d5cb712c760daa90bfaf76a6ec95",\n'
510
+ ' "mswebench/mui_m_material-ui:base40180": "mswebench/mui_m_material-ui@sha256:47cd636fff4d35ca1bb2ce5a65d5642d0aad8afd99642b997374abe8799f08e3",\n'
511
+ ' "mswebench/nektos_m_act:base": "mswebench/nektos_m_act@sha256:c86fe84ffbe9b85adca7c0637ae470cea5efa5c77298ce63e81a5703e2f21b9a",\n'
512
+ ' "mswebench/nuxt_m_nuxt:base": "mswebench/nuxt_m_nuxt@sha256:c282f561fea935a85e32325bafa16b53043c7b931f37d5d7dfd56f24e28606e4",\n'
513
+ ' "mswebench/openmathlib_m_openblas:base": "mswebench/openmathlib_m_openblas@sha256:43b80982eea796964c3b972e11ef62acf94620b07d3fe31719617f8dcb4c224a",\n'
514
+ ' "mswebench/prometheus_m_prometheus:base": "mswebench/prometheus_m_prometheus@sha256:9b956be0aad877cd8aca70f4242060ba5e89db3256a56ce304932ccc4a872103",\n'
515
+ ' "mswebench/reduxjs_m_redux:base": "mswebench/reduxjs_m_redux@sha256:195e698648484e437f6c39c617e5bc723974ee170ec557f99aa1ea53d9abd899",\n'
516
+ ' "mswebench/remix-run_m_react-router:base": "mswebench/remix-run_m_react-router@sha256:e58b377964c40a40b383bcfd5eb311905822dbf5d3712a9b333b3cd62ee5b47e",\n'
517
+ ' "mswebench/spotbugs_m_spotbugs:base": "mswebench/spotbugs_m_spotbugs@sha256:f829dc040cd0fd9b1854e991362260e4e5d55f3742f5ae75512738cd28a96f36",\n'
518
+ ' "mswebench/spotbugs_m_spotbugs:base-jdk-17": "mswebench/spotbugs_m_spotbugs@sha256:99484b1394da69570c1db3ddbafc0bd620dc16c759b83c58ce24bdd6fceb7ff7",\n'
519
+ ' "mswebench/sveltejs_m_svelte:base8": "mswebench/sveltejs_m_svelte@sha256:7c9770877662114728cbd77e46a19dacdb1b3b38279a850a0ae65c7f2d790774",\n'
520
+ ' "mswebench/sveltejs_m_svelte:base9": "mswebench/sveltejs_m_svelte@sha256:b13712f1032a4a007920f528ef90246e90111c29d0a845c16fbf89a3c6a1aca0",\n'
521
+ ' "mswebench/syncthing_m_syncthing:base": "mswebench/syncthing_m_syncthing@sha256:768b131dd248040e463634c08c1ffcb860134aca361c7051b12543241ebba607",\n'
522
+ ' "mswebench/tj_m_commander.js:base": "mswebench/tj_m_commander.js@sha256:6386ac92e545ca57547d1179da523a3b365464f1653738933f6c09177707de35",\n'
523
+ ' "mswebench/trpc_m_trpc:base": "mswebench/trpc_m_trpc@sha256:be994fee0f1c0e9f2f26ddbc85e7b1bfd2e50db96cd368c70e87de7ebc910d85",\n'
524
+ ' "mswebench/vuejs_m_core:base": "mswebench/vuejs_m_core@sha256:b8c7399b4bd684117e99f8569c64c2586187ebff74814e8a8ff77228256c5ad1",\n'
525
+ ' "mswebench/zeromicro_m_go-zero:base": "mswebench/zeromicro_m_go-zero@sha256:27987d56a61cd1017dda0708914479271102506d0b6997e6c8bb610e07ca875f"\n'
526
+ '}\n'
527
+ ),
528
+ 'maven_proxy.py': (
529
+ '"""Give Maven\'s bootstrap JVM the build proxy before settings.xml is loaded."""\n'
530
+ 'from contextlib import contextmanager\n'
531
+ 'import os\n'
532
+ '\n'
533
+ '\n'
534
+ '@contextmanager\n'
535
+ 'def maven_wrapper_proxy(proxy_properties):\n'
536
+ " original = os.environ.get('MAVEN_OPTS')\n"
537
+ ' # The wrapper downloads Maven before Maven can read its proxy settings.\n'
538
+ ' # Reuse the JVM proxy and bypass rules used for Gradle on this cluster.\n'
539
+ ' values = proxy_properties(os.environ)\n'
540
+ " options = ' '.join('-D' + key.removeprefix('systemProp.') + '=' + value\n"
541
+ ' for key, value in values.items())\n'
542
+ ' try:\n'
543
+ ' if options:\n'
544
+ " os.environ['MAVEN_OPTS'] = ' '.join(filter(None, (original, options)))\n"
545
+ ' yield\n'
546
+ ' finally:\n'
547
+ ' if original is None:\n'
548
+ " os.environ.pop('MAVEN_OPTS', None)\n"
549
+ ' else:\n'
550
+ " os.environ['MAVEN_OPTS'] = original\n"
551
+ ),
552
+ }
553
+
554
+ REVISION = '80de95c62ac792c99dcfa8e26569bcd7d036bdc3'
555
+ MARKER = '# Multi-SWE pinned grader runtime v4'
556
+ TASK_MEMORY_MB = {'gohugoio__hugo-12703': 8192}
557
+ SPOTBUGS_VERIFIER_FIXTURES = {
558
+ 'spotbugs__spotbugs-2872': 'spotbugsTestCases/src/java/ghIssues/Issue453.java',
559
+ 'spotbugs__spotbugs-2887': 'spotbugsTestCases/src/java/ghIssues/Issue608.java',
560
+ 'spotbugs__spotbugs-3032': 'spotbugsTestCases/src/java/ghIssues/Issue2968.java',
561
+ }
562
+
563
+
564
+ def repair_spotbugs_verifier_fixtures(files, task_id):
565
+ """Supply regression fixtures discarded by the upstream fix/test path split."""
566
+ fixture = SPOTBUGS_VERIFIER_FIXTURES.get(task_id)
567
+ target = 'setup_files/upstream/test.patch'
568
+ if fixture is None or target not in files:
569
+ return files
570
+ header = f'diff --git a/{fixture} b/{fixture}\n'.encode()
571
+ blocks = re.split(rb'(?m)(?=^diff --git )', files['solution/gold.patch'])
572
+ matches = [block for block in blocks if block.startswith(header)]
573
+ if len(matches) != 1 or b'\n--- /dev/null\n' not in matches[0]:
574
+ raise ValueError(f'Expected one new regression fixture for {task_id}')
575
+ test_patch = files[target]
576
+ if header in test_patch:
577
+ if matches[0].rstrip(b'\n') not in test_patch:
578
+ raise ValueError(f'Conflicting regression fixture for {task_id}')
579
+ return files
580
+ # The fixture is a verifier input, not the production fix. Preserve the
581
+ # original reference and assertions; apply the fixture after extraction
582
+ # resets the repository, for both oracle and unchanged-baseline trials.
583
+ return {**files, target: test_patch.rstrip(b'\n') + b'\n' + matches[0]}
584
+
585
+
586
+ def normalize_hugo_output(output):
587
+ """Separate Go test results appended to a warning without a newline."""
588
+ import re
589
+ return re.sub(
590
+ r'(?m)(?<=[^\n])(?=--- (?:PASS|FAIL|SKIP): \S+ \([0-9]+(?:\.[0-9]+)?s\)[ \t]*$)',
591
+ '\n', output)
592
+
593
+
594
+ def repair_hugo_result_lines(files, task_id):
595
+ if task_id != 'gohugoio__hugo-13005':
596
+ return files
597
+ import inspect
598
+ grade = files['tests/grade.py'].decode()
599
+ if 'def normalize_hugo_output(' in grade:
600
+ return files
601
+ anchor = ' reward_path = Path(sys.argv[3])'
602
+ if grade.count('def main():') != 1 or grade.count(anchor) != 1:
603
+ raise ValueError('Unknown Hugo grader structure')
604
+ grade = grade.replace('def main():', inspect.getsource(normalize_hugo_output) + '\n\ndef main():')
605
+ grade = grade.replace(anchor, ' output = normalize_hugo_output(output)\n' + anchor)
606
+ return {**files, 'tests/grade.py': grade.encode()}
607
+
608
+
609
+ def apply_task_memory(files, task_id):
610
+ """Apply the operator-selected budget; expected no-op OOM is reviewed separately."""
611
+ if task_id not in TASK_MEMORY_MB:
612
+ return files
613
+ updated = dict(files)
614
+ updated['task.toml'], count = re.subn(
615
+ rb'(?m)^memory_mb[ \t]*=[ \t]*\d+[ \t]*$',
616
+ f'memory_mb = {TASK_MEMORY_MB[task_id]}'.encode(), files['task.toml'])
617
+ if count != 1:
618
+ raise ValueError('Expected one task memory setting')
619
+ return updated
620
+
621
+ # Bullseye packages moved off the live mirrors after its LTS end in August 2026.
622
+ # Keep signature checking; only relax archive Release-file expiration checks.
623
+ BULLSEYE_ARCHIVE = (
624
+ '. /etc/os-release; if [ "$ID" = debian ] && [ "${VERSION_CODENAME:-}" = bullseye ]; then '
625
+ 'for source_file in /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do '
626
+ '[ -f "$source_file" ] || continue; '
627
+ "sed -i -E 's@https?://deb\\.debian\\.org/debian@https://archive.debian.org/debian@g; "
628
+ "s@https?://security\\.debian\\.org/debian-security@https://archive.debian.org/debian-security@g' \"$source_file\"; "
629
+ 'done; printf \'%s\\n\' \'Acquire::Check-Valid-Until "false";\' > /etc/apt/apt.conf.d/99-multiswe-archive; fi'
630
+ )
631
+
632
+ PYTHON_INSTALL = (
633
+ 'set -eu; python_build_dir=$(mktemp -d /tmp/multiswe-python.XXXXXX); '
634
+ 'trap \'rm -rf "$python_build_dir"\' EXIT; '
635
+ "curl --fail --location --retry 3 'https://github.com/astral-sh/python-build-standalone/releases/download/20250818/cpython-3.11.13%2B20250818-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz' "
636
+ '-o "$python_build_dir/python.tar.gz"; '
637
+ 'printf \'%s %s\\n\' 22232b7e892726fbf898e449cdae9ccfabf080319655575a8c5e54a39b553c96 "$python_build_dir/python.tar.gz" | sha256sum --check -; '
638
+ 'mkdir -p /opt/multiswe-python; tar -xzf "$python_build_dir/python.tar.gz" --strip-components=1 -C /opt/multiswe-python'
639
+ )
640
+
641
+
642
+ def docker_setup():
643
+ # Embed all setup and pins in the exported Dockerfile. No COPY dependency:
644
+ # the Apptainer deferred-build path executes RUN before replaying COPY.
645
+ requirements = EMBEDDED_FILES['grader-requirements.txt'].splitlines()
646
+ pins = ' '.join(shlex.quote(line) for line in requirements if line.strip())
647
+ commands = [
648
+ BULLSEYE_ARCHIVE,
649
+ # Complete tmux package installation in single-UID Apptainer builds.
650
+ # Privileged utmp accounting is unnecessary for task terminals.
651
+ 'if ! dpkg-statoverride --list /usr/lib/x86_64-linux-gnu/utempter/utempter; then dpkg-statoverride --add root root 0755 /usr/lib/x86_64-linux-gnu/utempter/utempter; fi',
652
+ 'apt-get update && apt-get install -y --no-install-recommends curl ca-certificates tmux && tmux -V && test -z "$(dpkg --audit)"',
653
+ PYTHON_INSTALL,
654
+ '/opt/multiswe-python/bin/python3 -m pip install --no-cache-dir --disable-pip-version-check ' + pins,
655
+ "/opt/multiswe-python/bin/python3 -c 'from multi_swe_bench.harness.dataset import Dataset; from multi_swe_bench.harness.instance import Instance'",
656
+ ]
657
+ return '\n' + MARKER + '\nUSER root\n' + ''.join('RUN ' + command + '\n' for command in commands)
658
+
659
+
660
+ def patched_image_prepare(recipe):
661
+ """Repair only the baseline install command for known Multi-SWE task families."""
662
+ script = recipe['files']['prepare.sh']
663
+ if recipe['repo'] == 'material-ui':
664
+ # The pinned Multi-SWE material-ui verifiers run unit tests only.
665
+ script = 'export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1\n' + script
666
+ # These baselines use Puppeteer 1.x, which predates the
667
+ # PUPPETEER_SKIP_DOWNLOAD environment variable.
668
+ if recipe['base_sha'] in {
669
+ '0543dd7bd0f8bacf850780e16d48b0c8aa6f4df7',
670
+ 'dfc94e03d391384155cbdd1a0e3b0fe16e2e1042',
671
+ '161fb8565f532df5766b0e152f21e4a88a8d8baa'}:
672
+ script = 'export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1\n' + script
673
+ if recipe['repo'] == 'async':
674
+ # Some pinned commits have package manifests newer than their lockfiles.
675
+ script = re.sub(r'(?<!\S)npm ci\b', 'npm install --no-audit --no-fund', script)
676
+ if recipe['repo'] == 'redux' and re.search(r'(?m)^\s*yarn install\b', script):
677
+ # Skip only the legacy root prepublish hook for dependency installation.
678
+ script = re.sub(r'\s*\|\|\s*true\b', '', script)
679
+ disabled_hooks = 'delete p.scripts.prepublish;'
680
+ if recipe['base_sha'] in {
681
+ 'beb1fc29ca6ebe45226caa3a064476072cd9ed26',
682
+ '51365e5b4a5c1b0b7ff4f40b89452eb5edf4b0b9'}:
683
+ # These commits run the root test/build hook through `prepare`
684
+ # during yarn install. Stage 3 runs the actual task tests later.
685
+ disabled_hooks += 'delete p.scripts.prepare;'
686
+ disable = ('const fs=require("fs");const p=JSON.parse(fs.readFileSync("package.json"));'
687
+ + disabled_hooks + 'fs.writeFileSync("package.json",JSON.stringify(p));')
688
+ install = ('( backup=$(mktemp); cp package.json "$backup"; '
689
+ 'trap \'cp "$backup" package.json; rm -f "$backup"\' EXIT; '
690
+ 'node -e ' + shlex.quote(disable) + '; yarn install )')
691
+ script = re.sub(r'(?m)^yarn install\s*$', lambda _: install, script)
692
+ return script
693
+
694
+
695
+ def patch_files(files):
696
+ """Keep task/reference semantics; make grader infrastructure failures explicit."""
697
+ files = dict(files)
698
+ docker = files['environment/Dockerfile'].decode()
699
+ if MARKER in docker:
700
+ return files
701
+ test = files['tests/test.sh'].decode()
702
+ install = [line for line in test.splitlines() if line.startswith('python3 -m pip install --target /tmp/multiswe-grader ')]
703
+ if len(install) != 1 or 'python3 /tests/grade.py ' not in test:
704
+ raise ValueError('Unexpected Multi-SWE verifier layout; refusing partial repair')
705
+ grade = files['tests/grade.py'].decode()
706
+ error_line = ' print(f"Multi-SWE grader error: {type(exc).__name__}: {exc}", file=sys.stderr)'
707
+ if grade.count(error_line) != 1:
708
+ raise ValueError('Unexpected grader error handling')
709
+ grade = grade.replace(error_line, error_line + '\n reward_path.unlink(missing_ok=True)\n raise')
710
+ import inspect
711
+ grade = grade.replace('def main():', inspect.getsource(expected_missing_source) + '\n\ndef main():')
712
+ grade = grade.replace(' reward = float(report.valid',
713
+ ' if report.fix_patch_result.all_count == 0 and not expected_missing_source(row, output):\n'
714
+ ' raise RuntimeError("Verifier produced no parsed test results; see test_output.txt")\n'
715
+ ' reward = float(report.valid')
716
+ grade = grade.replace(' print(report.error_msg or "valid report")',
717
+ ' missing = {field: sorted(set(getattr(dataset, field)) - set(getattr(report, field)))\n'
718
+ ' for field in ("p2p_tests", "f2p_tests", "s2p_tests", "n2p_tests")}\n'
719
+ ' print(report.error_msg or ("Missing required test results: " + json.dumps(missing) if not reward else "valid report"))')
720
+ test = test.replace('set -uo pipefail', 'set -euo pipefail')
721
+ test = test.replace(install[0] + '\n', '')
722
+ test = test.replace('export PYTHONPATH=/tmp/multiswe-grader:${PYTHONPATH:-}\n', '')
723
+ test = test.replace('mkdir -p /logs/verifier\n', 'mkdir -p /logs/verifier\nrm -f /logs/verifier/reward.json\n')
724
+ test = test.replace('python3 /tests/grade.py ', '/opt/multiswe-python/bin/python3 -I /tests/grade.py ')
725
+ files.update({
726
+ 'environment/Dockerfile': (docker.rstrip() + '\n' + docker_setup()).encode(),
727
+ 'tests/test.sh': test.encode(), 'tests/grade.py': grade.encode(),
728
+ })
729
+ return files
730
+
731
+
732
+ def export_shared_recipes(rows):
733
+ """Use the pinned upstream builder, including its per-PR recipe selection."""
734
+ from importlib.metadata import version
735
+ from dataclasses import fields
736
+ from multi_swe_bench.harness.pull_request import PullRequest
737
+ from multi_swe_bench.harness.image import Config, Image
738
+ from multi_swe_bench.harness.instance import Instance
739
+ if version('multi-swe-bench') != '1.1.2':
740
+ raise ValueError('Shared-image conversion requires multi-swe-bench==1.1.2')
741
+ keys = {f.name for f in fields(PullRequest)}
742
+ result = {}
743
+ for task_id, row in rows.items():
744
+ try:
745
+ pr = PullRequest.from_dict({k: v for k, v in row.items() if k in keys})
746
+ image = Instance.create(pr, Config(need_clone=True, global_env=None, clear_env=False)).dependency()
747
+ base = image.dependency()
748
+ if not isinstance(base, Image):
749
+ raise ValueError('No upstream shared Image recipe')
750
+ files = image.files()
751
+ names = [f.name for f in files]
752
+ if len(names) != len(set(names)) or any(not re.fullmatch(r'[A-Za-z0-9_.-]+', n) for n in names):
753
+ raise ValueError('Unsupported recipe filenames')
754
+ # Deliberately support only the exact COPY + prepare pattern audited
755
+ # in this source. Extra RUN/ENV/USER/etc. need explicit review.
756
+ actual = [l.strip() for l in image.dockerfile().splitlines() if l.strip()]
757
+ expected = ['FROM ' + base.image_full_name()] + ['COPY ' + n + ' /home/' for n in names] + ['RUN bash /home/prepare.sh']
758
+ if actual != expected:
759
+ raise ValueError('Unsupported upstream Dockerfile instructions')
760
+ if not {'prepare.sh', 'test.patch', 'fix-run.sh'}.issubset(names):
761
+ raise ValueError('Incomplete upstream recipe')
762
+ result[task_id] = {
763
+ 'original_image': image.image_full_name(), 'base': base.image_full_name(),
764
+ 'base_sha': pr.base.sha, 'repo': pr.repo,
765
+ # Never export the reference answer into agent-visible setup.
766
+ 'files': {f.name: f.content for f in files if f.name != 'fix.patch'},
767
+ }
768
+ except Exception as exc:
769
+ result[task_id] = {'error': str(exc)}
770
+ return result
771
+
772
+
773
+ ELECTRON_PROXY = '''# Electron's downloader requires explicit proxy opt-in.
774
+ electron_https_proxy=${https_proxy:-${HTTPS_PROXY:-${http_proxy:-${HTTP_PROXY:-}}}}
775
+ electron_http_proxy=${http_proxy:-${HTTP_PROXY:-$electron_https_proxy}}
776
+ if [ -n "$electron_https_proxy" ] || [ -n "${GLOBAL_AGENT_HTTPS_PROXY:-}${GLOBAL_AGENT_HTTP_PROXY:-}" ]; then
777
+ export ELECTRON_GET_USE_PROXY=${ELECTRON_GET_USE_PROXY:-1}
778
+ export GLOBAL_AGENT_HTTPS_PROXY=${GLOBAL_AGENT_HTTPS_PROXY:-$electron_https_proxy}
779
+ export GLOBAL_AGENT_HTTP_PROXY=${GLOBAL_AGENT_HTTP_PROXY:-$electron_http_proxy}
780
+ export GLOBAL_AGENT_NO_PROXY=${GLOBAL_AGENT_NO_PROXY:-${no_proxy:-${NO_PROXY:-}}}
781
+ fi
782
+ unset electron_https_proxy electron_http_proxy
783
+ '''
784
+
785
+
786
+ PREINSTALLED_REPOS = {
787
+ 'insomnia', 'github-readme-stats', 'async', 'trpc', 'redux', 'material-ui',
788
+ 'dayjs', 'react-router', 'checkstyle', 'fastjson2', 'junit5', 'logstash', 'mockito', 'spotbugs',
789
+ }
790
+
791
+ JUNIT_RUNTIME_SNAPSHOT_BASELINES = {
792
+ '2e27ea70bd9ad30049a922bce882719e5e726f81',
793
+ '686e49f95918a4ee07e366afb5cfd1764696f81d',
794
+ '511ab7d04dd5deec372157381b37a42003778b18',
795
+ '28a261e1211965ce41d418a0a8bccf17fae9aeec',
796
+ 'bebff4123850e39517ac67dd31bbb0eff41fa0fc',
797
+ }
798
+
799
+
800
+ def preinstalled_docker(recipe):
801
+ # Keep the already-built cache keys for repositories whose baseline
802
+ # installer has not changed. The current shared helper adds setup paths for
803
+ # Fastjson2 and JUnit 5; embedding those branches in every image would
804
+ # invalidate unrelated image caches.
805
+ helper_name = ('preinstall.py' if recipe['repo'] in ('fastjson2', 'junit5')
806
+ else 'preinstall_cache_v8.py')
807
+ helper = EMBEDDED_FILES[helper_name]
808
+ # These baselines also failed with one worker: resolving a test classpath
809
+ # can realize more tasks and mutate Gradle's live task collection. Iterate
810
+ # a snapshot instead. Keep other baselines' image cache keys unchanged.
811
+ if recipe['repo'] == 'junit5' and recipe['base_sha'] in JUNIT_RUNTIME_SNAPSHOT_BASELINES:
812
+ helper = helper.replace('--max-workers 2', '--max-workers 1')
813
+ helper = helper.replace(
814
+ 'p.tasks.withType(org.gradle.api.tasks.testing.Test).each { t ->',
815
+ 'p.tasks.withType(org.gradle.api.tasks.testing.Test).toList().each { t ->')
816
+ helper = helper.replace('./gradlew --no-daemon', './gradlew --stacktrace --no-daemon')
817
+ proxy = EMBEDDED_FILES['gradle_proxy.py'].split("\nif __name__ == '__main__':", 1)[0]
818
+ proxy = proxy.replace('def main():', 'def configure_gradle_proxy():')
819
+ invocation = 'preinstall(json.loads(sys.argv[1]), configure_gradle_proxy)\n'
820
+ if recipe['repo'] == 'fastjson2':
821
+ helper += '\n' + EMBEDDED_FILES['maven_proxy.py']
822
+ invocation = 'with maven_wrapper_proxy(properties):\n ' + invocation
823
+ program = proxy + '\n' + helper + '\n' + invocation
824
+ # Only baseline preparation enters the image, never the solution or test patch.
825
+ spec = {key: recipe[key] for key in ('repo', 'base_sha')}
826
+ spec['prepare'] = patched_image_prepare(recipe)
827
+ spec['electron_proxy'] = ELECTRON_PROXY if recipe['repo'] == 'insomnia' else ''
828
+ readable_cache = ''
829
+ if recipe['repo'] in ('mockito', 'spotbugs'):
830
+ # Gradle creates owner-only directories during the root image build.
831
+ # The runtime copies the baked workdir before starting the root-mapped
832
+ # task container, so its reader must be able to traverse these caches.
833
+ root = '/home/' + recipe['repo']
834
+ readable_cache = ('RUN set -eu; for cache in ' + root + '/.gradle '
835
+ + root + '/buildSrc/build; do '
836
+ 'if [ -d "$cache" ]; then chmod -R a+rX "$cache"; fi; done\n')
837
+ return ('\n# Install baseline dependencies once, for this exact source commit.\n'
838
+ 'ENV GRADLE_USER_HOME=/opt/multiswe-gradle\n'
839
+ + ('ENV MAVEN_USER_HOME=/opt/multiswe-maven-user\n' if recipe['repo'] == 'fastjson2' else '')
840
+ + 'RUN /opt/multiswe-python/bin/python3 -c ' + shlex.quote('exec(' + repr(program) + ')')
841
+ + ' ' + shlex.quote(json.dumps(spec, sort_keys=True)) + '\n' + readable_cache)
842
+
843
+
844
+ def share_image(files, recipe, locks):
845
+ """Move the audited upstream PR layer to idempotent task initialization."""
846
+ if 'error' in recipe:
847
+ raise ValueError(recipe['error'])
848
+ pinned = locks.get(recipe['base'])
849
+ if not pinned or not re.fullmatch(r'[a-z0-9_./-]+@sha256:[a-f0-9]{64}', pinned):
850
+ raise ValueError('Missing digest-pinned shared base: ' + recipe['base'])
851
+ docker = files['environment/Dockerfile'].decode()
852
+ old = 'FROM ' + recipe['original_image']
853
+ if docker.splitlines()[0] != old:
854
+ raise ValueError('Upstream recipe does not match task image')
855
+ if any(n.startswith('setup_files/') for n in files):
856
+ raise ValueError('Existing task setup requires review')
857
+ if not re.fullmatch(r'[a-f0-9]{40}', recipe['base_sha']):
858
+ raise ValueError('Invalid repository commit')
859
+ if not re.fullmatch(r'[A-Za-z0-9_.-]+', recipe['repo']):
860
+ raise ValueError('Invalid repository name')
861
+ recipe = repair_recipe(recipe)
862
+ updated = dict(files)
863
+ updated['environment/Dockerfile'] = docker.replace(old, 'FROM ' + pinned, 1).encode()
864
+ if recipe['repo'] == 'logstash':
865
+ # Azul renamed its signed Release metadata. Accept only those fields for
866
+ # the Azul source, without disabling signature or package verification.
867
+ azul = ('RUN set -eu; azul_list=$(mktemp --suffix=.list); '
868
+ 'trap \'rm -f "$azul_list"\' EXIT; '
869
+ 'for source in /etc/apt/sources.list /etc/apt/sources.list.d/*.list; do '
870
+ '[ -f "$source" ] || continue; '
871
+ 'grep -E \'^deb[[:space:]].*https?://repos.azul.com/zulu/deb([/[:space:]]|$)\' "$source" >> "$azul_list" || true; done; '
872
+ 'if [ -s "$azul_list" ]; then apt-get -o Dir::Etc::sourcelist="$azul_list" '
873
+ '-o Dir::Etc::sourceparts=- --allow-releaseinfo-change-origin '
874
+ '--allow-releaseinfo-change-label update; fi\n')
875
+ updated['environment/Dockerfile'] = updated['environment/Dockerfile'].replace(
876
+ (MARKER + '\nUSER root\n').encode(), (MARKER + '\nUSER root\n' + azul).encode(), 1)
877
+ preinstalled = recipe['repo'] in PREINSTALLED_REPOS
878
+ if preinstalled:
879
+ updated['environment/Dockerfile'] += preinstalled_docker(recipe).encode()
880
+ recipe['files']['prepare.sh'] = ('#!/bin/bash\nset -eu\ncd /home/' + recipe['repo'] +
881
+ '\n[ "$(git rev-parse HEAD)" = ' + recipe['base_sha'] + ' ]\n')
882
+ proxy_setup = ELECTRON_PROXY if recipe['original_image'].startswith('mswebench/kong_m_insomnia:') else ''
883
+ identity = hashlib.sha256((json.dumps(recipe, sort_keys=True) + proxy_setup).encode()).hexdigest()
884
+ marker = '/setup_files/.multiswe-' + identity
885
+ lines = ['#!/bin/bash', 'set -euo pipefail',
886
+ 'if [ -f ' + marker + ' ]; then exit 0; fi']
887
+ if not preinstalled and any('./gradlew ' in content for content in recipe['files'].values()):
888
+ updated['setup_files/gradle_proxy.py'] = EMBEDDED_FILES['gradle_proxy.py'].encode()
889
+ lines.append('/opt/multiswe-python/bin/python3 /setup_files/gradle_proxy.py')
890
+ if proxy_setup:
891
+ lines.extend(proxy_setup.rstrip().splitlines())
892
+ for name, content in sorted(recipe['files'].items()):
893
+ if not re.fullmatch(r'[A-Za-z0-9_.-]+', name) or name == 'fix.patch':
894
+ raise ValueError('Invalid or answer-bearing setup filename')
895
+ updated['setup_files/upstream/' + name] = content.encode()
896
+ lines.append('install -m 0644 ' + shlex.quote('/setup_files/upstream/' + name) + ' ' + shlex.quote('/home/' + name))
897
+ lines += ['rm -f /home/fix.patch', 'cd ' + shlex.quote('/home/' + recipe['repo']),
898
+ 'bash /home/prepare.sh',
899
+ '[ "$(git rev-parse HEAD)" = ' + recipe['base_sha'] + ' ]',
900
+ 'git ls-files --others --exclude-standard -z > "$(git rev-parse --git-path multiswe-setup-untracked)"',
901
+ 'touch ' + marker]
902
+ updated['setup_files/setup.sh'] = ('\n'.join(lines) + '\n').encode()
903
+ solve = updated['solution/solve.sh'].decode()
904
+ updated['solution/solve.sh'] = solve.replace('set -e\n', 'set -e\nbash /setup_files/setup.sh\n', 1).encode()
905
+ if b'bash /setup_files/setup.sh\n' not in updated['solution/solve.sh']:
906
+ raise ValueError('Unknown reference entrypoint')
907
+ updated['instruction.md'] = updated['instruction.md'].rstrip() + b'\n\nBefore working on the task, run `bash /setup_files/setup.sh`. It initializes this task once and safely does nothing on subsequent calls.\n'
908
+ if 'tests/extract_fix_patch.sh' in updated:
909
+ updated['tests/extract_fix_patch.py'] = EMBEDDED_FILES['extract_fix_patch.py'].encode()
910
+ updated['tests/extract_fix_patch.sh'] = b'#!/bin/bash\nset -euo pipefail\nexec /opt/multiswe-python/bin/python3 /tests/extract_fix_patch.py "$@"\n'
911
+ if recipe['repo'] in ('dayjs', 'darkreader', 'spotbugs', 'mockito') and 'task.toml' in updated:
912
+ updated['task.toml'] = updated['task.toml'].replace(b'memory_mb = 4096', b'memory_mb = 8192')
913
+ if recipe['repo'] == 'nuxt':
914
+ grade = updated['tests/grade.py'].decode()
915
+ # The pinned parser uses the first token of each result line. Verbose
916
+ # Vitest prefixes individual tests with their file, while the original
917
+ # dataset also records suite names from default-reporter slow-test lines.
918
+ import inspect
919
+ grade = grade.replace('def main():', inspect.getsource(normalize_nuxt_output) + '\n\ndef main():')
920
+ grade = grade.replace(' reward_path = Path(sys.argv[3])',
921
+ ' output = normalize_nuxt_output(output)\n reward_path = Path(sys.argv[3])')
922
+ updated['tests/grade.py'] = grade.encode()
923
+ if recipe['repo'] == 'trpc':
924
+ import inspect
925
+ grade = updated['tests/grade.py'].decode()
926
+ grade = grade.replace('def main():', inspect.getsource(normalize_trpc_output) + '\n\ndef main():')
927
+ grade = grade.replace(' reward_path = Path(sys.argv[3])',
928
+ ' output = normalize_trpc_output(output)\n reward_path = Path(sys.argv[3])')
929
+ updated['tests/grade.py'] = grade.encode()
930
+ return updated
931
+
932
+
933
+ def expected_missing_source(row, output):
934
+ """Recognize a baseline import failure for a source file supplied by the fix."""
935
+ import posixpath
936
+ import re
937
+ baseline = row.get('test_patch_result', {})
938
+ if any(baseline.get(k, 0) for k in ('passed_count', 'failed_count', 'skipped_count')):
939
+ return False
940
+ match = re.search(r"Cannot find module '([^']+)'\nRequire stack:\n- ([^\n]+)", output)
941
+ if not match or not match[1].startswith('.'):
942
+ return False
943
+ missing = posixpath.normpath(posixpath.join(posixpath.dirname(match[2]), match[1]))
944
+ added = re.findall(r'(?m)^--- /dev/null\n\+\+\+ b/([^\n]+)', row.get('fix_patch', ''))
945
+ if any('/home/' + row.get('repo', '') + '/' + name == missing + suffix
946
+ for name in added for suffix in ('', '.js', '.jsx', '.ts', '.tsx', '/index.js', '/index.ts')):
947
+ return True
948
+ # The fix can also remove a broken import rather than add its target.
949
+ importer = match[2].removeprefix('/home/' + row.get('repo', '') + '/')
950
+ for block in row.get('fix_patch', '').split('diff --git '):
951
+ if '\n--- a/' + importer + '\n' not in block:
952
+ continue
953
+ for line in block.splitlines():
954
+ if line.startswith('-') and re.search(r'''(?:from\s*|require\s*\(\s*|import\s*)['"]''' + re.escape(match[1]) + r'''['"]''', line):
955
+ return True
956
+ return False
957
+
958
+
959
+ def normalize_trpc_output(output):
960
+ """The pinned tRPC parser requires ANSI color even for non-interactive logs."""
961
+ import re
962
+ lines = []
963
+ for line in output.splitlines():
964
+ plain = re.sub(r'\x1b\[[0-9;]*m', '', line).strip()
965
+ match = re.match(r'^(?:@trpc/tests:test-ci: )?\[0\]\s+([✓❯])\s+(?:\|tests\|\s+)?([^|\s]\S*)', plain)
966
+ if match:
967
+ color = '32' if match[1] == '✓' else '33'
968
+ line = f'[0] \x1b[{color}m{match[1]}\x1b[39m \x1b[32m|tests|\x1b[39m {match[2]}'
969
+ lines.append(line)
970
+ return '\n'.join(lines)
971
+
972
+
973
+ def normalize_nuxt_output(output):
974
+ """Map verbose Vitest results to upstream identifiers, with failures winning."""
975
+ import re
976
+ statuses = {}
977
+ for line in output.splitlines():
978
+ line = re.sub(r'\x1b\[[0-9;]*m', '', line).strip()
979
+ match = re.match(r'^([✓×❯])\s+(\S+)(.*)', line)
980
+ if not match:
981
+ continue
982
+ names = [match[2]]
983
+ detail = re.match(r'^ > (\S+)', match[3])
984
+ if detail and re.search(r'\.(test|spec)\.', match[2]):
985
+ names.append(detail[1])
986
+ for name in names:
987
+ statuses[name] = statuses.get(name, True) and match[1] == '✓'
988
+ return '\n'.join(('✓' if passed else '❯') + ' ' + name + ' result'
989
+ for name, passed in statuses.items())
990
+
991
+
992
+ def repair_recipe(recipe):
993
+ """Repair runtime/test invocation, without changing tests or their expectations."""
994
+ recipe = copy.deepcopy(recipe)
995
+ for name in ('prepare.sh', 'fix-run.sh'):
996
+ content = recipe['files'].get(name, '')
997
+ content = re.sub(r'--max-workers\s+\d+\s*', '', content)
998
+ content = re.sub(r'(?m)^(\./gradlew )(.*)$', r'\1--no-daemon --max-workers 2 \2', content)
999
+ recipe['files'][name] = content
1000
+ if recipe['repo'] == 'checkstyle':
1001
+ recipe['files']['fix-run.sh'] = recipe['files']['fix-run.sh'].replace(
1002
+ 'mvn ', 'mvn -s /opt/multiswe-maven-settings.xml -Dmaven.repo.local=/opt/multiswe-maven ')
1003
+ if recipe['repo'] == 'fastjson2':
1004
+ recipe['files']['fix-run.sh'] = recipe['files']['fix-run.sh'].replace(
1005
+ './mvnw ', './mvnw -s /opt/multiswe-maven-settings.xml -Dmaven.repo.local=/opt/multiswe-maven ')
1006
+ if recipe['repo'] == 'junit5':
1007
+ recipe['files']['fix-run.sh'] = recipe['files']['fix-run.sh'].replace(
1008
+ './gradlew ', './gradlew --init-script /opt/multiswe-junit-local.gradle ')
1009
+ run = recipe['files']['fix-run.sh']
1010
+ # git apply rejects an empty fix.patch, preventing no-op tests from running.
1011
+ def split_apply(match):
1012
+ command = match.group(0).replace(' /home/fix.patch', '')
1013
+ fix_command = command.replace('/home/test.patch', '/home/fix.patch')
1014
+ return command + '\nif [ -s /home/fix.patch ]; then ' + fix_command + '; fi'
1015
+ run = re.sub(r'(?m)^git apply[^\n]* /home/test\.patch /home/fix\.patch[ \t]*$', split_apply, run)
1016
+ if recipe['repo'] == 'darkreader':
1017
+ run = run.replace('npm run test:unit -- ', 'npm run test:unit -- --runInBand ')
1018
+ if recipe['repo'] == 'dayjs':
1019
+ # npm test runs Jest repeatedly for four time zones. Limit every invocation.
1020
+ limit = "node -e 'const fs=require(\"fs\"); const p=JSON.parse(fs.readFileSync(\"package.json\")); for(const k of Object.keys(p.scripts||{})) p.scripts[k]=p.scripts[k].replace(/\\bjest\\b/g, \"jest --runInBand\"); fs.writeFileSync(\"package.json\", JSON.stringify(p));'\n"
1021
+ run = run.replace('npm test ', limit + 'npm test ')
1022
+ if recipe['repo'] == 'nuxt':
1023
+ run = run.replace('pnpm test:unit -- --verbose', 'pnpm test:unit --reporter=verbose')
1024
+ run = run.replace('pnpm test:runtime --no-watch', 'pnpm test:runtime --no-watch --reporter=verbose')
1025
+ if recipe['repo'] == 'axios':
1026
+ # Local proxy tests must control their own proxy environment. Node 20's
1027
+ # new family-autoselection default breaks this older custom lookup API.
1028
+ run = run.replace('npm test ', 'unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY all_proxy ALL_PROXY no_proxy NO_PROXY npm_config_proxy npm_config_https_proxy npm_config_noproxy\n'
1029
+ 'if node --help | grep -q -- --network-family-autoselection; then\n'
1030
+ ' export NODE_OPTIONS="${NODE_OPTIONS:-} --no-network-family-autoselection"\nfi\n'
1031
+ 'npm test ')
1032
+ recipe['files']['fix-run.sh'] = run
1033
+ return recipe
1034
+
1035
+
1036
+ def blob_files(blob):
1037
+ with tarfile.open(fileobj=io.BytesIO(blob)) as archive:
1038
+ return {m.name: archive.extractfile(m).read() for m in archive if m.isfile()}
1039
+
1040
+
1041
+ def patch_blob(blob, recipe=None, locks=None, task_id=None):
1042
+ with tarfile.open(fileobj=io.BytesIO(blob)) as archive:
1043
+ members = archive.getmembers()
1044
+ files = {}
1045
+ for member in members:
1046
+ name = PurePosixPath(member.name)
1047
+ if name.is_absolute() or '..' in name.parts or not (member.isfile() or member.isdir()):
1048
+ raise ValueError('Unsafe task archive member')
1049
+ if member.isfile():
1050
+ if str(name) in files:
1051
+ raise ValueError('Duplicate task archive member')
1052
+ files[str(name)] = archive.extractfile(member).read()
1053
+ updated = patch_files(files)
1054
+ if recipe is not None:
1055
+ updated = share_image(updated, recipe, locks or {})
1056
+ updated = apply_task_memory(updated, task_id)
1057
+ updated = repair_spotbugs_verifier_fixtures(updated, task_id)
1058
+ updated = repair_hugo_result_lines(updated, task_id)
1059
+ if updated == files:
1060
+ return blob
1061
+ output = io.BytesIO()
1062
+ with tarfile.open(fileobj=output, mode='w') as archive:
1063
+ for member in members:
1064
+ member = copy.copy(member)
1065
+ if member.isfile():
1066
+ data = updated.pop(str(PurePosixPath(member.name)))
1067
+ member.size = len(data)
1068
+ archive.addfile(member, io.BytesIO(data))
1069
+ else:
1070
+ archive.addfile(member)
1071
+ for name, data in sorted(updated.items()):
1072
+ member = tarfile.TarInfo(name)
1073
+ member.mode = 0o644
1074
+ member.size = len(data)
1075
+ archive.addfile(member, io.BytesIO(data))
1076
+ return output.getvalue()
1077
+
1078
+
1079
+ def main():
1080
+ import pyarrow as pa
1081
+ import pyarrow.parquet as pq
1082
+ from data.utils.patch_reporting import write_patch_report
1083
+ parser = argparse.ArgumentParser(description=__doc__)
1084
+ parser.add_argument('--source', type=Path, required=True)
1085
+ parser.add_argument('--output', type=Path, required=True)
1086
+ parser.add_argument('--share-images', action='store_true', help='experimental: move audited upstream PR preparation into setup_files')
1087
+ parser.add_argument('--base-image-lock', type=Path, help='Override the embedded digest-pinned base-image mapping with a JSON file')
1088
+ parser.add_argument('--recipe-python', default=sys.executable, help='Python with multi-swe-bench==1.1.2 installed')
1089
+ args = parser.parse_args()
1090
+ locks = json.loads(args.base_image_lock.read_text() if args.base_image_lock
1091
+ else EMBEDDED_FILES['base-images.lock.json']) if args.share_images else {}
1092
+ sources = [args.source] if args.source.is_file() else sorted(args.source.glob('*.parquet'))
1093
+ if not sources:
1094
+ raise ValueError('No source Parquets found')
1095
+ if args.output.exists():
1096
+ raise ValueError('Use a new output directory')
1097
+ args.output.mkdir(parents=True)
1098
+ for source in sources:
1099
+ table = pq.read_table(source)
1100
+ rows = table.to_pylist()
1101
+ labels, reasons = {}, {}
1102
+ recipes, unresolved = {}, {}
1103
+ if args.share_images:
1104
+ row_data = {r['path']: json.loads(blob_files(r['task_binary'])['tests/row.json']) for r in rows}
1105
+ generated = subprocess.run([args.recipe_python, str(Path(__file__).resolve()), '--export-shared-recipes'],
1106
+ input=json.dumps(row_data), capture_output=True, text=True, check=True)
1107
+ recipes = json.loads(generated.stdout)
1108
+ for row in rows:
1109
+ try:
1110
+ patched = patch_blob(row['task_binary'], recipes.get(row['path']), locks, task_id=row['path'])
1111
+ except ValueError as exc:
1112
+ if not args.share_images:
1113
+ raise
1114
+ unresolved[row['path']] = str(exc)
1115
+ patched = patch_blob(row['task_binary'])
1116
+ if patched != row['task_binary']:
1117
+ labels[row['path']] = ['runtime-and-verifier-repair']
1118
+ reasons[row['path']] = ('Bake a pinned, isolated grader and required network tools into the image; '
1119
+ 'repair Debian archive downloads and report verifier infrastructure failures explicitly.')
1120
+ if row['path'] in recipes and row['path'] not in unresolved:
1121
+ reasons[row['path']] += (' Use a digest-pinned base image. '
1122
+ 'Exclude setup artifacts from solution patches, batch Git filenames safely, '
1123
+ 'and run tests when the solution patch is empty.')
1124
+ recipe = recipes[row['path']]
1125
+ if recipe['repo'] in PREINSTALLED_REPOS:
1126
+ reasons[row['path']] += ' Preinstall baseline dependencies in the image for the exact source commit; remove dependency installation and baseline test execution from task setup.'
1127
+ if recipe['repo'] in ('mockito', 'spotbugs'):
1128
+ reasons[row['path']] += ' Make baked Gradle workspace caches readable and traversable for runtime workdir copying, preserving contents and write permissions.'
1129
+ if recipe['repo'] == 'redux':
1130
+ reasons[row['path']] += ' Suppress only the root prepublish release/test hook during dependency installation and restore package.json afterward.'
1131
+ if recipe['repo'] == 'material-ui':
1132
+ reasons[row['path']] += ' Skip Playwright browser downloads; these tasks use unit-test verifiers.'
1133
+ if recipe['repo'] == 'async':
1134
+ reasons[row['path']] += ' Reconcile stale package-lock entries with npm install while retaining existing locked versions.'
1135
+ if recipe['repo'] == 'junit5':
1136
+ reasons[row['path']] += ' Resolve the matching Vintage engine dependency from the baseline project during installation and verification; verify direct Gradle plugin downloads after proxy rate limits.'
1137
+ if recipe['base_sha'] in JUNIT_RUNTIME_SNAPSHOT_BASELINES:
1138
+ reasons[row['path']] += ' Snapshot Gradle test tasks before resolving their runtime dependencies during image preparation, avoiding mutation of the live task collection; preserve the verifier test command.'
1139
+ if recipe['repo'] == 'logstash':
1140
+ reasons[row['path']] += ' Accept the Azul repository Origin and Label metadata rename only for its signed apt source.'
1141
+ else:
1142
+ reasons[row['path']] += ' Initialize the task checkout in setup while sharing its compatible base image.'
1143
+ if recipe['repo'] in ('dayjs', 'darkreader'):
1144
+ reasons[row['path']] += ' Run Jest serially with an 8 GiB task allowance to avoid worker memory kills.'
1145
+ if recipe['repo'] in ('nuxt', 'trpc'):
1146
+ reasons[row['path']] += ' Make actual test results parseable despite reporter verbosity or ANSI-color differences.'
1147
+ if recipe['repo'] == 'axios':
1148
+ reasons[row['path']] += ' Let local proxy tests control their own proxy environment.'
1149
+ if row['path'] in TASK_MEMORY_MB and patched != row['task_binary']:
1150
+ labels[row['path']].append('task-memory-budget')
1151
+ reasons[row['path']] += (' Set this task to the operator-selected 8 GiB budget for the reference solution; '
1152
+ 'its expected no-op assertion-output OOM is accepted only through individual review.')
1153
+ if (row['path'] in SPOTBUGS_VERIFIER_FIXTURES and args.share_images
1154
+ and row['path'] not in unresolved and patched != row['task_binary']):
1155
+ labels.setdefault(row['path'], []).append('reference-test-fixture')
1156
+ reasons[row['path']] = reasons.get(row['path'], '') + (
1157
+ ' Include the original Java regression fixture in the verifier test patch so '
1158
+ 'the fix/test path filter cannot discard it before compilation; preserve the '
1159
+ 'reference implementation and all test assertions.')
1160
+ if row['path'] == 'gohugoio__hugo-13005' and patched != row['task_binary']:
1161
+ labels.setdefault(row['path'], []).append('verifier-log-parser')
1162
+ reasons[row['path']] = reasons.get(row['path'], '') + (
1163
+ ' Separate existing Go test result markers appended to warnings before parsing, '
1164
+ 'preserving PASS/FAIL/SKIP statuses and required-test checks.')
1165
+ row['task_binary'] = patched
1166
+ output = args.output / source.name
1167
+ pq.write_table(pa.Table.from_pylist(rows, schema=table.schema), output)
1168
+ write_patch_report(source, output, patcher=__file__, source={
1169
+ 'dataset': 'PrimeIntellect/Multi-SWE-RL-Verified', 'revision': REVISION,
1170
+ 'url': f'https://huggingface.co/datasets/PrimeIntellect/Multi-SWE-RL-Verified/tree/{REVISION}'},
1171
+ dropped={}, change_labels=labels, change_reasons=reasons, unresolved=unresolved,
1172
+ patches=[{'version': 'multiswe-preinstalled-dependencies-v10', 'python': '3.11.13', 'grader': '1.1.2', 'share_images': args.share_images,
1173
+ 'helper_sha256': {name: hashlib.sha256(EMBEDDED_FILES[name].encode()).hexdigest()
1174
+ for name in ('extract_fix_patch.py', 'gradle_proxy.py', 'preinstall.py', 'preinstall_cache_v8.py')},
1175
+ 'base_image_lock': locks if args.share_images else {}}])
1176
+ if args.share_images:
1177
+ (args.output / (source.stem + '.shared-images.json')).write_text(json.dumps({
1178
+ 'tasks': len(rows), 'converted': len(recipes) - len(unresolved), 'unresolved': unresolved,
1179
+ 'unique_dockerfiles': len({hashlib.sha256(blob_files(r['task_binary'])['environment/Dockerfile']).hexdigest() for r in rows}),
1180
+ }, indent=2) + '\n')
1181
+ print(f'{output}: {len(rows)} tasks, {len(labels)} repaired, none dropped')
1182
+
1183
+
1184
+ if __name__ == '__main__':
1185
+ if sys.argv[1:] == ['--export-shared-recipes']:
1186
+ print(json.dumps(export_shared_recipes(json.load(sys.stdin))))
1187
+ else:
1188
+ main()
multiswe_v1/tasks.manifest.json ADDED
The diff for this file is too large to render. See raw diff
 
multiswe_v1/tasks.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b434abb4e00bd51054dbb05d0e00d05f779e5fb0cb141d279dc81b930cf7234f
3
+ size 104840140