SWE-smith tasks expose the pre-bug code through git history (`git checkout HEAD~1 -- .`)
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start in debug_gym/gym/envs/swe_smith.py, where the bug patch is applied and committed (around lines 100-112), then read setup_terminal in swe_bench.py, which the issue says keeps older commits. Check that the gold patch and eval() still work on the working tree and index after the history is replaced. Done when git checkout HEAD~1 -- . no longer restores the pre-bug code, and tests/gym/envs/test_swe_smith.py (around lines 103-110) is updated and passing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
SWESmithEnv commits the bug patch on top of the code from before the bug, and the gold patch is the bug patch reversed. So for a patch that only changes tracked files, HEAD~1 holds exactly the code the gold patch produces. With the bash tool from configs/swesmith.yaml, an agent can run git checkout HEAD~1 -- . and submit. In every task I ran, that scored exactly what the gold patch scores, without any debugging.
Code at 3f72ecc400a11752fc68cf08428225b6ba01a99e:
swe_bench.py#L129-L134:SWEBenchEnv.setup_terminal(inherited) commits the setup and removes the remote "so the agent won't see newer commits". Older commits stay.swe_smith.py#L105-L112: applies the bug patch, then runsgit commit -am 'Applying bug patch for <instance_id>'.swe_smith.py#L100-L103: the gold patch is the bug patch applied withgit apply --reverse.swe_smith.py#L149-L155:eval()restores the test files from the index, then runs the tests in the same container.git checkout HEAD~1 -- .updates the index too, so that reset does not undo it, andcalculate_scoregrades the same code the gold patch would produce.test_swe_smith.py#L103-L110asserts thatgit show HEADequals the bug patch.
In the container, git log --oneline shows:
a53785d Applying bug patch for john-kurkowski__tldextract.3d1bf184.combine_file__1vnuqpt4
50ed423 Initial commit
The image's .git also keeps the commit objects of the SWE-smith task branches (Bug Patch / Remove F2P Tests) after git remote remove origin. That is 202 commit objects in the tldextract image and 1,882 in the oauthlib image, with 2 reachable. So amending the commit or deleting refs would not be enough on its own.
Reproduction
The tasks are built through debug_gym.experiment.create_env with the shipped configs/swesmith.yaml (Docker terminal; bash, view, edit, submit). They are driven by scripted tool calls through env.step. Results on 3f72ecc, Docker 29.1.3:
| Task | no-op, then submit | env.apply_gold_patch(), then submit |
bash git checkout HEAD~1 -- ., then submit |
|---|---|---|---|
john-kurkowski__tldextract.3d1bf184.combine_file__1vnuqpt4 |
0/39 | 39/39, resolved | 39/39, resolved |
oauthlib__oauthlib.1fd52536.combine_file__09vlzwgc |
0/18 | 18/18, resolved | 18/18, resolved |
seatgeek__thefuzz.8a05a3ee.combine_file__2uoca06x |
0/25 | 25/25, resolved | 25/25, resolved |
iterative__dvc.1d6ea681.pr_7514 (the patch also adds a file) |
0/7 | 7/7, resolved | 7/7, resolved |
kurtmckee__feedparser.cad965a3.combine_file__115z1mk8 |
0/2226 | 2223/2226, unresolved | 2223/2226, unresolved |
Minimal manual version (any task from the table above where the gold patch resolves):
env = create_env(dict(config, uuid=str(uuid.uuid4())), task_data, logger) # config = configs/swesmith.yaml
env.reset()
env.step(ToolCall(id="1", name="bash", arguments={"command": "git checkout HEAD~1 -- ."}))
info = env.step(ToolCall(id="2", name="submit", arguments={}))
assert info.resolved
Scope
At the dataset revision SWESmithEnv.load_dataset pins (699b5340), there are 50,103 tasks after the excluded list. In 50,090 of them, the bug patch only modifies or deletes tracked files, so git checkout HEAD~1 -- . restores the same tracked files as the gold patch. The other 13 also add files, which git commit -am leaves untracked. The one I tested (dvc above) still scored like the gold patch.
Impact
- RL:
git logshows the bug commit ("Applying bug patch for ..."), and one bash command then earns the gold patch's reward. A policy that finds this is rewarded for restoring code from git history instead of for debugging. - Eval: an agent that looks at git history can be graded resolved without fixing the bug, so resolve rates can be inflated with no sign of it in the score.
Suggested fix
After applying the bug patch, replace .git with a new repository whose only commit is the buggy code. It should track the same files as before, plus any file the bug patch adds. Once the old object store is gone, HEAD~1, the old commit objects and the task-branch objects go with it. The gold patch and eval() work on the working tree and index, so they keep working. A PR with this change follows.
R2EGymEnv has a related TODO: remove .git/ entirely? at r2egym.py#L240. This issue covers SWE-smith only.
- Ngôn ngữ chính
- Python
- Star
- 308
- Fork
- 47
- Merge trung bình
- 2 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/debug-gym
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Remove example of bashĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Size limit for viewĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
microsoft/debug-gym#304 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/debug-gym
Issue tương tự
-
[yugabyted] xcluster set_up and add_to_replication fail for database names containing - . or (Đang mởkind/bug priority/medium qa_automation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
yugabyte/yugabyte-db#37324 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 87/100
btclib-org/btclib-node#2260 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ChatBedrockConverse changes the keys of JSON tool results to camelCase (`order_id` becomes `orderId`)Có thể đã có người làm @geyazheng đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
langchain-ai/langchain-aws#1469 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GCToggler leaves collection enabled if the body re-enables itCó thể đã có người làm @Gambit-Checkmate đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
EESSI/docs#949 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày