Datasets:
Grade a fix the agent committed: locate the repo by base ancestry, reset tests from base
Browse files## Problem
Every `tests/test.sh` locates the repository with `find_repo`, which only accepts a `.git` whose `HEAD` **equals** the base commit, and otherwise writes reward 0 without running a test ("fail closed").
An agent that fixes the bug and then runs `git commit` therefore scores 0 regardless of whether the fix is right: `HEAD` has moved to its own commit, whose parent is the base commit. In one RL run (Qwen3.5-9B, terminus agent), 5 of 344 Rebench rollouts were zeroed this way without being graded (e.g. `cs-si__eodag-634`: edit `eodag/utils/__init__.py`, self-test, `git add`, `git commit`, submit -> `no repository at base commit`). For RL this rewards "never touch git", not "fix the bug".
(Rollouts that `git checkout` an unrelated or older commit and fix the bug there, e.g. 9 rollouts on `maas__python-libmaas-227`, are also zeroed. That is correct and stays unchanged: the graded code is not the task's code.)
## Change
Only the repo lookup and the test-surface reset change; the test patch, the FAIL_TO_PASS / PASS_TO_PASS runs and the reward rule are untouched. All 1,317 `tests/test.sh` get the same six edits:
1. `BASE=<sha>` is set once, and `find_repo "$BASE"` accepts a repo when `git merge-base --is-ancestor "$BASE" HEAD` holds (HEAD is base, or descends from it).
2. The graded test files are restored from `"$BASE"` instead of `HEAD`.
3. The whole test surface is listed with `git ls-tree ... "$BASE"` and restored from `"$BASE"`.
4. Test-surface files that do not exist in `$BASE` are removed whether untracked **or committed** (`git ls-files` + `--others`, then `git cat-file -e "$BASE:$f" || rm`). Previously only untracked files were removed, which was safe only because HEAD had to equal base; with commits allowed, a committed new test would otherwise survive.
5. `touched` (diagnostic only) diffs against `"$BASE"`, so committed `pyproject.toml` / `setup.cfg` / `tox.ini` edits are still reported.
With nothing committed, `HEAD == BASE` and the new script behaves exactly as before.
## Verification
- The edits are exact-string replacements, each required to match exactly once per file; all 1,317 files matched, and every patched script passes `bash -n`.
- Tested end to end on a fixture repo running the real script's lookup/reset section: an agent that fixes `src.py`, tampers a graded test, deletes another, edits `conftest.py` and adds a new test file gets: fix kept, all tampering undone, added test removed, both when it commits and when it doesn't. Unpatched, the committed case scores 0 ungraded; an orphan/unrelated checkout still finds no repo and scores 0.
- `data/tasks-00000.tar` is otherwise unchanged: same 10,536 members in the same order with the same mode/mtime/owner; only the 1,317 `tests/test.sh` contents differ.
The same rewrite is applied at build time in https://github.com/yichuan-w/torchtitan (branch `yichuan/qwen35-port-cotrain`, `torchtitan/experiments/rl/examples/tmax/evolution/pack_to_dataset.py`, `patch_rebench_test_sh`), which becomes a no-op once this is merged.
- data/tasks-00000.tar +2 -2
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa393affc1065d977e3cd8995ebbc0003eb6f964854ef939e55b5fbb32f10f7c
|
| 3 |
+
size 55326720
|