إصلاح البرنامج الوكالي من فشل الاختبارات على نطاق واسع: نهج عصبي رمزي مع تحليل ثابت وتعليقات تنفيذ الاختبار Agentic Program Repair From Test Failures at Scale: A Neuro-Symbolic Approach With Static Analysis and Test Execution Feedback

شارك:
المجلة: IEEE Transactions on Software Engineering، المجلد: 52، العدد: 8
DOI: https://doi.org/10.1109/tse.2026.3696849
تاريخ النشر: 2026-05-26
المؤلف: Chandra Maddila وآخرون
الموضوع الرئيسي: تقنيات اختبار البرمجيات وتصحيح الأخطاء

نظرة عامة

في هذا البحث، يقدم المؤلفون وكيل هندسي مصمم لإصلاح الشيفرة المصدرية بشكل مستقل استجابةً لفشل الاختبارات عبر أنظمة برمجية متنوعة داخل منظمات كبيرة. باستخدام نموذج Llama كنموذج أساسي وحزام ReAct، يكون الوكيل قادرًا على تنفيذ سلسلة من 15 إجراءً، بدءًا من قراءة الملفات إلى توليد التصحيحات. تتضمن العملية حلقات تغذية راجعة من خلال التحليل الثابت ونتائج الاختبارات، مما يضمن أن التصحيحات المولدة تلبي معايير ميتا قبل المراجعة البشرية. تشير الدراسة إلى أن نموذجًا متخصصًا بحجم 70B، تم ضبطه بشكل دقيق لتوليد التصحيحات، يتفوق على نموذج Llama-405B الأكبر، خاصة عند استخدام تنسيق “البحث والاستبدال” بدلاً من تنسيق الفرق الموحد القياسي. حقق الوكيل الهندسي معدل حل قياسي قدره 42.3% بمتوسط 11.8 دورة تغذية راجعة.

في تقييم إنتاجي استمر ثلاثة أشهر، تم مراجعة 80% من الإصلاحات المولدة، وتم قبول 31.5% منها في النهاية. سلطت التعليقات النوعية من المهندسين الضوء على الجوانب الإيجابية، مثل الموافقات السريعة والامتنان، ومجالات التحسين، بما في ذلك المشكلات المتعلقة بتقلب الاختبارات التي استدعت تطوير بيئة اختبار أكثر عزلة. تؤكد النتائج على تعقيدات معالجة فشل الاختبارات بشكل مستقل، مما يبرز الحاجة إلى السياق المناسب، والأدوات، وتقنيات التحقق لتعزيز جودة التصحيحات المولدة لمراجعتها وتنفيذها بشكل فعال من قبل المهندسين البشريين.

مقدمة

تناقش مقدمة الورقة تطور إصلاح البرامج الآلي (APR) في هندسة البرمجيات، مع تسليط الضوء على انتقاله من الأنظمة التقليدية القائمة على القواعد إلى تقنيات التعلم الآلي المتقدمة، وخاصة استخدام نماذج اللغة الكبيرة (LLMs). يؤكد المؤلفون على أهمية دمج النماذج الإحصائية ونماذج التعلم العميق، التي تعزز قدرات APR في مهام مثل تحديد الأخطاء، وتوليد التصحيحات، والتصنيف. يقترحون وكيلًا هندسيًا جديدًا يقوم بأتمتة عملية الإصلاح بدءًا من اختبار فاشل، باستخدام نهج منظم يتضمن روبوت إدارة فشل الاختبار وحزام ReAct للتفكير وتوليد الإجراءات.

تشمل سير عمل الوكيل الهندسي إعداد بيئة تطوير، وتنفيذ سلسلة من الإجراءات، والتحقق من التصحيحات المولدة من خلال التحليل الثابت والاختبار. تشمل النتائج الرئيسية من بحثهم فعالية المعلومات العصبية الرمزية مقارنة بالنماذج العصبية البحتة، وتأثير تنسيقات التصحيح على أداء LLM، وأهمية نموذج LLM كقاضي لضمان إصلاحات عالية الجودة. كما تفيد الورقة بنشر الوكيل الهندسي في بيئة إنتاجية، مشيرة إلى أن 25.5% من الإصلاحات التي تم إنشاؤها بواسطة الذكاء الاصطناعي تم دمجها بنجاح بعد المراجعة البشرية. بشكل عام، يقدم المؤلفون مساهماتهم لكل من الممارسة الصناعية والبحث في إصلاح البرامج الوكيلة، مما يمهد الطريق لاستكشافات إضافية في الأقسام اللاحقة من الورقة.

طرق

تضمنت المنهجية لتقييم أداء الوكيل الهندسي في مهام إصلاح البرامج تقييمًا شاملًا غير متصل باستخدام معيار TF، وهيكلها حول ثلاثيات من المواصفات، والتصحيحات، والأوراكل. تم تكليف الوكيل بتوليد تصحيحات الشيفرة بناءً على المواصفات المعطاة، والتي تم اختبارها بعد ذلك ضد الفشل المعروف لتحديد ما إذا كانت التصحيحات قد حلت المشكلات. تم إجراء التقييم عبر أربعة إعدادات متميزة، مع تغيير التغذية الراجعة المقدمة للوكيل: (1) بدون أي تغذية راجعة، (2) مع تغذية راجعة من أداة التحليل الثابت، (3) مع تغذية راجعة من تنفيذ الاختبار، و(4) مع مزيج من كلا النوعين. تم وضع مقاييس رئيسية لتقييم أداء الوكيل، بما في ذلك معدل الحل (SR)، ومعدل توليد التصحيحات (PGR)، وعدد التكرارات (IC)، ومعدل الخطأ (ER).

بعد التقييم غير المتصل، تم نشر الوكيل تدريجيًا في بيئة إنتاجية، بدءًا من 10% من مهام فشل الاختبار وزيادة النسبة إلى 100%. شمل الإطلاق التحقق التلقائي والعينات اليدوية من الفروقات المولدة لضمان الجودة. تضمنت المقاييس عبر الإنترنت التي تم مراقبتها خلال هذه المرحلة حجم النشر، ومعدل المراجعة، ومعدل الهبوط، وحجم الهبوط، والتي قيمت بشكل جماعي تأثير الوكيل وفعاليته في حل فشل الاختبارات. بالإضافة إلى ذلك، تم جمع وتحليل التعليقات النوعية من المهندسين لتحديد الموضوعات لتحسينات إضافية، مما يضمن فائدة ودقة الوكيل الهندسي في التطبيقات الواقعية.

نتائج

في هذا القسم، يقدم المؤلفون نتائج المعايير غير المتصلة لوكيلهم الهندسي، مع التركيز على قدرات توليد التصحيحات لمختلف النماذج وتنسيقات الفرق. تم استخدام معيار PatchGen، الذي يتكون من 210 أزواج من ملفات الإدخال، وتعليمات اللغة الطبيعية (NL)، والأوراكل الاختبارية، لتقييم أفضل معدل حل (SR) تم تحقيقه بواسطة تكوينات مختلفة. كشفت الدراسة أن تنسيق الفرق البحث والاستبدال حقق أعلى معدل حل قدره 53%، متفوقًا بشكل كبير على تنسيقات الفرق الموحدة والخطية، التي حققت معدلات 30% و26% على التوالي. بالإضافة إلى ذلك، حسنت التعليمات التفصيلية معدل الحل بمقدار 4 إلى 11 نقطة مئوية مقارنة بالتعليمات عالية المستوى. من بين النماذج المختبرة، أظهر نموذج iCodeLlama-70B المضبوط بشكل دقيق أداءً تنافسيًا، متجاوزًا حتى نموذج Llama-405B الأكبر في بعض السيناريوهات.

تم تقييم أداء الوكيل الهندسي بشكل أكبر من خلال تطبيقه في حالات فشل الاختبار الواقعية، حيث حقق معدل حل قدره 43.9% عند استخدام تغذية راجعة من تنفيذ الاختبار. حسنت دمج أدوات التحليل الثابت معدل الحل إلى 34.1%، بينما أدى الجمع بين كلا نوعي التغذية الراجعة إلى انخفاض طفيف في معدل الحل ولكنه قلل بشكل كبير من معدل الخطأ من 1.0% إلى 0.2%. استكشف المؤلفون أيضًا تأثير الجولات المتكررة، حيث وجدوا أن خمس جولات مستقلة زادت معدل الحل إلى 61.0%. أخيرًا، تم ضبط LLM كقاضي لضمان جودة التصحيحات، محققًا دقة عالية قدرها 0.86 في تحديد التصحيحات غير المقبولة. في الإنتاج، نشر الوكيل الهندسي ما يقرب من 1,600 فرق على مدار ثلاثة أشهر، مع معدل قبول قدره 25.5%، مما يشير إلى فعاليته في توليد حلول عالية الجودة للمهندسين.

مناقشة

يعمل الوكيل الهندسي، كما هو موضح في الشكل 1، بالتعاون مع روبوت إدارة فشل الاختبار (TFMB) لمعالجة فشل الاختبارات في الشيفرة. عند اكتشاف فشل، يقوم TFMB بإنشاء مهمة تتضمن تفاصيل ذات صلة مثل تتبع المكدس ورسائل الخطأ، والتي يتم توفيرها بعد ذلك للوكيل الهندسي. يستخدم هذا الوكيل إطار عمل ثلاثي، يتم تمثيله كـ ⟨Specification, Patch, Oracle⟩، حيث تحدد المواصفة المهمة، والتصحيح هو الإصلاح المقترح، والأوراكل يعمل كآلية تحقق لضمان أن التصحيح يحل الفشل. يستخدم الوكيل الهندسي حلقة ReAct لتوليد الأفكار والإجراءات بشكل تكراري، مستفيدًا من تقنيات الذكاء الاصطناعي العصبية الرمزية للتنقل بفعالية في بيئة البرمجة.

تعتبر عملية توليد التصحيحات حاسمة، حيث يجب على الوكيل إنتاج إصلاح شيفرة صالح. يعمل المُصحح بشكل مستقل عن طبقة التنسيق، حيث يقوم بتوليد التصحيحات بناءً على الشيفرة السياقية وتعليمات اللغة الطبيعية. يتم تقييم التصحيحات المولدة مقابل معيار، معيار TF، الذي يتكون من حالات فشل اختبار حقيقية وحلول كتبها البشر. يتم التحقق من التصحيحات من خلال أدوات التحليل الثابت وتنفيذ الاختبار، مما يضمن أن الشيفرة المولدة تتوافق مع معايير الجودة وتحل الفشل المحدد. بالإضافة إلى ذلك، يتم استخدام LLM كقاضي لتقييم قبول التصحيحات بناءً على تفضيلات البشر، مما يعزز جودة المخرجات قبل تقديمها لمراجعة الشيفرة. تهدف هذه المقاربة الشاملة إلى تعزيز موثوقية وكفاءة عملية تطوير البرمجيات في ميتا.

Journal: IEEE Transactions on Software Engineering, Volume: 52, Issue: 8
DOI: https://doi.org/10.1109/tse.2026.3696849
Publication Date: 2026-05-26
Author(s): Chandra Maddila et al.
Primary Topic: Software Testing and Debugging Techniques

Overview

In this research, the authors present an Engineering Agent designed to autonomously repair source code in response to test failures across diverse software systems within large organizations. Utilizing Llama as a foundational model and the ReAct harness, the agent is capable of executing a series of 15 actions, from reading files to generating patches. The process involves feedback loops through static analysis and test results, ensuring that the generated patches meet Meta’s standards before human review. The study reports that a specialized 70B model, fine-tuned for patch generation, outperforms the larger Llama-405B model, particularly when using a “search-and-replace” format over the standard unified diff format. The Engineering Agent achieved a benchmark solve rate of 42.3% with an average of 11.8 feedback iterations.

In a three-month production evaluation, 80% of the generated fixes were reviewed, with 31.5% ultimately accepted. Qualitative feedback from engineers highlighted both positive aspects, such as quick approvals and gratitude, and areas for improvement, including issues with test flakiness that necessitated the development of a more isolated testing environment. The findings underscore the complexities of autonomously addressing test failures, emphasizing the need for appropriate context, tools, and validation techniques to enhance the quality of generated patches for human engineers to review and implement effectively.

Introduction

The introduction of the paper discusses the evolution of Automated Program Repair (APR) in software engineering, highlighting its transition from traditional rule-based systems to advanced machine learning techniques, particularly the use of large language models (LLMs). The authors emphasize the significance of integrating statistical and deep learning models, which enhance APR capabilities in tasks such as fault localization, patch generation, and ranking. They propose a novel Engineering Agent that automates the repair process starting from a failing test, utilizing a structured approach involving a Test Failure Management Bot and a ReAct harness for reasoning and action generation.

The Engineering Agent’s workflow includes setting up a development environment, executing a series of actions, and verifying the generated patches through static analysis and testing. Key findings from their research include the effectiveness of neuro-symbolic information over purely neural models, the impact of patch formats on LLM performance, and the importance of a calibrated LLM-as-a-Judge to ensure high-quality fixes. The paper also reports on the deployment of the Engineering Agent in a production environment, noting that 25.5% of AI-generated fixes were successfully integrated after human review. Overall, the authors present their contributions to both industrial practice and research in agentic program repair, setting the stage for further exploration in subsequent sections of the paper.

Methods

The methodology for evaluating the Engineering Agent’s performance in program repair tasks involved a comprehensive offline evaluation using the TF Benchmark, structured around triplets of specifications, patches, and oracles. The agent was tasked with generating code patches based on given specifications, which were then tested against known failures to determine if the patches resolved the issues. The evaluation was conducted across four distinct settings, varying the feedback provided to the agent: (1) without any feedback, (2) with static analysis tool feedback, (3) with test execution feedback, and (4) with a combination of both. Key metrics were established to assess the agent’s performance, including Solve Rate (SR), Patch Generation Rate (PGR), Iteration Count (IC), and Error Rate (ER).

Following the offline evaluation, the agent was progressively deployed in a production environment, starting with 10% of test-failure tasks and scaling up to 100%. The rollout included automatic validation and manual sampling of generated diffs to ensure quality. Online metrics monitored during this phase included Published Volume, Review Rate, Land Rate, and Landed Volume, which collectively assessed the agent’s impact and effectiveness in solving test failures. Additionally, qualitative feedback from engineers was collected and analyzed to identify themes for further improvements, ensuring the Engineering Agent’s utility and accuracy in real-world applications.

Results

In this section, the authors present the results of offline benchmarks for their Engineering Agent, focusing on the patch generation capabilities of various models and diff formats. The PatchGen benchmark, consisting of 210 tuples of input files, natural language (NL) instructions, and test oracles, was utilized to evaluate the best Solve Rate (SR) achieved by different configurations. The study revealed that the search-replace diff format yielded the highest solve rate of 53%, significantly outperforming the unified and line diff formats, which achieved rates of 30% and 26%, respectively. Additionally, detailed instructions improved the solve rate by 4 to 11 percentage points compared to high-level instructions. Among the models tested, the fine-tuned iCodeLlama-70B model demonstrated competitive performance, even surpassing the larger Llama-405B model in certain scenarios.

The Engineering Agent’s performance was further assessed through its application in real-world test failures, where it achieved a solve rate of 43.9% when utilizing test execution feedback. The integration of static analysis tools improved the solve rate to 34.1%, while combining both feedback types resulted in a slight decrease in solve rate but significantly reduced the error rate from 1.0% to 0.2%. The authors also explored the impact of repeated runs, finding that five independent runs increased the solve rate to 61.0%. Finally, the LLM-as-a-Judge was calibrated to ensure the quality of patches, achieving a high precision of 0.86 in identifying unacceptable patches. In production, the Engineering Agent published nearly 1,600 diffs over three months, with a 25.5% acceptance rate, indicating its effectiveness in generating high-quality solutions for engineers.

Discussion

The Engineering Agent, as depicted in Figure 1, operates in conjunction with the Test Failure Manager Bot (TFMB) to address test failures in code. Upon detecting a failure, the TFMB generates a task that includes relevant details such as stack traces and error messages, which are then provided to the Engineering Agent. This agent employs a triplet framework, represented as ⟨Specification, Patch, Oracle⟩, where the Specification outlines the task, the Patch is the proposed fix, and the Oracle serves as the validation mechanism to ensure the patch resolves the failure. The Engineering Agent utilizes a ReAct loop to iteratively generate thoughts and actions, leveraging neuro-symbolic AI techniques to navigate the coding environment effectively.

The patch generation process is critical, as the agent must produce a valid code fix. The patcher operates independently from the orchestration layer, generating patches based on contextual code and natural language instructions. The generated patches are evaluated against a benchmark, TF Benchmark, which consists of real test failures and human-authored solutions. Validation of the patches occurs through static analysis and test execution tools, ensuring that the generated code adheres to quality standards and resolves the identified failures. Additionally, an LLM is employed as a judge to assess the acceptability of the patches based on human preferences, further refining the output quality before submission for code review. This comprehensive approach aims to enhance the reliability and efficiency of the software development process at Meta.