Abstract
Tangled commits—git commits containing multiple unrelated changes—hinder code review, bug localization, and project history clarity. This paper introduces ColaUntangle, a collaborative multi-agent framework that utilizes Large Language Models (LLMs) to untangle commits. By distinguishing between explicit structural dependencies and implicit semantic relationships, ColaUntangle employs specialized agents to reach a consensus on change grouping. Experimental results on large-scale C# and Java benchmarks demonstrate that ColaUntangle outperforms current state-of-the-art tools by 44% to 82%, establishing a new baseline for automated commit decomposition.
1. Introduction
In modern software development, "atomic commits" are the gold standard. However, developers frequently produce "tangled commits" by mixing feature additions, bug fixes, and refactoring into a single submission. These commits increase the cognitive load on maintainers and degrade the performance of automated tools.
Previous automated untangling approaches primarily relied on static analysis of data and control flows. While effective for explicit dependencies, these methods struggle with implicit dependencies—changes that are semantically related but lack direct code-level links, such as updating a variable name alongside its corresponding documentation or comments.
2. The ColaUntangle Framework
ColaUntangle addresses the limitations of prior work by treating commit untangling as a collaborative reasoning task between specialized LLM agents.
2.1 Context Extraction
The framework begins by constructing a Commit-Level Merged Graph. From this, it derives two distinct views to feed the agents:
- Explicit Context ($G_{Explicit}$): A highly compressed representation of direct data and control flow dependencies between changed statements.
- Implicit Context ($G_{Implicit}$): A semantic view including the changed code and its immediate "one-hop" neighbors to provide necessary context for semantic reasoning.
2.2 Multi-Agent Collaboration
The core of the system is a trio of specialized agents:
- Explicit Worker Agent (EA): An expert in identifying "hard" structural links like data dependencies.
- Implicit Worker Agent (IA): Analyzes "soft" semantic links, similarity, and "cosmetic" edits like formatting.
- Reviewer Agent (RA): Acts as a manager that synthesizes the two perspectives, resolving conflicts through an iterative consultation process until consensus is reached.
3. Experimental Evaluation
The model was evaluated using two extensive benchmarks: a C# dataset containing 1,612 tangled commits and a Java dataset featuring over 14,000 commits. These datasets provide a ground truth by using artificially tangled atomic commits.
3.1 Key Results
ColaUntangle achieved a significant performance leap over the previous state-of-the-art baseline (HD-GNN):
- Accuracy Improvement: It outperformed the baseline by 44% on the C# dataset and 82% on the Java dataset in terms of statement labeling accuracy ($Accuracy^c$).
- Efficiency: Despite the multi-agent overhead, the system reached a consensus in an average of just 1.39 rounds.
- Model Robustness: While performing best with DeepSeek-V3, the framework showed strong results with GPT-4o and Claude-3.5-Sonnet, proving the architectural approach is model-agnostic.
4. Discussion and Conclusion
The success of ColaUntangle highlights the importance of semantic reasoning in code analysis. By isolating "cosmetic" noise and providing natural language rationales for its groupings, the framework offers superior explainability compared to "black-box" neural models. Future work will focus on reducing inference latency (currently ~71 seconds per commit) and integrating "human-in-the-loop" features to allow developers to refine LLM-proposed splits in real-time.
Summary updated