Skip to content

Fix patches being reversed if repo state in container differs from base_commit#3

Merged
Kipok merged 1 commit intomainfrom
ludwig-n/patch-restore-orig-files
Jan 30, 2026
Merged

Fix patches being reversed if repo state in container differs from base_commit#3
Kipok merged 1 commit intomainfrom
ludwig-n/patch-restore-orig-files

Conversation

@ludwig-n
Copy link
Collaborator

@ludwig-n ludwig-n commented Jan 30, 2026

This applies the fix from this upstream PR: SWE-bench#453. This fixes issue SWE-bench#228 which was causing Sphinx instances to fail with patches produced by OpenHands.

Score changes as a result of the fix:

  • Qwen3-Coder-30B-A3B + OpenHands: 45.1 -> 48.3 (average of 3 runs).

Problem description:

  • In some SWE-bench containers, in particular for some/all instances from the sphinx-doc/sphinx repo, the repository folder /testbed contains additional changes compared to the base_commit listed in the HuggingFace dataset.
  • OpenHands creates patches by running git diff relative to the listed base_commit. Therefore, these patches already contain the additional changes mentioned above.
  • When these patches are applied using the patch --batch command, it incorrectly assumes the patches are reversed and reverts the files back to the state they were in at base_commit, which is wrong and causes the tests to fail, but the patch is reported as "successfully applied".

…ed patch as reversed

Signed-off-by: Nikolai Ludwig <nliudvig@nvidia.com>
@ludwig-n ludwig-n requested a review from Kipok January 30, 2026 13:35
@Kipok Kipok merged commit 22850ac into main Jan 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments