Add SWE-bench Pro eval preflight and harness docs#112
Open
Abhishek21g wants to merge 3 commits into
Open
Conversation
scripts/swebench_preflight.py validates patch JSON and run_scripts layout; documents golden-patch verification workflow for scaleapi#101 and related harness footguns. Includes unittest coverage.
Guard instance_id access in run_scripts and warnings loops; gate layout on both run_script.sh and parser.py presence.
Skip malformed patch list elements in check_binary_patch_sections so preflight reports schema errors instead of aborting with AttributeError.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Teams running golden-patch or agent evals hit silent harness failures — missing
run_scripts/, duplicateinstance_ids, and known env footguns like NodeBB sendmail errors (#101).Fix
scripts/swebench_preflight.py— validate patch JSON + per-instancerun_scripts/beforeswe_bench_pro_eval.pydocs/HARNESS.md— harness invariants and footgun table (Golden patch failed #101, Git Reward Hacking in SWEBench Pro OSS #93, Issues running the images #6)docs/GOLDEN_PATCH.md— golden-patch verification workflow for Golden patch failed #101tests/test_swebench_preflight.py— unittest coverageVerification
Closes #101 (docs/workflow); does not change Docker images.
Greptile Summary
This PR introduces a preflight validation script (
scripts/swebench_preflight.py) that catches common harness failures — missingrun_scripts/, duplicateinstance_ids, binary hunks, and known NodeBB footguns — beforeswe_bench_pro_eval.pyis invoked, along with accompanying docs and unit tests.swebench_preflight.pyruns four gates (patch schema, run-scripts layout, binary hunks as warn-only, known warnings) and exits non-zero on any hard failure; all gate functions correctly guard against non-dict and missing-key entries.docs/HARNESS.mdanddocs/GOLDEN_PATCH.mddocument harness invariants and the golden-patch verification workflow for issues Golden patch failed #101/Git Reward Hacking in SWEBench Pro OSS #93._layout()are never cleaned up, andmain()is missing a try/except around theload_patchescall so malformed/non-array JSON files produce a raw traceback instead of the cleanerror: …message the rest ofmain()uses.Confidence Score: 5/5
Safe to merge — all changes are additive and do not touch any existing evaluation code or Docker images.
The gate logic is correct and well-covered by tests. The two minor gaps (uncaught exception in main() on malformed JSON input, and temp-dir leak in tests) do not affect preflight correctness or any production path.
No files require special attention; scripts/swebench_preflight.py and tests/test_swebench_preflight.py have small improvements suggested in comments.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram actor User participant main participant run_preflight participant load_patches participant validate_patches participant validate_run_scripts participant check_binary_patch_sections participant collect_known_warnings User->>main: --patches gold.json --scripts-dir run_scripts main->>main: check file/dir existence main->>run_preflight: patches_path, scripts_dir run_preflight->>load_patches: patches_path load_patches-->>run_preflight: list[dict] (or raises ValueError/JSONDecodeError) run_preflight->>validate_patches: patches validate_patches-->>run_preflight: patch_schema gate + errors run_preflight->>validate_run_scripts: patches, scripts_dir validate_run_scripts-->>run_preflight: run_scripts_layout gate + errors run_preflight->>check_binary_patch_sections: patches check_binary_patch_sections-->>run_preflight: binary_patch_sections gate (warn-only) run_preflight->>collect_known_warnings: patches collect_known_warnings-->>run_preflight: known warnings list run_preflight-->>main: "report {passed, gates, errors, warnings}" main-->>User: PASS/FAIL banner + gate details + ERR lines%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram actor User participant main participant run_preflight participant load_patches participant validate_patches participant validate_run_scripts participant check_binary_patch_sections participant collect_known_warnings User->>main: --patches gold.json --scripts-dir run_scripts main->>main: check file/dir existence main->>run_preflight: patches_path, scripts_dir run_preflight->>load_patches: patches_path load_patches-->>run_preflight: list[dict] (or raises ValueError/JSONDecodeError) run_preflight->>validate_patches: patches validate_patches-->>run_preflight: patch_schema gate + errors run_preflight->>validate_run_scripts: patches, scripts_dir validate_run_scripts-->>run_preflight: run_scripts_layout gate + errors run_preflight->>check_binary_patch_sections: patches check_binary_patch_sections-->>run_preflight: binary_patch_sections gate (warn-only) run_preflight->>collect_known_warnings: patches collect_known_warnings-->>run_preflight: known warnings list run_preflight-->>main: "report {passed, gates, errors, warnings}" main-->>User: PASS/FAIL banner + gate details + ERR linesReviews (3): Last reviewed commit: "fix(preflight): guard non-dict entries i..." | Re-trigger Greptile