A hierarchical code review method and system based on Agentic AI evidence chain reasoning

By employing a layered code review method based on Agentic AI evidence chain reasoning, which combines static analysis and artificial intelligence models, the shortcomings of existing code review technologies in terms of efficiency, accuracy, and reliability are addressed. This approach enables efficient and accurate code problem detection and remediation suggestions, generating interpretable and traceable review reports.

CN122111497APending Publication Date: 2026-05-29KEDA ZHILING (BEIJING) TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
KEDA ZHILING (BEIJING) TECHNOLOGY CO LTD
Filing Date
2025-12-31
Publication Date
2026-05-29

Smart Images

  • Figure CN122111497A_ABST
    Figure CN122111497A_ABST
Patent Text Reader

Abstract

The disclosure provides a layered code review method and system based on Agentic AI evidence chain reasoning, relating to the technical field of artificial intelligence. The disclosure obtains a review result by performing multi-level review on code data; performs evidence chain reasoning on the review result to obtain a target evidence chain corresponding to the review result; performs repair analysis on the review result based on the target evidence chain to generate a target repair suggestion corresponding to the review result; performs multi-path verification on the review result to obtain a target confidence of the review result; and generates a review report of the code data according to the review result, the target evidence chain corresponding to the review result, the target repair suggestion, and the target confidence. The review report is generated based on the collaborative mechanism of layered review, evidence chain reasoning, repair suggestion, and multi-path verification, realizing a multi-dimensional intelligent review process of the code data, improving the explainability and reliability of the review result, and meeting the requirements of current code review for efficiency, accuracy, and reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a layered code review method and system based on Agentic AI evidence chain reasoning. Background Technology

[0002] After developers complete the code, the code needs to be reviewed to ensure that it meets certain quality requirements.

[0003] Currently, code review can be conducted using static analysis tools. These tools primarily rely on predefined rules, offering fast review speeds but being entirely rule-based and unable to understand code semantics and logic, and potentially resulting in a certain percentage of false positives. On the other hand, code review can be performed using artificial intelligence (AI) models. While AI models can understand the semantics of code through natural language processing, the reliability of their review results is uncertain and requires further optimization.

[0004] Therefore, existing code review methods are insufficient to meet the current multiple requirements of code review in terms of efficiency, accuracy, and reliability. Summary of the Invention

[0005] To address the problems existing in the aforementioned related technologies, this disclosure provides a layered code review method and system based on Agentic AI evidence chain reasoning.

[0006] The first aspect of this disclosure provides a layered code review method based on Agentic AI evidence chain reasoning, including: Receive code data to be reviewed; The code data is reviewed at multiple levels to obtain the review results, which include multiple code issues identified at each level. Perform evidence chain reasoning on each code issue to generate the target evidence chain corresponding to the review results; Based on the target evidence chain, the review results are analyzed for repair, and target repair suggestions are generated corresponding to the review results. Perform multi-path verification on each code issue and generate a target confidence level for the review results; Based on the review results, the target evidence chain, the target remediation suggestions, and the target confidence level, a review report of the code data is generated.

[0007] Optionally, the above-mentioned multi-level review of code data yields the following review results: Based on a pre-set static analysis tool, the code data is analyzed and checked for syntax and style issues to identify syntax and style problems. Based on a pre-set artificial intelligence model, semantic analysis and inspection of code data are performed to identify logical and rule-related issues in the code data. Obtain context data of the code data, and perform global analysis and inspection of the code data based on the context data through a preset artificial intelligence model to obtain cross-file dependency issues and specification issues of the code data. The context data includes at least the commit history of the code data, the preset project specifications of the code data, and the cross-file dependency graph of the code data. Based on a pre-set artificial intelligence model, the code data is analyzed and inspected to identify design and structural problems. Syntax issues, style issues, logic issues, rule issues, cross-file dependency issues, specification issues, design issues, and structural issues are identified as code issues in the code data, and review results of the code data are generated based on these code issues.

[0008] Optionally, the above-mentioned evidence chain reasoning for each code issue generates the target evidence chain corresponding to the review result, including: We build issue discovery data for code issues, which includes code issues, the sources of review for code issues, and the location where the issues occurred. Obtain contextual data of code data, and use a preset artificial intelligence model to perform causal reasoning on code issues based on code data, problem discovery data, and contextual data to obtain the preliminary causes of code issues. Among them, contextual data includes at least the code data's commit history, the code data's preset project specifications, and the code data's cross-file dependency graph. The initial causes were verified and adjusted through multiple paths to determine the target cause of the code problem. Gather evidence of code issues from the sources of the review; Based on the problem discovery data, the causes of the target, and the evidence of its occurrence, construct the evidence chain corresponding to the code problem; Based on the evidence chain corresponding to each code issue, construct the target evidence chain corresponding to the review results.

[0009] Optionally, the above-mentioned multi-path verification and adjustment of the initial cause yields the target cause of the code problem, including: Based on a pre-set artificial intelligence model, the reasoning chain of the initial cause is reflexively reviewed to obtain the first verification result, which includes whether the reasoning chain of the initial cause satisfies the pre-set reasoning logic. The initial cause is compared with the preset project specifications to generate a second verification result, which includes whether the initial cause meets the requirements of the preset project specifications. Based on the first and second verification results, the preliminary cause is adjusted to obtain the target cause. The reasoning chain of the target cause satisfies the preset reasoning logic and the target cause meets the requirements of the preset project specifications.

[0010] Optionally, the above-mentioned remediation analysis of the review results based on the target evidence chain generates target remediation suggestions corresponding to the review results, including: For each code issue identified in the review results, a repair analysis is performed based on the target evidence chain to generate corresponding repair suggestions. Based on the remediation suggestions for each code issue in the review results, construct the target remediation suggestions corresponding to the review results.

[0011] Optionally, the above multi-path verification of each code issue, generating the target confidence level of the review results, includes: For each code issue, perform multi-path validation to obtain the confidence level of the code issue; The target confidence level of the review results is obtained by weighted summation of the confidence levels of each code issue.

[0012] Optionally, the above multi-path verification of code issues to obtain the confidence level of the code issues includes: By using a pre-set artificial intelligence model, the authenticity of code issues is evaluated based on the target evidence chain, and a first confidence level of the code issues relative to the target evidence chain is generated. Based on the preset project specifications, the code issues are checked for rule consistency, and a second confidence level of the code issues relative to the preset project specifications is generated. Obtain target historical code issues similar to the code issue, perform historical false positive analysis on the code issue based on the target historical code issues, and generate the third confidence level of the code issue relative to the target historical code issues; The code data is examined using a pre-set static analysis tool to obtain static analysis results. Based on the difference between the code problem and the static analysis results, a fourth confidence level of the code problem relative to the static analysis results is generated. The confidence score of the code problem is obtained by weighted summation of the first, second, third, and fourth confidence scores.

[0013] Optionally, the above-mentioned analysis of historical false positives of the code problem based on the target historical code problem corresponding to the code problem, generating a third confidence level of the code problem relative to the target historical code problem, includes: Retrieve the target historical code issue corresponding to the code issue; Calculate the acceptance and fix rates for target historical code issues; Based on the acceptance rate and the repair rate, the third confidence level of the code problem relative to the target historical code problem is calculated.

[0014] Optionally, the context data for obtaining code data mentioned above includes: Perform contextual analysis on code data to obtain the commit history, preset project specifications, and cross-file dependency graph; Contextual data for code data is constructed based on commit history, predefined project specifications, and cross-file dependency graphs.

[0015] The second aspect of this disclosure provides a hierarchical code review system based on Agentic AI evidence chain reasoning, including: The receiving module is used to receive code data to be reviewed; The multi-level review module is used to perform multi-level reviews of code data and obtain the review results, which include multiple code issues identified at each level. The evidence chain reasoning module is used to perform evidence chain reasoning on various code issues and generate the target evidence chain corresponding to the review results. The remediation suggestion generation module is used to perform remediation analysis on the review results based on the target evidence chain and generate target remediation suggestions corresponding to the review results. The multi-path verification module is used to perform multi-path verification on various code issues and generate the target confidence score of the review results; The report generation module is used to generate review reports on code data based on review results, target evidence chains, target remediation suggestions, and target confidence levels.

[0016] A third aspect of this disclosure provides a computer device comprising: The memory and processor, wherein the memory stores a computer program that, when executed by the processor, implements the layered code review method based on Agentic AI evidence chain reasoning as described in the first aspect above.

[0017] The fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the layered code review method based on Agentic AI evidence chain reasoning of the first aspect described above. The technical solution provided in this disclosure has the following advantages compared with the prior art: In this embodiment of the disclosure, code data to be reviewed is received; the code data is reviewed at multiple levels to obtain review results, which include multiple code issues identified at each level; evidence chain reasoning is performed on each code issue to generate a target evidence chain corresponding to the review results; the review results are remediated based on the target evidence chain to generate target remediation suggestions corresponding to the review results; multi-path verification is performed on each code issue to generate a target confidence level for the review results; and a review report of the code data is generated based on the review results, target evidence chain, target remediation suggestions, and target confidence level. Therefore, by conducting multi-level reviews of code data, a multi-dimensional intelligent review process is achieved, improving the detection rate of code issues and the credibility of reviews. This ensures review efficiency while increasing review depth and accuracy. Evidence chain reasoning is applied to the review results to obtain the target evidence chain corresponding to the review results. Evidence chain reasoning involves structured decomposition of the review result formation process, breaking down the problem conclusion formation process into multiple independently executable and verifiable reasoning stages. Each stage generates structured intermediate results as input for subsequent reasoning and verification, thus ensuring that the final conclusion has a traceable and verifiable logical source. This ensures that the review results have a complete logical reasoning process and multi-source supporting evidence, thereby improving the interpretability and traceability of the review results. Based on the target evidence chain, the review results are analyzed for repair, generating a review... The corresponding target remediation suggestions for the review results can improve the accuracy and reliability of the remediation plan, realizing intelligent support from problem discovery to remediation; multi-path verification of the review results can obtain the target confidence level of the review results, enabling multi-dimensional quantitative scoring of the review results, reducing the risk of misjudgment, accurately evaluating the review results, and improving the interpretability of the review results; based on the review results, the corresponding target evidence chain, the target remediation suggestions, and the target confidence level, a review report of code data is generated. Based on the collaborative mechanism of layered review, evidence chain reasoning, remediation suggestions, and multi-path verification, the generated review report can provide developers with reliable, complete, traceable, and interpretable code review reports, forming a traceable closed-loop quality control system for code review, meeting the current multiple requirements of code review for review efficiency, accuracy, and reliability.

[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0020] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a flowchart of a layered code review method based on Agentic AI evidence chain reasoning provided in this disclosure embodiment; Figure 2 This is a flowchart of a layered code review method based on Agentic AI evidence chain reasoning provided in this disclosure embodiment; Figure 3 This is a flowchart of a layered code review method based on Agentic AI evidence chain reasoning provided in this disclosure embodiment; Figure 4 This is a flowchart of a layered code review method based on Agentic AI evidence chain reasoning provided in this disclosure embodiment; Figure 5 This is a flowchart of a layered code review method based on Agentic AI evidence chain reasoning provided in this disclosure embodiment; Figure 6 This is a schematic diagram of the structure of a layered code review system based on Agentic AI evidence chain reasoning provided in an embodiment of this disclosure; Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure. Detailed Implementation

[0022] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0023] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0024] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0025] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0026] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0027] Currently, on the one hand, static code analysis tools can be used to review code. Static code analysis tools mainly rely on predefined rules to review code. Although this method is faster, it is completely dependent on rule matching, cannot understand the semantics and logic of the code, and may have a certain percentage of false positives.

[0028] For example, Pylint and ESLint are widely used static code analysis tools. They generate abstract syntax trees by parsing source code and then perform pattern matching based on predefined rule sets. Their core advantages lie in their fast inspection speed and high accuracy in detecting syntax rules, enabling them to quickly identify explicit issues such as formatting, naming, and syntax problems. Their limitations lie in analyzing logical dependency rule matching rather than semantic understanding; they can only detect issues conforming to predefined patterns and cannot understand business logic or complex semantic relationships, making it difficult to detect logical errors and contextual issues. Furthermore, these tools typically only support single-file analysis and lack comprehensive judgment of cross-module dependencies and global context.

[0029] On the other hand, some artificial intelligence models can be used to review code. Although artificial intelligence models can understand the semantics of code through natural language understanding, the reliability of the review results output by artificial intelligence models is difficult to guarantee and still needs further optimization.

[0030] For example, CodeRabbit is an AI model for code review that uses the model's natural language understanding capabilities to analyze code, introducing preliminary semantic analysis features. However, the integration of such models is mostly done through single model calls, which is a black-box reasoning process. The reliability and consistency of the model's output results are difficult to guarantee, and traceability is insufficient, so reliability and interpretability issues still exist in engineering practice.

[0031] To better understand the inventive concept of the embodiments of this disclosure, the technical solutions of the embodiments of this disclosure will be described below in conjunction with exemplary embodiments.

[0032] The hierarchical code review method based on Agentic AI (Agentic Artificial Intelligence) evidence chain reasoning provided in this disclosure can be executed by a hierarchical code review system based on Agentic AI evidence chain reasoning. This hierarchical code review system can be configured for use on a computer device. The computer device can be understood as any device with processing and computing capabilities. This device can include, but is not limited to, mobile terminals such as smartphones, laptops, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), in-vehicle terminals, wearable devices, etc., as well as fixed electronic devices such as digital TVs, desktop computers, etc.

[0033] Agentic AI can be understood as an AI system with autonomous perception, reasoning, planning and execution capabilities. It can complete multi-step tasks independently without human control and achieve continuous optimization through a closed loop of perception, reasoning, execution and learning.

[0034] Figure 1 This is a flowchart of a layered code review method based on Agentic AI evidence chain reasoning, as provided in this disclosure embodiment. Figure 1 As shown, the layered code review method based on Agentic AI evidence chain reasoning provided in this embodiment includes the following steps: Step 110: Receive the code data to be reviewed.

[0035] In this embodiment of the disclosure, the layered code review system based on Agentic AI evidence chain reasoning can receive code data to be reviewed. Here, code data can be understood as code data written or uploaded by developers.

[0036] For example, code data can be code change data.

[0037] Step 120: Conduct multi-level review of the code data to obtain the review results, which include multiple code issues identified at each level.

[0038] In this embodiment of the disclosure, after receiving the code data to be reviewed, the hierarchical code review system can perform multi-level review of the code data to obtain the review results of the code data. The review results may include multiple code issues identified at each level.

[0039] Step 130: Perform evidence chain reasoning on each of the code issues to generate the target evidence chain corresponding to the review result.

[0040] In this embodiment of the disclosure, for each code issue in the review results, the hierarchical code review system can perform evidence chain reasoning on the code issue to generate an evidence chain corresponding to the code issue. Based on the evidence chains corresponding to each code issue in the review results, a target evidence chain corresponding to the review results is constructed, that is, the target evidence chain includes the evidence chains corresponding to each code issue in the review results.

[0041] The chain of evidence for a code problem can be understood as the reasoning path and supporting evidence for the code problem.

[0042] The target evidence chain corresponding to the review results can be understood as the reasoning path and supporting evidence for the review results.

[0043] The chain of evidence is not about interpreting the conclusion after it has been generated; in fact, the chain of evidence reasoning is a structured decomposition of the process of forming the review result. It breaks down the process of forming the conclusion into multiple independent reasoning stages that can be executed and verified. Each stage generates structured intermediate results that serve as inputs for subsequent reasoning and verification, thus giving the final conclusion a traceable and verifiable logical source.

[0044] Step 140: Perform a repair analysis on the review results based on the target evidence chain and generate target repair suggestions corresponding to the review results.

[0045] In this embodiment of the disclosure, the layered code review system can perform repair analysis on the review results based on the target evidence chain and generate target repair suggestions corresponding to the review results.

[0046] The target repair suggestions may include data such as the repair code, the repair principle, the consequences of not repairing, and the correctness verification results of the repair code.

[0047] In some embodiments, the above-described remediation analysis of the review results based on the target evidence chain, generating target remediation suggestions corresponding to the review results, may include S11-S12: S11. For each code issue in the review results, perform a repair analysis on the code issue based on the target evidence chain and generate corresponding repair suggestions.

[0048] In this embodiment of the disclosure, for each code issue in the review results, the layered code review system can perform a repair analysis on the code issue based on the target evidence chain and generate a repair suggestion corresponding to the code issue.

[0049] The suggested fixes for code issues may include the corresponding fix code, the underlying principles of the fix, the consequences of not fixing the code issue, and the verification results of the correctness of the fix code.

[0050] S12. Based on the remediation suggestions for each code issue in the review results, construct the target remediation suggestions corresponding to the review results.

[0051] In this embodiment of the disclosure, the layered code review system can construct target repair suggestions corresponding to the review results based on the repair suggestions corresponding to each code problem in the review results.

[0052] Step 150: Perform multi-path verification on each code issue and generate the target confidence level of the review results.

[0053] In this embodiment of the disclosure, the layered code review system can perform multi-path verification on each code issue in the review results to obtain the confidence level of each code issue, and construct the target confidence level of the review results based on the confidence level of each code issue.

[0054] Confidence can be understood as an indicator that measures the credibility of a judgment, prediction, or conclusion.

[0055] The target confidence level can be understood as an indicator that measures the credibility of the review results.

[0056] The higher the target confidence level, the more credible the review results; the lower the target confidence level, the less credible the review results.

[0057] Step 160: Based on the review results, the target evidence chain, and the target confidence level, generate a review report of the code data.

[0058] In this embodiment of the disclosure, the layered code review system can generate a code data review report based on the review results of the code data, the target evidence chain corresponding to the review results, and the target confidence level of the review results. That is, the code data review report may include the review results of the code data, the target evidence chain corresponding to the review results, and the target confidence level of the review results.

[0059] This disclosure embodiment obtains review results through multi-level review of code data, realizing a multi-dimensional intelligent review process, improving the detection rate of code issues and the credibility of the review, and increasing review depth and accuracy while ensuring review efficiency; evidence chain reasoning is performed on the review results to obtain the target evidence chain corresponding to the review results. Evidence chain reasoning is a structured reasoning decomposition of the formation process of the review results, breaking down the formation process of the problem conclusion into multiple independently executable and verifiable reasoning stages. Each stage generates structured intermediate results as inputs for subsequent reasoning and verification, thereby ensuring that the final conclusion has a traceable and verifiable logical source, ensuring that the review results have a complete logical reasoning process and multi-source supporting evidence, thus improving the interpretability and traceability of the review results; repair analysis is performed on the review results based on the target evidence chain, generating… The system generates target remediation suggestions corresponding to the review results, which can improve the accuracy and reliability of the remediation plan and realize intelligent support from problem discovery to remediation. Multi-path verification of the review results yields the target confidence level, enabling multi-dimensional quantitative scoring of the review results, reducing the risk of misjudgment, accurately evaluating the results, and improving their interpretability. Based on the review results, the corresponding target evidence chain, the target remediation suggestions, and the target confidence level, a review report of the code data is generated. This review report, generated through a collaborative mechanism of layered review, evidence chain reasoning, remediation suggestions, and multi-path verification, provides developers with a reliable, complete, traceable, and interpretable code review report, forming a traceable closed-loop quality control system for code review, meeting the current multiple requirements of code review for efficiency, accuracy, and reliability. This disclosure constructs a closed-loop intelligent code review system through the collaborative design of layered review, evidence chain reasoning, remediation analysis, and multi-path verification. The above mechanisms are interdependent and mutually constraining; no single mechanism can achieve the comprehensive technical effects of this invention in terms of interpretability, reliability, and false alarm suppression if existing alone.

[0060] In some embodiments of this disclosure, the above-described multi-level review of code data yields review results, and the layered code review system based on Agentic AI evidence chain reasoning can be executed. Figure 2 A flowchart is provided for a layered code review method based on Agentic AI evidence chain reasoning, such as... Figure 2 As shown, the layered code review method based on Agentic AI evidence chain reasoning provided in this embodiment includes the following steps: Step 210: Perform syntax style analysis and inspection on the code data based on the preset static analysis tool to obtain syntax and style problems in the code data.

[0061] In this embodiment of the disclosure, the layered code review system can input code data into a preset static analysis tool, perform syntax analysis and checks on the code data based on the preset static analysis tool to obtain syntax problems in the code data, and perform style analysis and checks on the code data to obtain style problems in the code data.

[0062] Code syntax can be understood as the basic rules of the programming language used to write code. It defines the structure and writing style of the code and mainly includes elements such as variables, constants and operators.

[0063] Code style can be understood as a set of conventions and standards followed when writing code, covering multiple aspects such as naming, indentation, bracket placement, and comments.

[0064] For example, syntax style issues in code data can include syntax errors, non-standard naming, and unused variables.

[0065] Preset static analysis tools can be understood as pre-defined tools used for static analysis and inspection of code. For example, preset static analysis tools may include static analysis tools such as Pylint and ESLint.

[0066] Step 220: Perform semantic analysis and inspection on the code data based on the preset artificial intelligence model to obtain the logical problems in the code data.

[0067] In this embodiment of the disclosure, the layered code review system can input code data into a preset artificial intelligence model, perform semantic analysis and inspection on the code data based on the preset artificial intelligence model, and obtain logical problems in the code data.

[0068] For example, logical problems in code data can include logical errors, violations of business rules, and potential algorithmic risks.

[0069] For example, pre-set artificial intelligence models may include Large Language Model (LLM), Generative Pre-trained Transformer (GPT), etc.

[0070] Large language models can be understood as natural language processing models trained on a large amount of text data based on deep learning. Large language models can generate natural language text or understand the semantics of language text.

[0071] Generative pre-trained transformers can be understood as a language model based on artificial intelligence technology. They are widely used in the field of natural language processing. Through pre-training on a large-scale corpus, they learn the statistical patterns of language and can generate coherent and natural text.

[0072] Step 230: Obtain the context data of the code data, and perform global analysis and inspection of the code data based on the context data using a preset artificial intelligence model to obtain cross-file dependency issues and specification issues of the code data.

[0073] In this embodiment of the disclosure, the layered code review system can obtain the context data of the code data, input the context data and the code data into a preset artificial intelligence model, and perform global analysis and inspection of the code data based on the context data through the preset artificial intelligence model to obtain cross-file dependency issues and specification issues of the code data.

[0074] The context data of the code data can include at least the code data commit history, the code data preset project specifications, and the code data cross-file dependency graph.

[0075] The commit history of code data can be understood as the evolution process of code data from its initial version to the current version. It is a collection of all change records that occur to code data over time within a code version control system. The commit history of code data can include previous versions of the code data, the context of each change, the reason for each change, the executor of each change, and the precise content of each change.

[0076] For example, you can retrieve the commit history of code data from a code version control system.

[0077] For example, a code version control system could be a Git system.

[0078] Git (global information tracker) can be understood as a global information tracker.

[0079] Git can be understood as a distributed version control system. Git allows developers to clone the complete code repository locally and commit changes independently without relying on a central server, and can efficiently manage the code version history of a project.

[0080] Pre-defined project specifications for code data can be understood as a set of unified rules followed by the software project to which the code data belongs during the development process. Pre-defined project specifications are formal agreements established to ensure code readability, consistency, maintainability, and team collaboration efficiency. Pre-defined project specifications typically cover the entire process of rules, from naming to directory structure, from code style to submission standards.

[0081] A cross-file dependency graph of code data can be understood as a graph representing the relationship between the definitions, data, or functions of one or more files that each file or module in the code data depends on for normal operation. A cross-file dependency graph means that when a file that is depended on in the code data changes, the files that depend on it usually also need to be recompiled or updated to ensure the consistency and correctness of the code data and the code data context.

[0082] In some embodiments, the hierarchical code review system can perform contextual analysis on code data to obtain the commit history of code data, the preset project specifications of code data, and the cross-file dependency graph of code data, and construct contextual data of code data based on the commit history of code data, the preset project specifications of code data, and the cross-file dependency graph of code data.

[0083] Cross-file dependency issues can be understood as problems that break cross-file dependency relationships. For example, cross-file dependency issues can include destructive changes, interface incompatibility, and other problems.

[0084] A specification issue can be understood as a violation of the specifications in the pre-defined project specifications. For example, a specification issue may include a violation of one or more specifications in the pre-defined project specifications.

[0085] Step 240: Perform architectural analysis and inspection on the code data based on the preset artificial intelligence model to identify design and structural problems in the code data.

[0086] In this embodiment of the disclosure, the layered code review system can input code data into a preset artificial intelligence model, perform architectural analysis and inspection on the code data based on the preset artificial intelligence model, and obtain design and structural problems in the code data.

[0087] For example, design problems can include design pattern problems.

[0088] Design patterns can be understood as reusable, proven, and structured solutions to recurring problems in software design. Design patterns can include creational patterns, structural patterns, and behavioral patterns.

[0089] For example, design pattern issues may include whether design patterns are used appropriately or whether they are misused.

[0090] Structural issues can include architectural consistency problems and potential technical debt.

[0091] The architecture consistency problem can be understood as the actual code implementation gradually deviating from the established system architecture design, layering principles, or module boundaries, resulting in system structure distortion, evolution difficulties, and risk accumulation.

[0092] Technical debt can be understood as deficiencies, defects, unreasonable design, or non-standard implementation problems that arise in code during its design, implementation, or maintenance due to various factors (such as time pressure, lack of experience, changes in business requirements, etc.). Technical debt increases the maintenance cost of code.

[0093] Step 250: Identify syntax issues, style issues, logic issues, rule issues, cross-file dependency issues, specification issues, design issues, and structural issues as code issues in the code data, and generate review results for the code data based on these code issues.

[0094] In this embodiment of the disclosure, the layered code review system can identify syntax problems, style problems, logic problems, rule problems, cross-file dependency problems, specification problems, design problems, and structural problems of code data as code problems, and generate review results of code data based on code problems.

[0095] Therefore, by performing syntax, style, semantic, global, and architectural analysis and inspection on code data, code problems can be identified. These problems can include syntax issues, style issues, logic issues, rule issues, cross-file dependency issues, specification issues, design issues, and structural issues. Based on these code problems, review results are generated. By integrating the determinism of static analysis with the semantic understanding capabilities of artificial intelligence models, a multi-dimensional intelligent review process is achieved, improving the problem detection rate of code data and the credibility of review results. This enables a comprehensive analysis of code data from shallow to deep, ensuring that the review results are interpretable and logically consistent.

[0096] In some embodiments, the above-described multi-level review of code data to obtain the review results of the code data may include: Based on a pre-set static analysis tool, the code data is analyzed and checked for syntax and style issues to identify syntax and style problems. Input the code data, along with its syntax and style issues, into a pre-defined AI model. Based on this model, perform semantic analysis and checks on the code data to identify its logical and rule-related issues. Obtain the context data of the code data, input the code data, context data, and logical and rule issues of the code data into the preset artificial intelligence model, and use the preset artificial intelligence model to perform global analysis and inspection of the code data based on the context data to obtain the cross-file dependency issues and specification issues of the code data. The context data includes at least the code data's commit history, the code data's preset project specifications, and the code data's cross-file dependency graph. Input the code data, as well as the cross-file dependency and specification issues of the code data, into a preset artificial intelligence model. Based on the preset artificial intelligence model, perform architectural analysis and inspection on the code data to obtain the design and structural issues of the code data. Syntax issues, style issues, logic issues, rule issues, cross-file dependency issues, specification issues, design issues, and structural issues are identified as code issues in the code data, and review results of the code data are generated based on these code issues.

[0097] Therefore, in multi-level review, the output of the previous layer can serve as the input constraint for the next layer, and the output of each layer can provide a reference for the analysis of the next layer. For example, the code structure and style check results output by the syntax layer can be used to filter obviously invalid analysis paths and serve as the input constraint for the semantic understanding layer; the problem candidates and risk types generated by the semantic understanding layer further serve as the trigger conditions for the context reasoning layer, used to limit the scope of historical submission analysis and dependency analysis; the architecture analysis layer, based on the outputs of the aforementioned layers, makes a comprehensive judgment on the system-level impact; finally, the review results of code data are generated based on the problems obtained from each layer. Thus, multi-level review achieves a synergistic effect in information transmission and progressive problem deepening, realizes a multi-dimensional intelligent review process, improves the problem detection rate of code data and the credibility of review results, improves code review efficiency, realizes comprehensive analysis of code data from shallow to deep, and ensures that the review results have interpretability and logical continuity.

[0098] In some embodiments of this disclosure, the above-described evidence chain reasoning is performed on each code issue to generate the target evidence chain corresponding to the review result. The layered code review system based on Agentic AI evidence chain reasoning can be executed. Figure 3 A flowchart is provided for a layered code review method based on Agentic AI evidence chain reasoning, such as... Figure 3 As shown, the layered code review method based on Agentic AI evidence chain reasoning provided in this embodiment includes the following steps: Step 310: Construct code issue discovery data, which includes code issues, the source of the code issue review, and the location where the issue occurred.

[0099] In this embodiment of the disclosure, the hierarchical code review system can construct code problem discovery data, which may include code problems, the review source of the code problems, and the location where they occur.

[0100] Sources for reviewing code issues can include pre-defined static analysis tools and pre-defined artificial intelligence models.

[0101] The location where a code problem occurs can be understood as the area in the code data corresponding to the code problem.

[0102] Step 320: Obtain the context data of the code data. Based on the code data, the problem discovery data of the code problem, and the context data, the preset artificial intelligence model performs causal reasoning on the code problem to obtain the preliminary cause of the code problem. The context data includes at least the code data's commit history, the code data's preset project specifications, and the code data's cross-file dependency graph.

[0103] In this embodiment of the disclosure, the layered code review system can obtain the context data of the code data, input the code data, the problem discovery data of the code problem, the context data of the code data, and the code problem into a preset artificial intelligence model, and then use the preset artificial intelligence model to perform causal reasoning on the code problem based on the code data, the problem discovery data of the code problem, and the context data of the code data to obtain the preliminary cause of the code problem.

[0104] Step 330: Perform multi-path verification and adjustment on the initial causes to obtain the target cause of the code problem.

[0105] In this embodiment of the disclosure, the layered code review system can perform multi-path verification and adjustment on the preliminary causes of code problems to obtain the target causes of the code problems.

[0106] In some embodiments, performing multi-path verification and adjustment on the initial cause to obtain the target cause of the code problem may include S21-S23: S21. Based on the preset artificial intelligence model, reflectively review the reasoning link of the initial cause to obtain the first verification result. The first verification result includes whether the reasoning link of the initial cause satisfies the preset reasoning logic.

[0107] In this embodiment of the disclosure, the layered code review system can input code data, code problems, problem discovery data of code problems, context data of code data, and preliminary causes of code problems into a preset artificial intelligence model. Through the preset artificial intelligence model, the reasoning chain of the preliminary causes of code problems based on code data, code problems, problem discovery data of code problems, and context data is reflexively reviewed to obtain a first verification result.

[0108] The first verification result may include whether the reasoning chain for the preliminary cause of the code problem meets the preset reasoning logic.

[0109] The preset reasoning logic can be set as needed. For example, the preset reasoning logic may include the premise of reasoning being true, the causal logic being correct, and the initial cause being consistent with the cause of the code problem obtained from the review. There are no restrictions here.

[0110] S22. Compare the preliminary cause with the preset project specifications to generate a second verification result. The second verification result includes whether the preliminary cause meets the requirements of the preset project specifications.

[0111] In this context, whether the preliminary cause meets the requirements of the preset project specifications can be understood as whether the preliminary cause conflicts with the preset project specifications.

[0112] S23. Based on the first and second verification results, the preliminary cause is adjusted to obtain the target cause. The reasoning chain of the target cause satisfies the preset reasoning logic and the target cause meets the requirements of the preset project specification.

[0113] In this embodiment of the disclosure, the layered code review system can adjust the preliminary cause of the code problem based on the first verification result and the second verification result to obtain the target cause of the code problem. The reasoning link of the target cause satisfies the preset reasoning logic and the target cause meets the requirements of the preset project specification.

[0114] Therefore, an artificial intelligence model can be used to self-reflect and verify the initial causes of code problems, obtaining the first verification result; the initial causes are compared with the preset project specifications to generate the second verification result; and the initial causes are adjusted based on the first and second verification results to obtain the target causes of code problems. By performing multiple checks and adjustments on the initial causes, the accuracy of the causes of code problems can be improved.

[0115] Step 340: Gather evidence of the occurrence of code problems from the sources of review.

[0116] In this embodiment of the disclosure, the hierarchical code review system can collect evidence of the occurrence of code problems from the sources of code problem review.

[0117] For example, when the code problem is a syntax problem, the source of the syntax problem review is the default static analysis tool, and evidence of the occurrence of the syntax problem can be collected from the default static analysis tool; When the code problem is a logic problem, the source of the logic problem review is a preset artificial intelligence model, from which evidence of the occurrence of the logic problem can be collected.

[0118] Step 350: Based on the problem discovery data, the cause of the target, and the evidence of its occurrence, construct the evidence chain corresponding to the code problem.

[0119] In this embodiment of the disclosure, the layered code review system can construct an evidence chain corresponding to a code problem based on the problem discovery data, the cause of the target, and the evidence of its occurrence.

[0120] Step 360: Based on the evidence chain corresponding to each code issue, construct the target evidence chain corresponding to the review result.

[0121] In this embodiment of the disclosure, the layered code review system can construct a target evidence chain corresponding to the review results based on the evidence chain corresponding to each code issue in the review results.

[0122] Therefore, code issues can be identified, their causes analyzed, self-verified, and evidence collected to construct evidence chains corresponding to the code issues. Based on the evidence chains corresponding to each code issue, a target evidence chain corresponding to the review results can be constructed. Evidence chain reasoning can be performed on the review results to obtain the target evidence chain corresponding to the review results, forming a traceable and verifiable reasoning link for the review results. This provides structured logical support for the review results. The evidence chain is not a retrospective explanation of the review conclusion, but a structured reasoning decomposition of the process of forming the review results. Each stage of the evidence chain reasoning generates independently verifiable data objects (such as problem discovery data, the cause of the target, and evidence of occurrence). Evidence chain reasoning decomposes the process of forming the problem conclusion into multiple independently executable and verifiable reasoning stages. Each stage generates structured intermediate results as inputs for subsequent reasoning and verification, thereby giving the final conclusion a traceable and verifiable logical source, thus improving the interpretability and traceability of the review results.

[0123] In some embodiments of this disclosure, the multi-path verification of each of the aforementioned code issues is performed to generate the target confidence level of the review results. This can be executed by a layered code review system based on Agentic AI evidence chain reasoning. Figure 4 A flowchart is provided for a layered code review method based on Agentic AI evidence chain reasoning, such as... Figure 4 As shown, the layered code review method based on Agentic AI evidence chain reasoning provided in this embodiment includes the following steps: Step 410: For each code problem, perform multi-path verification to obtain the confidence level of the code problem.

[0124] In this embodiment of the disclosure, the layered code review system can perform multi-path verification on each code issue to obtain the confidence level of the code issue.

[0125] The confidence level of a code question can be understood as a metric used to measure the credibility of a code question. The higher the confidence level of a code question, the more credible the code question; the lower the confidence level of a code question, the less credible the code question.

[0126] The confidence level of a code problem can characterize the reliability and reproducibility of the code problem under the current evidence and verification conditions.

[0127] Step 420: Calculate the weighted sum of the confidence scores for each of the code issues to obtain the target confidence score for the review results.

[0128] In this embodiment of the disclosure, the layered code review system can perform a weighted summation of the confidence levels of each code issue to obtain the target confidence level of the review result.

[0129] The target confidence level of the review results can be understood as an indicator used to measure the credibility of the review results. The higher the target confidence level of the review results, the more credible the review results are; the lower the target confidence level of the review results, the less credible the review results are.

[0130] The target confidence level of the review results can characterize the reliability and reproducibility of the review results under the current evidence and verification conditions.

[0131] Therefore, each code issue in the review results can be verified through multiple paths to obtain the confidence level of each code issue. The confidence levels of each code issue are then weighted and summed to obtain the target confidence level of the review results. When the AI ​​introspection verification path, rule consistency verification path, or static tool verification path gives inconsistent results for the same issue, the system reduces the weight of the conflicting path or marks the issue as a low-confidence issue, thereby avoiding a single reasoning path from having a decisive influence on the final conclusion and effectively reducing the risk of false positives caused by model illusions. When conflicts occur between the AI ​​introspection path, rule consistency path, and static analysis path, the influence of a single path is reduced through weight adjustment or voting mechanisms, forming a verification path of conflict detection—weight reduction—confidence reduction. This allows for multi-dimensional quantitative scoring of each code issue, reducing the risk of misjudgment of code issues, accurately evaluating the review results, and improving the interpretability of the review results.

[0132] In some embodiments of this disclosure, the above-described multi-path verification of code issues yields a confidence level for the code issues, and the layered code review system based on Agentic AI evidence chain reasoning can be executed. Figure 5 A flowchart is provided for a layered code review method based on Agentic AI evidence chain reasoning, such as... Figure 5 As shown, the layered code review method based on Agentic AI evidence chain reasoning provided in this embodiment includes the following steps: Step 510: Using a pre-set artificial intelligence model, assess the authenticity of the code problem based on the target evidence chain and generate the first confidence level of the code problem relative to the target evidence chain.

[0133] In this embodiment of the disclosure, the layered code review system can input the target evidence chain and code issues into a preset artificial intelligence model. Through the preset artificial intelligence model, the authenticity of the code issues is evaluated based on the target evidence chain, and a first confidence level of the code issues relative to the target evidence chain is generated.

[0134] The first confidence level of a code problem relative to the target chain of evidence can be understood as an indicator used to measure the probability that the code problem is true under the target chain of evidence. The higher the first confidence level, the greater the probability that the code problem is true under the target chain of evidence; the lower the first confidence level, the less likely the code problem is true under the target chain of evidence.

[0135] Step 520: Perform rule consistency checks on code issues based on preset project specifications, and generate a second confidence level for the code issues relative to the preset project specifications.

[0136] In this embodiment of the disclosure, the layered code review system can perform rule consistency checks on code issues based on preset project specifications and generate a second confidence level of the code issues relative to the preset project specifications.

[0137] Preset project specifications can be set as needed; there are no limitations here. Preset project specifications can include rules that code and data must follow.

[0138] For example, preset project specifications can be obtained from the context data of the code data.

[0139] The second confidence level of a code issue relative to the predefined project specifications can be understood as an indicator used to measure how well the code issue conforms to the predefined project specifications. The higher the second confidence level, the more the code issue conforms to the requirements of the predefined project specifications; the lower the second confidence level, the less the code issue conforms to the requirements of the predefined project specifications.

[0140] Step 530: Obtain target historical code issues similar to the code issue, perform historical false positive analysis on the code issue based on the target historical code issues, and generate the third confidence level of the code issue relative to the target historical code issues.

[0141] In this embodiment of the disclosure, the hierarchical code review system can obtain target historical code issues similar to the code issue, perform historical false alarm analysis on the code issue based on the target historical code issue, and generate a third confidence level of the code issue relative to the target historical code issue.

[0142] A target historical code problem can be understood as a similar code problem that has occurred in the past. The degree of similarity between the code problem and the target historical code problem can be determined based on factors such as textual similarity of the problem description, root cause category, triggering conditions, or environment.

[0143] The third confidence level of a code problem relative to a target historical code problem can be understood as an indicator used to measure how similar the code problem is to the target historical code problem. The higher the third confidence level, the more similar the code problem is to the target historical code problem; the lower the third confidence level, the more different the code problem is from the target historical code problem.

[0144] In some embodiments, the above-described historical false positive analysis of code issues based on target historical code issues to generate a third confidence level of the code issue relative to the target historical code issue may include S31-S32: S31. Calculate the acceptance rate and repair rate of the target historical code issues.

[0145] The Acceptance Rate of a Target Historical Code Question can be understood as the proportion of historical questions and similar questions that have been confirmed as valid (accepted and verified as true) in the past.

[0146] For example, acceptance rate = (number of valid questions that confirm the target historical code question and similar questions of the target historical code question) / (total number of historical questions).

[0147] The fix rate of a target historical code issue can be understood as the proportion of a target historical code issue and similar issues that have been successfully fixed in the past.

[0148] Repair rate = (Number of successfully repaired target historical code issues and similar issues) / (Number of confirmed valid issues in history).

[0149] S32. Based on the acceptance rate and the repair rate, calculate the third confidence level of the code problem relative to the target historical code problem.

[0150] For example, the product of the acceptance rate and the repair rate of a target historical code problem can be used to determine the third confidence level.

[0151] Therefore, the third confidence level of the code problem relative to the target historical code problem can be accurately generated.

[0152] Step 540: Check the code data based on the preset static analysis tool to obtain the static analysis results. Based on the difference between the code problem and the static analysis results, generate the fourth confidence level of the code problem relative to the static analysis results.

[0153] In this embodiment of the disclosure, the layered code review system can examine code data based on a preset static analysis tool to obtain static analysis results. Based on the difference between the code problem and the static analysis results, a fourth confidence level of the code problem relative to the static analysis results is generated.

[0154] The fourth confidence level of the code problem relative to the static analysis results can be understood as an indicator used to measure how similar the code problem is to the static analysis results. The higher the fourth confidence level, the closer the code problem is to the static analysis results; the lower the fourth confidence level, the more different the code problem is from the static analysis results.

[0155] Step 550: Perform a weighted sum of the first confidence level, the second confidence level, the third confidence level, and the fourth confidence level to obtain the confidence level of the code problem.

[0156] In this embodiment of the disclosure, the layered code review system can perform a weighted summation of the first confidence level, the second confidence level, the third confidence level, and the fourth confidence level to obtain the confidence level of the code problem.

[0157] Therefore, each code issue in the review results can be subjected to multi-path verification, including authenticity assessment, rule consistency check, historical false alarm analysis, and static analysis cross-validation, to obtain the confidence level of each code issue. When conflicts occur in the AI ​​self-reflection path, rule consistency path, and static tool path, the impact of a single path can be reduced through weight adjustment or voting mechanism. This enables multi-dimensional quantitative scoring of each code issue, reduces the risk of misjudgment of code issues, accurately assesses code issues, and improves the interpretability of code issues.

[0158] Figure 6 This is a schematic diagram of the structure of a layered code review system based on Agentic AI evidence chain reasoning, as provided in an embodiment of this disclosure. Figure 6 As shown, the layered code review system 600 based on Agentic AI evidence chain reasoning includes: Receiver module 610 is used to receive code data to be reviewed; The multi-level review module 620 is used to perform multi-level review on the code data and obtain the review results of the code data, the review results including multiple code problems found at each level of review; The evidence chain reasoning module 630 is used to perform evidence chain reasoning on each of the code issues and generate the target evidence chain corresponding to the review result. The repair suggestion generation module 640 is used to perform repair analysis on the review result based on the target evidence chain and generate a target repair suggestion corresponding to the review result. The multi-path verification module 650 is used to perform multi-path verification on each of the code issues and generate the target confidence level of the review result. The report generation module 660 is used to generate a review report of the code data based on the review results, the target evidence chain, the target remediation suggestions, and the target confidence level.

[0159] The hierarchical code review system based on Agentic AI evidence chain reasoning provided in this disclosure can implement the methods of any of the above embodiments, and its execution method and beneficial effects are similar, so they will not be described again here.

[0160] In this embodiment, the hierarchical code review system based on Agentic AI evidence chain reasoning receives code data to be reviewed; performs multi-level review of the code data to obtain review results, including multiple code issues identified at each level; performs evidence chain reasoning on each code issue to generate a target evidence chain corresponding to the review results; performs repair analysis on the review results based on the target evidence chain to generate target repair suggestions corresponding to the review results; performs multi-path verification on each code issue to generate a target confidence level for the review results; and generates a code data review report based on the review results, target evidence chain, target repair suggestions, and target confidence level. Therefore, by conducting multi-level reviews of code data to obtain review results, a multi-dimensional intelligent review process is achieved, improving the detection rate of code issues and the credibility of reviews. This ensures review efficiency while increasing review depth and accuracy. Evidence chain reasoning is performed on the review results to obtain the corresponding target evidence chain, ensuring that the review results have a complete logical reasoning process and multi-source supporting evidence, thereby improving the interpretability and reliability of the review results. Based on the target evidence chain, the review results are analyzed for repair, generating corresponding target repair suggestions, which improves the accuracy and reliability of repair solutions, achieving intelligent support from problem discovery to repair. Multi-path verification of the review results yields the target confidence level, enabling multi-dimensional quantitative scoring of the review results, reducing the risk of misjudgment, accurately evaluating the review results, and improving their interpretability. Based on the review results, the corresponding target evidence chain, the target repair suggestions, and the target confidence level, a code data review report is generated, providing developers with a reliable, complete, traceable, and interpretable code review report. This forms a traceable closed-loop quality control system for code review, meeting the current multiple requirements of code review for efficiency, accuracy, and reliability.

[0161] This disclosure also provides a computer device, which includes a processor and a memory, wherein the memory stores a computer program. When the computer program is executed by the processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.

[0162] The computer device in this disclosure can be understood as any device with processing and computing capabilities. This device may include, but is not limited to, mobile terminals such as smartphones, laptops, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), in-vehicle terminals (e.g., in-vehicle navigation terminals), and wearable devices, as well as fixed electronic devices such as digital TVs, desktop computers, and smart home devices.

[0163] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure, such as... Figure 7 As shown, the computer device 700 may include a processor 710 and a memory 720. The memory 720 stores a computer program 721. When the computer program 721 is executed by the processor 710, it can implement the method provided in any of the above embodiments. The execution method and beneficial effects are similar and will not be described again here.

[0164] Of course, for the sake of simplicity, Figure 7 Only some of the components of the computer device 700 relevant to the present invention are shown in this illustration; components such as buses, input / output interfaces, input devices, and output devices are omitted. In addition, the computer device 700 may include any other suitable components depending on the specific application.

[0165] This disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.

[0166] The aforementioned computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0167] The computer program described above can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this disclosure. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer device, partially on the user's device, as a standalone software package, partially on the user's computer device and partially on a remote computer device, or entirely on a remote computer device or server.

[0168] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0169] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0170] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A layered code review method based on Agentic AI evidence chain reasoning, characterized in that, include: Receive code data to be reviewed; The code data is reviewed at multiple levels to obtain the review results, which include multiple code issues identified at each level. For each of the aforementioned code issues, evidence chain reasoning is performed to generate the target evidence chain corresponding to the review result; Based on the target evidence chain, the review results are analyzed for repair, and target repair suggestions corresponding to the review results are generated. Perform multi-path verification on each of the aforementioned code issues to generate the target confidence level of the review results; Based on the review results, the target evidence chain, the target remediation suggestions, and the target confidence level, a review report of the code data is generated.

2. The method according to claim 1, characterized in that, The multi-level review of the code data to obtain the review results includes: Based on a preset static analysis tool, the code data is subjected to syntax style analysis and inspection to identify syntax and style issues in the code data. Based on a preset artificial intelligence model, semantic analysis and inspection are performed on the code data to obtain logical and rule problems in the code data. Obtain the context data of the code data, and perform global analysis and inspection of the code data based on the context data using a preset artificial intelligence model to obtain cross-file dependency issues and specification issues of the code data. The context data includes at least the commit history of the code data, the preset project specifications of the code data, and the cross-file dependency graph of the code data. Based on a preset artificial intelligence model, the code data is analyzed and examined to identify design and structural problems. The syntax issues, style issues, logic issues, rule issues, cross-file dependency issues, specification issues, design issues, and structural issues are identified as code issues in the code data, and review results for the code data are generated based on these code issues.

3. The method according to claim 1, characterized in that, The step of performing evidence chain reasoning on each of the aforementioned code issues to generate the target evidence chain corresponding to the review result includes: Construct issue discovery data for the code issue, which includes the code issue, the source of the review of the code issue, and the location where the issue occurred; Obtain the context data of the code data, and use a preset artificial intelligence model to perform causal reasoning on the code problem based on the code data, the problem discovery data, and the context data to obtain the preliminary cause of the code problem. The context data includes at least the commit history of the code data, the preset project specifications of the code data, and the cross-file dependency graph of the code data. The initial causes of the problem are verified and adjusted using multiple paths to obtain the target cause of the code problem. Collect evidence of the occurrence of the code issues from the sources of the review; Based on the problem discovery data, the cause of the target, and the evidence of its occurrence, construct an evidence chain corresponding to the code problem; Based on the evidence chains corresponding to each of the aforementioned code issues, construct the target evidence chain corresponding to the review results.

4. The method according to claim 3, characterized in that, The process of performing multi-path verification and adjustment on the initial cause to obtain the target cause of the code problem includes: Based on a preset artificial intelligence model, the reasoning chain of the preliminary cause is reflexively reviewed to obtain a first verification result. The first verification result includes whether the reasoning chain of the preliminary cause satisfies the preset reasoning logic. The preliminary cause of the problem is compared with the preset project specifications to generate a second verification result. The second verification result includes whether the preliminary cause of the problem meets the requirements of the preset project specifications. Based on the first verification result and the second verification result, the preliminary cause of generation is adjusted to obtain the target cause of generation. The reasoning chain of the target cause of generation satisfies the preset reasoning logic and the target cause of generation meets the requirements of the preset project specification.

5. The method according to claim 1, characterized in that, The step of performing a remediation analysis on the review result based on the target evidence chain, and generating a target remediation suggestion corresponding to the review result, includes: For each code issue in the review results, a repair analysis is performed on the code issue based on the target evidence chain, and a corresponding repair suggestion is generated for the code issue. Based on the remediation suggestions corresponding to each code issue in the review results, target remediation suggestions corresponding to the review results are constructed.

6. The method according to claim 1, characterized in that, The step of performing multi-path verification on each of the aforementioned code issues to generate the target confidence score of the review results includes: For each of the code issues, multi-path verification is performed on the code issue to obtain the confidence level of the code issue; The target confidence level of the review result is obtained by weighted summation of the confidence levels of each of the aforementioned code issues.

7. The method according to claim 6, characterized in that, The process of performing multi-path verification on the code issue to obtain the confidence level of the code issue includes: By using a pre-set artificial intelligence model, the authenticity of the code problem is evaluated based on the target evidence chain, and a first confidence level of the code problem relative to the target evidence chain is generated; Based on the preset project specifications, a rule consistency check is performed on the code issue to generate a second confidence level of the code issue relative to the preset project specifications; Obtain target historical code issues similar to the code issue, perform historical false positive analysis on the code issue based on the target historical code issues, and generate a third confidence level of the code issue relative to the target historical code issues; The code data is examined using a preset static analysis tool to obtain static analysis results. Based on the difference between the code problem and the static analysis results, a fourth confidence level of the code problem relative to the static analysis results is generated. The confidence level of the code problem is obtained by weighted summation of the first confidence level, the second confidence level, the third confidence level, and the fourth confidence level.

8. The method according to claim 7, characterized in that, The step of performing historical false positive analysis on the code problem based on the target historical code problem corresponding to the code problem, and generating a third confidence level of the code problem relative to the target historical code problem, includes: Obtain the target historical code issue corresponding to the aforementioned code issue; Calculate the acceptance rate and fix rate of the target historical code issue; Based on the acceptance rate and the repair rate, calculate the third confidence level of the code problem relative to the target historical code problem.

9. The method according to claim 2 or 3, characterized in that, The context data for obtaining the code data includes: Contextual analysis is performed on the code data to obtain the commit history, preset project specifications, and cross-file dependency graph of the code data; Based on the commit history, the preset project specifications, and the cross-file dependency graph, the context data of the code data is constructed.

10. A layered code review system based on Agentic AI evidence chain reasoning, characterized in that, include: The receiving module is used to receive code data to be reviewed; A multi-level review module is used to perform multi-level review on the code data and obtain the review results of the code data, including multiple code issues identified at each level of review. The evidence chain reasoning module is used to perform evidence chain reasoning on each of the aforementioned code issues and generate the target evidence chain corresponding to the review result. The remediation suggestion generation module is used to perform remediation analysis on the review result based on the target evidence chain and generate target remediation suggestions corresponding to the review result. The multi-path verification module is used to perform multi-path verification on each of the code issues and generate the target confidence level of the review results. The report generation module is used to generate a review report of the code data based on the review results, the target evidence chain, the target remediation suggestions, and the target confidence level.

11. A computer device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements the hierarchical code review method based on Agentic AI evidence chain reasoning as described in any one of claims 1-9.

12. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the layered code review method based on Agentic AI evidence chain reasoning as described in any one of claims 1-9.