MultiFixer is a Coordinator-Proposer based multi-agent framework for fixing multi-hunk bugs.
-
Repository-level static analysis
Conducted on both source code and test classes, with fine-grained inspection at the class, method, and class variable levels using static analysis tools (e.g., JavaParser). -
Agent + Tool interaction
The BugAnalyzer agent autonomously investigates the root cause of the bug by iteratively invoking domain-specific tools (e.g., retrieve method body, get class hierarchy) based on analysis results. This mimics how developers navigate code in an IDE.
The repair context is composed of five key components:
-
File/class/line-level contextual code
Surrounding code at multiple granularities to provide dependency and control-flow information. -
Buggy hunk code
The exact location of erroneous code, serving as the primary repair target. -
Failing test case code
Relevant test cases that expose the defect, used to guide fix generation. -
Test failure report
Error messages and stack traces from test execution, providing diagnostic clues. -
Bug analysis output (from Phase 1)
Includes root cause summary and relevant code snippets identified by BugAnalyzer, enriching the semantic understanding of the bug.
Together, these form a comprehensive, multi-granular repair context.
-
Proposer
A group of agents responsible for generating candidate patches for a given hunk. Multiple proposers run in parallel with diverse configurations (e.g., temperature, model variants) to enhance patch diversity. -
Coordinator
- Selects the next hunk to repair based on dependencies and prior repair outcomes.
- Evaluates all candidate patches generated by the Proposers and selects the most promising one.
-
Hunk-level iterative repair workflow
- The Coordinator selects the next hunk to repair.
- All Proposers generate patch candidates for the selected hunk.
- The Coordinator evaluates and selects the optimal patch.
- Repeat until all hunks are fixed or the maximum iteration limit is reached.
This "propose-then-select" paradigm leverages the generation-recognition asymmetry to improve repair accuracy.
After patch generation, two-stage refinement ensures correctness:
-
Syntax Refinement
If the patch fails to compile, the model uses compiler error messages to iteratively correct syntactic issues (e.g., missing braces, incorrect indentation). -
Test Refinement
If tests still fail after successful compilation, the model analyzes test failure reports and refines the patch semantically (e.g., fixing logic errors).
Refinement proceeds iteratively until the patch passes all tests or reaches the maximum number of iterations.
- Perform static analysis on the buggy project.
java -jar artifacts/FileParser-1.0-SNAPSHOT-jar-with-dependencies.jar $PROJECT_DIR- Bug analysis
# for multi-hunk bugs
bash script/multi_hunk_bug_analysis.sh
# for single-hunk bugs
bash script/single_hunk_bug_analysis.sh # for vulnerabilities
bash script/vul_analysis.sh- Repair bugs
# for multi-hunk bugs
bash script/multi_hunk_repair.sh
# for single-hunk bugs
bash script/single_hunk_repair.sh # for vulnerabilities
bash script/vul_repair.sh| Method | Patch Size | D4J-v1.2: SL | SH | SM | MM | SF | MF | PF | D4J-v2.0: SL | SH | SM | MM | SF | MF | PF | Total: CF | PF |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ThinkRepair | ≤125 | 52 | 78 | 98 | 0 | 98 | 0 | - | 47 | 81 | 107 | 0 | 107 | 0 | - | 205 | - |
| ChatRepair | ≤500 | 57 | 79 | 114 | 0 | 114 | 0 | - | 48 | 48 | 48 | 0 | 48 | 0 | - | 162 | - |
| RepairAgent | 117 | 52 | 67 | 86 | 4 | 88 | 2 | 96 | 48 | 61 | 71 | 3 | 73 | 1 | 90 | 164 | 186 |
| PReMM | 15 | 53 | 70 | 121 | 26 | 140 | 7 | 184 | 52 | 129 | 141 | 19 | 152 | 8 | 191 | 307 | 375 |
| MultiFixer | ≤30 | 49 | 74 | 120 | 28 | 141 | 7 | 182 | 56 | 98 | 144 | 34 | 158 | 20 | 230 | 326 | 412 |
Abbreviations:
- SL: Single Line, SH: Single Hunk, SM: Single Method
- MM: Multiple Methods, SF: Single File, MF: Multiple Files
- CF: Correct Fix (Total), PF: Plausible Fix
| Method | MultiFixer | FSV-Codex | FSV-finetuned | NTR | VRPILOT | APR4Vul | ChatRepair |
|---|---|---|---|---|---|---|---|
| CF (RCR) | 24 (30.37%) | 10.9 (13.79%) | 9 (11.39%) | 14 (17.72%) | 14 (17.72%) | 16 (20.25%) | 15 (18.98%) |
Abbreviations:
- CF: Correct Fix
- RCR: Repair Success Rate = CF / Total Bugs (79)
