FWeindel commited on
Commit
591cd1b
·
verified ·
1 Parent(s): 7a5092f

Multi-SWE v1: reinstall the upstream test harness from /tests before grading and add the timeout sentence

Browse files

All 1,872 kept tasks adjusted from multiswe_v1 at d6372d8 with patch.py --release-repair. Stages 2 and 3 have not yet been run on the adjusted tasks.

multiswe_v1/README.md CHANGED
@@ -34,7 +34,7 @@ Real repository issue-solving tasks with a base checkout, issue instructions, up
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
 
 
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,872 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. Adjusted all 1,872 kept tasks after validation: the verifier now reinstalls the upstream test scripts from `/tests` before grading, because the copies in `/home` could be edited by the agent, and the instruction ends with the timeout sentence. Stages 2 and 3 have not yet been run on the adjusted tasks.
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
 
multiswe_v1/patch.py CHANGED
@@ -900,6 +900,17 @@ def share_image(files, recipe, locks):
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']:
@@ -1058,6 +1069,40 @@ def patch_blob(blob, recipe=None, locks=None, task_id=None):
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:
@@ -1086,7 +1131,33 @@ def main():
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'))
 
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
+ # Harbor verifies in the agent's container and only /tests is uploaded fresh, so the
904
+ # /home copies above are agent-writable. Reinstall them from /tests before grading.
905
+ test = updated['tests/test.sh'].decode()
906
+ entry = 'bash /home/fix-run.sh'
907
+ if test.count(entry) != 1:
908
+ raise ValueError('Unexpected Multi-SWE test entrypoint')
909
+ for name, content in recipe['files'].items():
910
+ updated['tests/upstream/' + name] = content.encode()
911
+ restore = ['install -m 0644 ' + shlex.quote('/tests/upstream/' + name) + ' ' + shlex.quote('/home/' + name)
912
+ for name in sorted(recipe['files'])]
913
+ updated['tests/test.sh'] = test.replace(entry, '\n'.join(restore) + '\n' + entry, 1).encode()
914
  solve = updated['solution/solve.sh'].decode()
915
  updated['solution/solve.sh'] = solve.replace('set -e\n', 'set -e\nbash /setup_files/setup.sh\n', 1).encode()
916
  if b'bash /setup_files/setup.sh\n' not in updated['solution/solve.sh']:
 
1069
  updated = repair_hugo_result_lines(updated, task_id)
1070
  if updated == files:
1071
  return blob
1072
+ return rewrite_blob(members, updated)
1073
+
1074
+
1075
+ def release_repair_files(files):
1076
+ """Repairs for already published tasks: reinstall the upstream harness from /tests before
1077
+ grading (the /home and /setup_files copies are agent-writable) and add the timeout suffix."""
1078
+ from validation.checks.instruction_suffix import suffix
1079
+ updated = dict(files)
1080
+ upstream = {name[len('setup_files/upstream/'):]: data for name, data in files.items()
1081
+ if name.startswith('setup_files/upstream/')}
1082
+ test = updated['tests/test.sh'].decode()
1083
+ entry = 'bash /home/fix-run.sh'
1084
+ if test.count(entry) != 1 or 'fix-run.sh' not in upstream:
1085
+ raise ValueError('Unexpected Multi-SWE test entrypoint')
1086
+ if '/tests/upstream/' not in test:
1087
+ for name, content in upstream.items():
1088
+ updated['tests/upstream/' + name] = content
1089
+ restore = ['install -m 0644 ' + shlex.quote('/tests/upstream/' + name) + ' ' + shlex.quote('/home/' + name)
1090
+ for name in sorted(upstream)]
1091
+ updated['tests/test.sh'] = test.replace(entry, '\n'.join(restore) + '\n' + entry, 1).encode()
1092
+ updated['instruction.md'] = suffix(files['instruction.md'], files['task.toml'])
1093
+ return updated
1094
+
1095
+
1096
+ def release_repair_blob(blob):
1097
+ with tarfile.open(fileobj=io.BytesIO(blob)) as archive:
1098
+ members = archive.getmembers()
1099
+ files = {m.name: archive.extractfile(m).read() for m in members if m.isfile()}
1100
+ updated = release_repair_files(files)
1101
+ return blob if updated == files else rewrite_blob(members, updated)
1102
+
1103
+
1104
+ def rewrite_blob(members, updated):
1105
+ updated = dict(updated)
1106
  output = io.BytesIO()
1107
  with tarfile.open(fileobj=output, mode='w') as archive:
1108
  for member in members:
 
1131
  parser.add_argument('--share-images', action='store_true', help='experimental: move audited upstream PR preparation into setup_files')
1132
  parser.add_argument('--base-image-lock', type=Path, help='Override the embedded digest-pinned base-image mapping with a JSON file')
1133
  parser.add_argument('--recipe-python', default=sys.executable, help='Python with multi-swe-bench==1.1.2 installed')
1134
+ parser.add_argument('--release-repair', action='store_true',
1135
+ help='--source is the published multiswe_v1 tasks.parquet; apply only release_repair_files')
1136
+ parser.add_argument('--source-revision', help='validated-tasks commit of --source (with --release-repair)')
1137
  args = parser.parse_args()
1138
+ if args.release_repair:
1139
+ if args.output.exists():
1140
+ raise ValueError('Use a new output directory')
1141
+ args.output.mkdir(parents=True)
1142
+ table = pq.read_table(args.source)
1143
+ rows = table.to_pylist()
1144
+ labels = {}
1145
+ for row in rows:
1146
+ patched = release_repair_blob(row['task_binary'])
1147
+ if patched != row['task_binary']:
1148
+ labels[row['path']] = ['verifier-harness-reinstall', 'instruction-suffix']
1149
+ row['task_binary'] = patched
1150
+ output = args.output / 'tasks.parquet'
1151
+ pq.write_table(pa.Table.from_pylist(rows, schema=table.schema), output, compression='zstd')
1152
+ write_patch_report(args.source, output, patcher=__file__, source={
1153
+ 'dataset': 'FWeindel/validated-tasks multiswe_v1', 'revision': args.source_revision,
1154
+ 'url': f'https://huggingface.co/datasets/FWeindel/validated-tasks/tree/{args.source_revision}/multiswe_v1'},
1155
+ dropped={}, change_labels=labels,
1156
+ change_reasons={t: 'Reinstall the upstream test harness from /tests before grading, because the /home copies are '
1157
+ 'agent-writable; append the timeout sentence.' for t in labels},
1158
+ unresolved={}, patches=[{'version': 'multiswe-release-repair-v1'}])
1159
+ print(f'{output}: {len(rows)} tasks, {len(labels)} repaired')
1160
+ return
1161
  locks = json.loads(args.base_image_lock.read_text() if args.base_image_lock
1162
  else EMBEDDED_FILES['base-images.lock.json']) if args.share_images else {}
1163
  sources = [args.source] if args.source.is_file() else sorted(args.source.glob('*.parquet'))
multiswe_v1/tasks.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1c9ba13d4f9570e7f06f162201694a38cfef8aabb43454449a74abdfb8356fc6
3
- size 104840140
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d64d339f70f617f4056a4f3c237d4bf67a2ec6b0724167c527409a14c6c4c670
3
+ size 105849000