RepairAgent
RepairAgent copied to clipboard
Bug in collect plausible patches script
The current implementation of plausible patches collection only gets mutation-based plausibles...
Hi @islem-esi Thanks for maintaining this amazing project. I've reproduced and analyzed the bug in collect_plausible_patches_files.py and would like to share my findings.
Reproduction Steps (using dev container):
mkdir -p experimental_setups/test_batch
echo "Closure 65" > experimental_setups/test_batch/test
./run_on_defects4j.sh experimental_setups/test_batch/test hyperparams.json
python3.10 experimental_setups/collect_plausible_patches_files.py 18 19
Root Cause Analysis:
-
The agent only stores mutation-based patches in
plausible_patches/when all tests pass (agent.py#L278-L280):with open(os.path.join("experimental_setups", exps[-1], "plausible_patches", ...), "a+") as exps: exps.write("### PLAUSIBLE FIX\\n{}\\n".format(str(m))) -
The collection script only checks one directory (collect_plausible_patches_files.py#L?):
if os.path.exists(os.path.join("experiment_{}".format(i), "plausible_patches")): patches[i] = patches[i] + os.listdir(...)
Proposed Solutions:
- Extend collection script to check additional directories
-
Consolidate storage - make all patch types save to
plausible_patches/ - Add configurable parameters for patch sources
I'm happy to submit a PR with the fix once we decide on the solution direction.