Add git reset validation script and fix missing resets#425
Draft
juanmichelini wants to merge 1 commit intomainfrom
Draft
Add git reset validation script and fix missing resets#425juanmichelini wants to merge 1 commit intomainfrom
juanmichelini wants to merge 1 commit intomainfrom
Conversation
This PR adds a validation script that ensures git reset is called after every git clone or git checkout operation in the benchmark codebase. This prevents agents from looking at commits that are not part of the benchmark during evaluation. Changes: - Add validate_git_reset.py script to check for git reset after clone/checkout - Add pre-commit hook for automatic validation - Fix 6 files with missing git reset operations: - benchmarks/commit0/run_infer.py - legacy/ml_bench/run_infer.py - legacy/lca_ci_build_repair/run_infer.py - legacy/lca_ci_build_repair/eval_infer.py - legacy/swefficiency/scripts/setup/prepare_swe_utils.sh - legacy/testgeneval/scripts/setup/prepare_swe_utils.sh - Add comments for version_control.sh where git reset is not needed - Add test suite for the validation script (14 tests) - Add CLI entry point: validate-git-reset The validation accepts 'git reset' in comments as valid, allowing explicit documentation when reset is intentionally skipped. Fixes #424 Co-authored-by: openhands <openhands@all-hands.dev>
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.
Summary
This PR adds a validation script that ensures
git resetis called after everygit cloneorgit checkoutoperation in the benchmark codebase. This prevents agents from looking at commits that are not part of the benchmark during evaluation.Changes
New Files
benchmarks/scripts/validate_git_reset.py- Validation script that:git cloneandgit checkoutcommandsgit resetfollows within a configurable context windowgit resetin comments as valid (to allow explicit documentation)git checkout -bas it creates new branches and doesn't need resettests/test_validate_git_reset.py- Test suite with 14 tests covering all functionalityModified Files
Fixed 6 files with missing
git resetoperations:benchmarks/commit0/run_infer.py- Addedgit reset --hard HEADafter clonelegacy/ml_bench/run_infer.py- Addedgit reset --hard HEADafter clonelegacy/lca_ci_build_repair/run_infer.py- Addedgit reset --hard HEADafter switchlegacy/lca_ci_build_repair/eval_infer.py- Addedgit reset --hard HEADafter switchlegacy/swefficiency/scripts/setup/prepare_swe_utils.sh- Addedgit reset --hard HEADlegacy/testgeneval/scripts/setup/prepare_swe_utils.sh- Addedgit reset --hard HEADAdded comments documenting why
git resetis not needed:legacy/utils/version_control.sh- This file handles version control for the development environment, not benchmark evaluationConfiguration
validate-git-resetto.pre-commit-config.yamlfor automatic validationvalidate-git-resetCLI entry point inpyproject.tomlUsage
Run validation manually:
If a
git cloneorgit checkoutis intentionally not followed bygit reset, add a comment:Testing
All 14 tests pass:
Fixes #424
@juanmichelini can click here to continue refining the PR