Abstract
Automating bug fixes in large-scale systems code, such as the Linux kernel, represents a significant challenge for AI agents due to the complexity, scale, and interconnected nature of the codebases. This paper introduces Code Researcher, a deep research agent that mimics the rigorous investigative process of human developers. By combining multi-step reasoning with the ability to analyze historical commit data, Code Researcher achieves a 58% crash-resolution rate on the kBenchSyz benchmark, significantly outperforming current state-of-the-art agents like SWE-agent (37.5%).
Introduction
Fixing bugs in systems code—kernels, drivers, and networking stacks—is often considered a "boss level" challenge for automated tools. These systems are massive, often comprising millions of lines of low-level C code involving complex pointer arithmetic and bit manipulation. Furthermore, bugs are frequently reported as cryptic stack traces rather than clear natural language descriptions.
Existing LLM-based agents typically rely on "shallow" exploration, identifying a likely file and attempting a quick fix. In contrast, human experts perform "deep research," tracing data flows across multiple files and investigating years of commit history to understand the original intent behind the code. Code Researcher is designed to automate this deep research process.
Methods
Code Researcher operates through a structured three-phase pipeline: Analysis, Synthesis, and Validation.
1. Analysis (The Research Phase)
The agent enters an iterative loop of reasoning and action. It utilizes a suite of tools to search for symbol definitions, regex patterns in code, and—uniquely—regex patterns within commit messages and diffs. The agent employs specific reasoning strategies, such as "chasing" control and data flow chains and performing "causal analysis" over historical commits. All discovered information is stored in a Structured Context Memory, which includes symbol definitions, code snippets, and relevant past commits.
2. Synthesis
Once the agent determines it has gathered sufficient context, it transitions to the Synthesis phase. Here, it filters the contents of its memory to remove noise and prevent the "lost in the middle" phenomenon common in large-context LLM prompts. The agent then generates a patch. The study found that utilizing reasoning-heavy models like OpenAI's o1 during this phase significantly enhances the quality of the generated patches.
3. Validation
The final phase involves using external tools to compile the modified code and execute a "reproducer script." This ensures that the generated patch actually resolves the reported crash without introducing immediate regressions.
Key Insights and Ideas
The effectiveness of Code Researcher stems from several core design principles:
- Leveraging History: A key finding is that historical commit data serves as a vital map for understanding current bugs. An ablation study revealed that removing the ability to search commit history resulted in a 10% drop in the crash-resolution rate. Past fixes often provide the necessary context to understand why a specific code path exists.
- Deep vs. Shallow Exploration: While standard agents like SWE-agent explore an average of only 1.33 files per attempt, Code Researcher explores an average of 10 files. This thorough investigation allows it to better understand global interactions within the codebase.
- Context Management: Effective synthesis requires more than just data; it requires filtered data. By explicitly filtering the Structured Context Memory, the agent ensures that the most relevant information is prioritized during patch generation.
Key Results
The agent was evaluated on kBenchSyz, a benchmark of 200 validated Linux kernel crashes detected by the Syzkaller fuzzer, and a set of 10 crashes from the FFmpeg multimedia framework.
As shown in the results, Code Researcher achieved a 58% resolution rate on kBenchSyz when using a combination of GPT-4o and o1, compared to 37.5% for a customized SWE-agent baseline. Furthermore, the agent's gathered context showed a 63.7% overlap with the files and symbols referenced in original human-authored fixes, indicating a research process that closely mirrors human expertise. The agent also demonstrated strong generalizability, fixing 7 out of 10 tested FFmpeg crashes.
Limitations and Future Work
Despite its success, Code Researcher has limitations. Qualitative analysis shows it can sometimes produce "overspecialized" patches that fix a specific crash but miss broader architectural improvements. It may also occasionally apply partial fixes, addressing synchronization in one area but missing it in a related function.
Future work will focus on expanding the agent's capabilities to address other systems-level issues, such as performance bottlenecks and resource leaks. The authors also aim to explore longer-horizon tasks that require autonomous investigation over multiple days.
Conclusion
Code Researcher demonstrates that deep research, characterized by iterative exploration and historical analysis, is essential for automating the maintenance of complex systems code. By mimicking human-like investigative strategies, it sets a new state-of-the-art for autonomous crash resolution in large-scale software environments.
Summary updated