You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

foresightCoder — the Anticipation-Gap Benchmark

Measures whether a coding agent anticipates edge cases before a human reports them.

Each instance is a real PR fix-chain PR1 → PR2 mined from a public Python repo: PR1 introduced or owned some behavior, and a later PR2 fixed an edge case PR1 missed. PR2's tests are a held-out reward signal — an agent solving PR1 from clean intent should pass them even though PR1's human author didn't.

The headline metric is the anticipation gap:

gap = X − Y, where X = % of PR1's own tests the agent passes (did it do the stated task?) and Y = % of the unseen future-PR anticipation tests it passes (did it anticipate the edge case?). A large gap means the model solves the asked task but misses the foreseeable failure.

Every chain here is fully-gradeable: PR1 has its own FAIL_TO_PASS tests and PR2 has validated anticipation tests, and all 67 reproduce inside their per-repo linux/amd64 Docker image under the full 3-state definition (pass@pr2_head ∧ fail@pr2_base ∧ fail@pr1_head for anticipation; pass@pr1_head ∧ fail@pr1_base for PR1-own). Verification and the PR1 FAIL_TO_PASS/PASS_TO_PASS recomputation were run on linux/amd64 — the architecture the eval/HPC runs on — so the fail→pass property is guaranteed on the target arch (one pandas chain whose anticipation test is architecture-dependent was dropped).

60 of the 67 are eval_ready (the recommended eval set): the anticipation target is a genuine bug (not a new feature), and PR1's task statement is clear (clarity_score ∈ {0,1}) and solvable from the statement (pr1_code == "A"). The other 7 are kept for completeness but flagged. 20 instances had an under-specified PR1 statement enriched to be solvable (pr1_spec_repaired; PR2 never entered the repair, so the held-out signal is not leaked) — see pr1_code_original == "B2".

Composition (67 chains across 14 repos; 60 eval-ready across 13)

django:16 · sqlglot:11 · pytest:11 · starlette:6 · networkx:5 · xarray:5 · pandas:3 · sphinx:3 · moto:2 · attrs:1 · sqlfluff:1 · packaging:1 · pygments:1 · sympy:1

Test harness: 51 pytest + 16 Django (tests/runtests.py). The runner field tells them apart.

Schema

SWE-bench-compatible fields describe the PR1 task the agent solves; anticipation_* / ANTICIPATION_FAIL_TO_PASS add the held-out PR2 edge case.

field meaning
instance_id {repo}__{earlier_pr}-{later_pr}
repo owner/name
base_commit / environment_setup_commit commit the agent starts from (before PR1)
problem_statement PR1's intent — derived from PR1 only (no PR2 leakage)
problem_statement_raw original human PR1 title/body (provenance)
patch gold PR1 source diff (withheld from the solver)
test_patch PR1 test diff
FAIL_TO_PASS PR1's own fail→pass tests → the X score
PASS_TO_PASS PR1 regression tests that must stay green
anticipation_patch gold PR2 source diff (the fix for the missed edge case)
anticipation_test_patch PR2 test diff
ANTICIPATION_FAIL_TO_PASS the held-out edge-case tests → the Y score
pr2_problem_statement PR2's intent as an explicit task (synthesized, then spec-repaired to be solvable from the held-out tests) — input for the PR2-direct oracle (start at pr1_head_sha, grade ANTICIPATION_FAIL_TO_PASS) that upper-bounds the anticipation score
pr2_problem_statement_raw original human PR2 title/body (provenance)
pr2_spec_repaired / pr2_spec_code whether the PR2 statement was enriched so the held-out tests are solvable; A = solvable, B5 = gold anticipation_patch bundles unrelated changes the tests require (2 instances)
pr1_test_files / anticipation_test_files test files to run for X / Y
docker_image per-repo eval image (docker.io/shaswatpatel123/foresight:<repo>, private)
repo_path /testbed (SWE-bench convention)
runner pytest or django (different test command)
install_cmd / test_cmd / run_helper how to build the env and run tests in-image
created_at / pr2_created_at / gap_days provenance + PR1→PR2 time gap
eval_ready / fully_gradeable quality gates: eval_ready = bug target ∧ clear ∧ solvable PR1
pr1_code / pr1_code_original / pr1_spec_repaired PR1 task solvability (A / B*); original code before spec-repair; whether the statement was enriched
severity / failure_mode / trigger_path / mechanism calibrated bug labels for the edge case PR2 fixed (LLM judge, anchored two-step rubric): severity = major/minor/not_a_bug; failure_mode = silent/loud/none; trigger_path = default/opt-in; mechanism = regression/missed_edge_case/…
difficulty / pr1_difficulty PR2-fix difficulty (the fix) / PR1-task difficulty (the agent-facing statement)
mining_category / mining_evidence / quality / clarity_score provenance & quality metadata (mining_category = which miner edge-source found the chain, not a bug type)

Load

from datasets import load_dataset
ds = load_dataset("shaswat123/foresightcoder-anticipation", split="test")
print(ds[0]["instance_id"], ds[0]["runner"])

Eval flow (per instance)

  1. Start an agent at base_commit (before PR1) with problem_statement as the task; let it edit /testbed.
  2. Score X: run pr1_test_files and check FAIL_TO_PASS (overlay the post-PR1 test versions).
  3. Score Y: run anticipation_test_files and check ANTICIPATION_FAIL_TO_PASS the same way.
  4. Report X, Y, and the gap X − Y, per chain and aggregated.

The baked eval primitive (run_state.sh for pytest, run_state_django.sh for Django) reproduces each state: <checkout_sha> <overlay_sha|-> <junit_out> <test_files...>.

⚠️ The Docker images referenced are private; request access or rebuild them from the project's scripts/gen_docker.py. The problem statement is derived from PR1 only — never from PR2 — to preserve the held-out independence the metric depends on.

License

MIT. Patches/tests are derived from the respective upstream repositories under their own licenses.

Downloads last month
4