RepairAgent icon indicating copy to clipboard operation
RepairAgent copied to clipboard

Bug in collect plausible patches script

Open islem-esi opened this issue 8 months ago • 1 comments

The current implementation of plausible patches collection only gets mutation-based plausibles...

islem-esi avatar May 13 '25 14:05 islem-esi

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:

  1. 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)))
    
  2. 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:

  1. Extend collection script to check additional directories
  2. Consolidate storage - make all patch types save to plausible_patches/
  3. Add configurable parameters for patch sources

I'm happy to submit a PR with the fix once we decide on the solution direction.

JYe9 avatar Jun 04 '25 05:06 JYe9