AI Papers Reader

Personalized digests of latest AI research

View on GitHub

Look Before You Leap: New AI Framework Teaches Coding Bots to Ask Questions Before Fixing Bugs

Imagine giving a novice mechanic a complex engine blueprint and telling them to fix a rattling noise. Instead of asking how the fuel injector interacts with the exhaust, they immediately grab a wrench and start tightening random bolts. That, in essence, is how even the most advanced Large Language Model (LLM) coding agents approach software bugs today. They often skip the comprehension phase, blindly hunting for keywords and applying trial-and-error patches that violate implicit system rules.

To address this fundamental flaw, researchers from Shanghai Jiao Tong University and partner institutions have introduced ACQUIRE (Agent Collaboration for Question-Answer-driven Issue REsolution). Mirroring the workflow of experienced human developers, the framework forces AI agents to explicitly identify and fill their codebase knowledge gaps before writing a single line of code.

A Trio of Specialized Agents

Instead of relying on a single, overwhelmed AI to diagnose and repair a bug in one go, ACQUIRE orchestrates three specialized agents across two distinct stages:

  1. The Questioner: Analyzes the bug report and generates targeted, category-guided questions about the codebase (e.g., investigating internal system mechanics, API design, or external standards).
  2. The Answerer: Explores the code repository in a safe, read-only mode to find evidence-grounded answers to those questions.
  3. The Resolver: Takes the resulting Q&A knowledge and cleanly synthesizes the final patch.

A Tale of Two Fixes

The power of this “know-before-you-fix” approach is best illustrated by a real-world bug from the Sphinx documentation library. The issue reported that Sphinx incorrectly parsed parenthesized types like :param dict(str, str). It was splitting the text at the space inside the parentheses, misaligning the parameter boundaries.

Without ACQUIRE, a standard AI agent quickly got lost. Misled by surface-level keyword matching, it frantically modified unrelated files like typehints.py and HTML writer modules, ultimately failing after 117 futile steps. It never even looked at the file where the bug actually lived.

With ACQUIRE, the workflow changed entirely. The Questioner asked a precise structural question: How does this repository’s parser handle and extract nested type information? Guided by this prompt, the Answerer bypassed superficial keyword traps, traced the logic to a utility folder, and successfully located the culprit: a naive split command inside a file named docfields.py. Armed with this precise Q&A evidence, the Resolver immediately opened the correct file and implemented a bracket-aware replacement. The entire process succeeded in just 52 steps—a 55% reduction in effort.

Smarter, Faster, Cheaper

Tested on SWE-bench Verified, a rigorous benchmark of 500 real-world GitHub issues, ACQUIRE consistently outperformed traditional pre-repair methods. It raised the bug-resolution success rate (Pass@1) by up to 4.4 percentage points.

Crucially, this boost in accuracy didn’t come with the heavy computational costs of other multi-agent systems, such as those that rely on lengthy peer debates. By decoupling exploration from patch generation, ACQUIRE proved to be both highly efficient and transparent, offering developers a clear, readable log of what the AI asked and learned. It is a major step toward AI coders that think before they act.