Manuscript Offprint
arXiv:2610.35223Behavioral Regression Detection for Pull Requests via Structured Oracles
Yiwen Fu, Binhang Qi, Xiao Li, Runlin Liu, Hailong Sun, and Xiang Gao
Abstract—Software regressions refer to unintended behavioral changes introduced by code modifications and remain difficult to detect at the pull-request (PR) level. Existing approaches either rely on incomplete tests or directly analyze PR contents with LLMs or coding agents, lacking structured behavioral reasoning and explicit behavioral oracles. We present ORION, a staged framework for PR-level regression detection. ORION first extracts PR intent and identifies impacted functions through AST-based impact region analysis. It then synthesizes function-level structured behavioral oracles that encode preserved and changed behaviors, setup requirements, and control-flow hints as explicit constraints derived from PR intent, static risk signals, and code changes in impacted functions. Guided by these oracles, ORION generates executable tests and performs oracle-coverage-guided augmentation and static repair. Finally, it differentially executes the same tests on pre- and post-change versions and classifies a PR as regression-inducing or not using deterministic rules and constrained LLM reasoning. To enable rigorous evaluation, we construct RegBench-Py, the first benchmark for PR-level regression detection in Python, containing 154 real-world PRs with verified labels. ORION achieves F1-scores of 0.6125 with DeepSeek-Chat-V3.2 and 0.5578 with Claude-4.5-haiku, the highest among the methods evaluated on the full benchmark. Compared with Testora, ORION improves F1-score by 0.2542–0.2882 across the two LLM backends, and it also outperforms the Codex and Claude Code agentic baselines in F1-score. A scope-aware comparison with PatchGuru further shows that neither method consistently dominates on the common single-function subset, while ORION supports a broader range of multi-function PRs. Applying ORION to 1,459 recently merged PRs further identifies 9 reproducible bug candidates, 8 of which have been confirmed by project maintainers. ORION requires approximately 15 minutes per PR, demonstrating its practical applicability.
Index Terms—Regression Detection; Test Oracle; Intent Modeling; Automated Test Generation; Large Language Models
I. INTRODUCTION
Software regression poses a fundamental threat to software reliability, which is unintended behavioral change introduced by code changes, e.g., in the form of pull requests (PRs). As software systems undergo frequent changes to fix defects, extend features, optimize efficiency, and enhance maintainability, such code changes can unintentionally undermine existing correct behaviors and introduce unforeseen functional flaws [1], [2]. Such regression issues are widespread in real-world development and often stay undetected throughout regular development and review processes, as even in well-tested software, the available test suite may not cover the code modified by a code change.
To address this problem, a broad spectrum of regression testing techniques has been developed. Symbolic execution and hybrid analysis have been explored to enhance test coverage over modified code for systematically exploring program paths [3], [4]. Meanwhile, search-based approaches have also been applied to both maximize structural coverage [5] and systematically reveal behavioral differences between program versions [6]. More recently, learning-based methods, particularly those leveraging large language models (LLMs), have emerged to generate regression tests directly from code changes and associated artifacts (e.g., PR descriptions), enabling a more flexible and context-aware form of test generation [7]. PatchGuru [8] further infers patch oracles from natural-language development artifacts and operationalizes them as executable assertions with concrete inputs.
However, existing approaches still have significant limitations. First, behavioral oracles for regression detection are under-specified. Many existing approaches either reason directly from PR intent and code changes or rely on weak or implicit test oracles, without constructing a structured intermediate representation that explicitly separates behaviors that should be preserved from behaviors that are intended to evolve. Without such behavioral boundaries, it remains difficult to determine what properties tests should validate and whether observed differences reflect intended changes or actual regressions. This long-standing test oracle problem hinders precise and reliable regression detection [9], [10]. Second, fine-grained structural changes are often ignored. Automated test generation techniques based on symbolic execution and search-based methods can explore program paths, but fail to detect regressions from fine-grained structural changes such as parameter removal, default value shifts, exception drift, silent **kwargs argument swallowing, and function-to-generator conversion. These changes often do not break control flow or trigger explicit failures, but instead cause silent behavioral divergence that requires deep structural and compatibility reasoning—something these traditional techniques cannot provide [11]–[13]. Third, deeper behavioral implications are often overlooked. By deeper implications, we refer to behavioral consequences that are not directly visible from changed lines alone, but emerge when the change is interpreted under PR intent, preserved behavioral contracts, caller assumptions, and control-flow conditions. For example, changing a default
Yiwen Fu, Xiao Li, and Runlin Liu are with Beihang University, Beijing, China (e-mail: fuyiwen@buaa.edu.cn; axiao@buaa.edu.cn; runlin22@buaa.edu.cn).
Binhang Qi is with the National University of Singapore, Singapore, and also with Beihang University, Beijing, China (e-mail: qibh@nus.edu.sg).
Xiang Gao and Hailong Sun are with Beihang University, Beijing, China, and also with the Hangzhou Innovation Institute of Beihang University, Hangzhou, China (e-mail: xiang_gao@buaa.edu.cn; sunhl@buaa.edu.cn).
Corresponding authors: Binhang Qi; Xiang Gao.
argument may be intended for new calls but may silently alter legacy call behavior. Recent learning-based approaches, particularly those leveraging LLMs or coding agents, often directly reason over PR descriptions and code diffs to generate tests or assess regression risks. This tends to bias the analysis toward surface-level changes, common usage scenarios, and simple execution paths, while overlooking deeper behavioral implications [14]. As a result, critical regression-triggering conditions are often insufficiently covered [14], [15].
To address these limitations, we propose ORION (Oracle-guided Regression Detection), a framework for behavioral regression detection in pull requests based on structured oracles. It models the task as a staged reasoning-and-execution pipeline that separates behavioral understanding from test synthesis. First, it extracts PR intent and identifies impacted functions through AST-based impact region analysis. It then constructs function-level structured behavioral oracles that encode preserved behaviors, changed behaviors, setup requirements, and control-flow hints. Guided by these oracles, the framework generates tests to cover behavioral boundaries and executes them on pre- and post-change versions. Finally, regression decisions are made via a hybrid strategy that combines deterministic rules with constrained LLM reasoning to distinguish intended behavioral changes from actual regressions.
To enable rigorous evaluation, we construct RegBench-Py, the first benchmark explicitly focused on PR-level regression detection in Python projects. Unlike existing datasets [16]–[18], RegBench-Py adopts a reproducible labeling procedure that links regression-inducing PRs to explicit developer evidence, filters out samples with unresolved build dependencies or non-reproducible local builds, and validates clean PRs through repository-history screening and independent manual reinspection. The final dataset contains balanced regression and non-regression PRs (154 in total), providing a reliable foundation for our evaluation and future research.
Experimental results show that ORION achieves F1-scores of 0.6125 with DeepSeek-Chat-V3.2 and 0.5578 with Claude-4.5-haiku; both are higher than the F1-scores of the baselines evaluated on the full RegBench-Py benchmark. Compared with Testora, ORION improves F1-score by 0.2882 and 0.2542 under the two LLM backends, respectively. Claude Code with Claude Sonnet 5 achieves an F1-score of 0.5246, providing a stronger agentic baseline than Codex. We further conduct a scope-aware comparison with PatchGuru [8]; neither method consistently dominates on the commonly completed single-function PRs, while ORION supports a broader range of multi-function PRs. Finally, in an extended real-world evaluation over 1,459 recently merged PRs, ORION identifies nine reproducible bug candidates, eight of which have been confirmed by project maintainers. These results demonstrate the effectiveness and practical value of ORION.
In summary, our contributions are as follows:
• We propose ORION, a staged framework for PR-level regression detection that integrates structured oracle construction, oracle-guided test generation, and hybrid regression classification.
• We release RegBench-Py, the first benchmark specifically designed for PR-level regression detection in Python. RegBench-Py consists of 77 regression and 77 non-regression PRs from GitHub projects. The regression-inducing PRs are supported by explicit developer evidence and manually verified for reproducibility. The clean PRs are screened using subsequent repository history, and all 77 selected clean PRs are independently re-inspected by two annotators using PR discussions, linked issues, developer tests, and subsequent repository history.
• We conduct an extensive evaluation against five baselines, including Testora, PatchGuru, direct LLM reasoning, Codex, and Claude Code. On the full RegBench-Py benchmark, ORION achieves an F1-score of up to 0.6125, while a separate scope-aware comparison with PatchGuru highlights its broader applicability to multi-function PRs. In an extended real-world study of 1,459 PRs, ORION identifies nine reproducible bug candidates, eight of which have been confirmed by maintainers.
The pre-PR version simply processes any URL (lines 5-10) without validating whether the URL is valid. When provided with an invalid URL, an “HTTP Error 404” will be triggered. To fix this bug, the patch tries to check whether the URL is valid (lines 12-13) and only proceeds valid URLs (line 14). Function _request_webpage() handles general-purpose HTTP requests that take the first argument as a normal HTTPS URL. However, the output of function _smuggle_referrer() (line 11) is a specialized struct that can only be handled by VimeoIE class, and _request_webpage() will always return false. As a result, a regression was introduced since previously valid URLs will be identified as invalid, causing normal behaviors to be broken.
Listing 1. Code change of yt-dlp PR #9613
PR Message: [patreon] fix some Vimeo embed downloads. This change adds checks to verify if external embeds of Patreon posts are still valid before trying to download them, and if it is invalid then it tries other options...
3 Changed Code: 4 if v_url: 5 - return { 6 - **info, 7 - '_type': 'url_transparent', 8 - 'url': VimeoIE._smuggle_referrer(v_url, 'https://patreon.com'), 9 - 'ie_key': 'Vimeo', 10 - } 11 + v_url = VimeoIE._smuggle_referrer(v_url, 'https://patreon.com') 12 + if self._request_webpage(v_url, video_id, 'Checking Vimeo embed URL', fatal=False, errnote=False):

Fig. 1. Overview of ORION.
14 + return self.url_result(v_url, VimeoIE, url_transparent=True, **info)
Existing tools, e.g., Testora [7], only analyze code changes and focus on the superficial intent of the PR, such as “fix invalid Vimeo embed”. Thus, they only synthesize test cases for the new logic: checking whether invalid embeds can be correctly handled. As a result, it fails to detect this regression.
Listing 2. Partial of inferred behavioral oracle.
1 "preserved_behavior": [ 2 "Posts with working Vimeo embeds should extract successfully as before"] 3 "changed_behavior": [ 4 "Posts with invalid Vimeo embeds should now succeed by falling back to post_file" 5 ]
In contrast, ORION first generates a function-level structured behavioral oracle, as shown in Listing 2. Guided by this oracle, ORION generates a test case that constructs a Patreon post with a working Vimeo embed, asserting that extraction succeeds without error. The test passes before the PR, but fails after the PR with the error: “‘NoneType’ object has no attribute _first_webpage_request”. This exception is captured during differential execution and finally classified as a regression by ORION’s LLM-assisted assessment.
III. METHODOLOGY
Our approach detects regressions by transforming a PR into a staged reasoning and execution pipeline. As shown in Figure 1, instead of directly generating tests from diffs, ORION consists of four stages:
Stage 1 (PR Intent and Impact Region Identification): ORION extracts PR intent, maps diff changes to affected functions via AST parsing, and produces structured impact regions with explicit risk signals.
Stage 2 (Oracle Synthesis): ORION synthesizes a structured oracle from PR intent and static risk signals, defining preserved_behavior invariants, changed_behavior evolution scenarios, setup requirements, and control-flow hints.
Stage 3 (Test Generation): ORION generates executable tests under oracle guidance, covering behavioral boundaries and control-flow changes.
Stage 4 (Regression Identification): ORION executes the tests on pre- and post-change versions and classifies behavioral differences using Logic-based rules and LLM reasoning.
A. PR Intent and Impact Region Identification
Oracle generation requires both a macroscopic understanding of developer intent and a microscopic understanding of structural code changes. Raw diffs alone are insufficient: they intermingle semantic modifications with syntactic noise, and they do not explicitly encode compatibility expectations. Therefore, before synthesizing oracles, ORION constructs a structured contextual representation that integrates PR-level intent with function-level impact analysis. This representation serves as the primary input to the oracle synthesis stage.
-
PR Global Intent Extraction: To distinguish intended behavior evolution from unintended regressions, ORION extracts the global intent of the PR from its metadata, including title, description, and diff summary. The extracted intent is normalized into four fields: change_type, expected_behavior_change, backward_compatibility, and high_level_expectations. Specifically, change_type provides a coarse prior for distinguishing intended behavior evolution from behaviors that should remain preserved. expected_behavior_change defines the intended scope of behavioral modification and determines the boundary within which preserved-behavior constraints are enforced. backward_compatibility captures declared breaking changes, removed features or parameters, and migration paths, allowing the oracle to distinguish documented interface evolution from suspicious compatibility drift. high_level_expectations summarizes developer-stated goals into structured constraints that anchor oracle reasoning to the PR's declared objectives.
-
Impact Region Identification: While global intent provides macroscopic expectations, regressions originate from concrete modified code units. ORION therefore identifies the minimal set of directly impacted functions and extracts structural deltas that may introduce behavioral drift.
ORION parses the Git diff to obtain precise line ranges of modifications and maps them to the abstract syntax tree (AST) of each affected file. Functions, methods, constructors, or class attributes containing modified lines are marked as directly changed functions. For each such function, ORION retrieves the pre- and post-change implementations and records deterministic structural deltas, including removed parameters, changed default values, exception-type changes, possible silent argument swallowing through **kwargs, and conversion from a regular function to a generator. These patterns are selected because prior studies identify parameter removal and default-value modification as common sources of breaking changes [11], [12], while Python's dynamic features can make such compatibility drift difficult to detect before execution [13], [20]. ORION uses these lightweight checks to expose subtle compatibility hazards without introducing heavyweight analyses such as data-flow or taint analysis.
Beyond directly changed functions, ORION constructs a lightweight relational context containing immediate callers, callees, and sibling methods, along with a minimal call graph representation. This contextual information is preserved separately and later used during test generation to ensure executable call paths, but oracle synthesis remains scoped to directly impacted functions.
The output of this stage integrates PR intent, localized structural deltas, and lightweight relational context into a compact, machine-readable representation. By excluding unrelated code while exposing compatibility-sensitive risk signals, it provides a task-focused input for oracle synthesis rather than raw diffs.
B. Oracle Synthesis
Directly feeding diff content, PR intent, and static analysis results into an LLM to generate tests is feasible in principle, yet exhibits practical limitations. The model must simultaneously perform behavior-risk reasoning and executable test construction, which increases cognitive load and may cause fine-grained structural risks to be overlooked. Moreover, static constraints are difficult to reliably preserve within unconstrained generation. To address this issue, ORION introduces an intermediate oracle layer between diff analysis and test generation. The oracle serves as a function-level behavioral contract that decouples logical reasoning from code synthesis. It specifies behavioral boundaries without producing executable code, while the test generation phase implements tests based on this oracle. This layered design improves generation stability and provides interpretable behavioral coverage boundaries.
Oracle construction is not applied indiscriminately to all modified functions. Instead, it targets functions with meaningful behavioral impact. The following cases are excluded: (1) modifications limited to comments, formatting, or documentation; (2) non-executable or abstract interface functions; (3) trivial forwarding or duplicated wrapper functions; (4) cases where AST parsing or oracle construction fails. When the number of impacted functions exceeds the bounded analysis budget, ORION applies a budget-based ranking rather than treating some functions as semantically unimportant. Functions are ranked according to PR-intent relevance, local call connectivity, function size/type, and control-flow complexity, and the highest-ranked functions are selected for oracle synthesis. Thus, “low priority” denotes relative priority under a bounded analysis budget rather than a judgment that a function has no significant behavioral impact. This filtering mechanism ensures that oracle synthesis focuses on semantically relevant changes rather than mechanically covering all modifications.
Oracle generation consumes the static risk signals produced in Stage 1. When a risk signal is present, it is injected into the oracle-generation prompt as a standardized requirement, encouraging the LLM to encode the corresponding preservation or changed-behavior constraint. In the absence of such signals, oracle synthesis relies on PR intent and semantic reasoning over the before/after function implementations.
The final oracle is represented as a structured JSON behavioral oracle:
Listing 3. Function-level oracle schema
{ "function_id": "<string>", "code_diff_summary": ["<string>"], "setup_requirements": ["<execution prerequisite>"], "preserved_behavior": ["<behavior that must not change>"], "changed_behavior": ["<expected behavior change>"], "behavior_notes": ["<additional notes or status flags>"], "control_flow_hints": { "new_paths": ["<new or modified path>"], "important_conditions": ["<key decision conditions>"] } }
The field function_id uniquely identifies the modified function and remains consistent with the impact region analysis stage. code_diff_summary summarizes the core semantic change introduced by the diff. setup_requirements specifies environmental and dependency prerequisites to ensure test executability. preserved_behavior defines behaviors that should remain stable and therefore provides the primary boundary for identifying potential regressions, whereas changed_behavior characterizes intended behavioral evolution to mitigate false positives. behavior_notes records auxiliary annotations or status flags. Finally, control_flow_hints preserves structural guidance: new_paths highlights newly introduced or modified control-flow branches, and important_conditions enumerates decision predicates critical for distinguishing behavioral changes.
By explicitly encoding behavioral invariants, expected evolution, and control-flow context, the oracle provides an operational intermediate representation between change analysis and test synthesis, enabling a principled separation between reasoning and implementation.
C. Test Generation
A generated test is an executable unit that validates the behavioral constraints defined within the oracle. Test generation therefore aims not only to produce runnable code, but also to cover critical behavioral boundaries and newly introduced control-flow paths under strict executability requirements. To achieve this, ORION adopts a three-stage pipeline consisting of generation, coverage augmentation, and static repair.
- Oracle-Guided Generation: Test generation is driven exclusively by the oracle rather than directly by the raw diff. The system extracts verification targets from preserved_behavior, changed_behavior, and new_paths, and constructs prompts that explicitly encode these behavioral requirements. The lightweight relational context from Stage 1 is also used to construct feasible invocation paths when direct function calls are insufficient. The LLM is therefore constrained to instantiate executable scenarios consistent with predefined behavioral oracles instead of re-inferring change semantics.
To control test explosion, ORION caps initial generation at 24 base tests per PR, a practical engineering budget for limiting generation costs on large PRs rather than an empirically established optimal threshold. Within this budget, ORION prioritizes high-impact functions using a simple heuristic score:
Here, and denote the numbers of changed_behavior and preserved_behavior entries for function f, respectively. The parameters and control the relative contributions of these two types of oracle entries to function prioritization. We use fixed heuristic weights of and to give greater initial priority to functions with more intended-change requirements while retaining preservation requirements in the allocation. These values are engineering choices rather than empirically established optima. The weighting controls initial test allocation rather than the importance of either type of behavior for regression classification. Uncovered oracle entries of both types remain eligible for the subsequent oracle-coverage-guided augmentation stage.
Each generated test must return structured JSON and explicitly include an oracle_ref field linking the test to a specific oracle region and index, enabling deterministic coverage tracking.
- Coverage-Guided Augmentation: After base generation, the system performs structural coverage analysis using the oracle_ref indices rather than textual matching. For each function, ORION constructs a mapping from oracle region types to covered index sets and compares them against the full set of oracle entries. Uncovered preserved_behavior, changed_behavior, or new_paths items are recorded as coverage gaps.
Enhancement proceeds under a global augmentation cap of 40 tests. This budget exceeds the base-test cap because augmentation targets behavioral constraints left uncovered by the initial suite, allowing additional tests to address identified oracle-coverage gaps. Two complementary strategies guide this process. First, input mutation extends existing tests by perturbing boundary values, explicitly triggering exceptional branches, materializing default arguments, or consuming generator outputs while preserving the original testing intent. Second, oracle-guided regeneration incorporates uncovered oracle entries into the prompt and requires the LLM to generate tests that reference the corresponding oracle_ref. Functions are prioritized by the number of uncovered oracle items so that the augmentation budget is directed toward the remaining behavioral constraints.
- Static Repair for Executability: Because LLM-generated tests frequently contain syntactic and import-related defects, ORION applies a purely static repair phase to guarantee executability without altering test semantics. This phase performs Markdown code block extraction and indentation normalization, identifier typo correction while protecting language keywords and string literals, symbol resolution against import mappings derived from the source code, automatic insertion of missing imports, degradation of hallucinated submodule imports to verified root-package imports, removal of unused imports, and final AST-level syntax validation in a single deterministic repair pass.
Importantly, ORION deliberately avoids semantic adaptation of tests to either the pre- or post-change versions of the program. Regression detection relies on executing identical tests across program versions; any logic-level modification could mask genuine behavioral divergence or introduce inequivalence between versions. Therefore, repair is restricted to minimal executability guarantees and never modifies the logical intent of generated tests.
D. Regression Identification
After test generation, ORION executes each test in isolated environments to determine whether observed behavioral changes indicate a regression. This process follows a staged pipeline: isolated execution → structured objective data capture → rule-based classification → LLM-assisted reasoning for unresolved cases. Such a design mitigates limitations of traditional regression detection, including subjective judgments and non-reproducible decisions, by prioritizing objective signals and deterministic reasoning [13], [21].
Tests are run independently in Conda/Docker environments corresponding to the before and after program versions. Both environments are fully consistent in dependencies, system configuration, and resource limits, with the only difference being the code under test. During execution, ORION captures objective metrics, including execution status, runtime, memory usage, exceptions, return values, and output differences. These data are stored as structured JSON and provide the objective execution evidence for regression classification.
Regression decisions follow a deterministic-first strategy. ORION first applies hard rules to clear-cut cases before invoking the LLM. Identical before/after executions are labeled as clean. Infrastructure or setup failures, such as missing dependencies, environment errors, or resource-limit violations unrelated to the code change, are filtered out before classification and are not used as regression evidence. Tests targeting newly introduced functions without a meaningful before-version baseline are treated as non-regression evidence unless they also expose failures in existing preserved call paths. Severe performance degradation is labeled as regression when the after-version runtime is at least twice the before-version runtime and the slowdown is not attributable to infrastructure noise or an explicitly intended performance tradeoff.
For unresolved cases, ORION invokes an LLM constrained by structured execution data, PR intent, and oracle-derived behavioral constraints. The LLM does not freely judge regressions from raw outputs; instead, it answers five standardized yes/no questions: : does the test expose an observable before/after behavioral difference? : does the status change indicate a failure that is not covered by changed_behavior? : does the exception difference violate preserved_behavior? : does the return value or stdout difference violate preserved_behavior rather than reflect intended evolution? : does the runtime increase exceed the slowdown threshold without being an intended performance tradeoff?
The final label is derived from the structured answers according to the following consistency rule:
ORION first classifies individual executable cases. At the PR level, a PR is classified as regression-inducing if at least one case is classified as regression; otherwise, it is classified as clean. Infrastructure-failure cases do not themselves trigger a regression, and PRs containing only such cases are additionally flagged for human review. This formulation keeps the decision grounded in objective execution evidence while using the LLM only for semantic alignment between observed differences, PR intent, and oracle constraints. By combining isolated differential execution, deterministic rules, and constrained LLM reasoning, ORION provides reproducible and explainable regression detection.
IV. REGBENCH-PY: A BENCHMARK FOR PR-LEVEL REGRESSION DETECTION
To address the lack of high-quality and reproducible benchmarks for Python regression detection, we construct RegBench-Py, the first benchmark specifically designed for PR-level regression detection in Python projects. Existing datasets used in prior work (e.g., Testora) rely on scattered regression samples without standardized construction.

Fig. 2. Pipeline of RegBench-Py Dataset Construction
Regression vs. Clean PR Churn

Fig. 3. Distribution of PR churn in RegBench-Py on a logarithmic scale. Churn is computed as the sum of added and deleted lines. Boxes indicate interquartile ranges, center lines indicate medians, whiskers show non-outlier ranges, and points denote outlier PRs.
procedures, which limits reproducibility and fair evaluation. RegBench-Py is designed to ensure (1) authenticity, as all samples originate from real-world pull requests, (2) reproducibility, requiring each regression sample to be buildable in an isolated environment, and (3) unambiguous labeling, where regression introduction must be explicitly confirmed by developers. To ensure balanced evaluation, the dataset contains equal numbers of regression and non-regression pull requests. All samples are collected from 207 active Python projects on GitHub with at least 100 stars and commits within the last 12 months. The final RegBench-Py benchmark contains 154 pull requests, including 77 regression-introducing PRs and 77 clean PRs, spanning 65 unique repositories. Figure 2 illustrates the overall construction pipeline.
Positive samples (regression-introducing PRs). A positive sample is defined as a pull request that explicitly introduces a regression bug and can be successfully built in an isolated environment. As shown in Figure 2, the construction consists of four main stages. First, we mine regression-related issues using the query label:regression is:closed language:python, obtaining 2,465 issues related to code logic regressions while excluding documentation or configuration regressions. Second, we identify regression-introducing PRs by matching developer statements in issue descriptions and comments using regular expressions (e.g., “introduced by #PR”, “regression from #PR”), yielding 186 candidate PRs. To avoid ambiguous labels, we remove samples containing uncertain expressions (e.g., “guess”, “suspect”, “may”), resulting in 101 candidates. Third, we verify environment reproducibility by constructing isolated Docker/Conda environments for each candidate and checking whether the corresponding project version can be successfully built. We discard 24 PRs due to build failures caused by issues such as dependency compilation errors (e.g., C/C++/Rust/Cython extensions), incompatibility with modern toolchains, missing installation files (e.g., setup.py, pyproject.toml), submodule retrieval failures, or missing commits. Finally, two researchers independently inspect the remaining samples to confirm that the regression attribution is explicitly supported by developer discussions, resulting in 77 regression-introducing PRs.
Negative samples (clean PRs). Negative samples represent pull requests that do not introduce regressions. We define a clean PR as one whose modified lines are not subsequently changed by any identified bug-fixing PR within 12 months after merging and for which manual review finds no concrete evidence of an introduced regression. As shown in Figure 2, we first scan all PRs across the 207 projects and retain merged PRs with at least a 12-month post-merge observation window, source-code changes beyond documentation, configuration, and tests, and modified lines that can be extracted using PyDriller. Next, we identify subsequent bug-fixing PRs using labels (e.g., bug, fix, regression, patch), textual indicators (e.g., “fix bug”, “crash”, “revert”, “regression”), or issue-closing keywords (e.g., “fix”, “resolve”, “close”). If any such PR modifies lines previously changed by a candidate within the observation window, the candidate is removed. We then randomly sample 77 PRs from the remaining candidates to balance the dataset. To validate these negative labels, two authors independently re-inspected all 77 selected PRs using PR discussions, linked issues, developer tests, and subsequent repository history. They initially agreed on 75/77 PRs (97.4%); the two disagreements were jointly adjudicated, and both PRs were retained only after both annotators found no concrete evidence of an introduced regression. These screening and review procedures establish clean as an operational negative label rather than proof of absolute regression absence.
Figure 3 shows the churn distribution of regression and clean PRs. The typical churn of the two groups is comparable, while regression PRs show a wider spread and a heavier tail. This suggests that RegBench-Py includes both moderate-size regression-introducing changes and a small number of large regression PRs, reflecting the skewed nature of real-world PR complexity.
V. EXPERIMENT
To evaluate ORION, we address the four research questions:
• RQ1: Classification accuracy on RegBench-Py. How accurately can ORION detect regression-inducing pull requests on the RegBench-Py benchmark, and how does it compare with the five evaluated baselines?
• RQ2: Impact of key components. How do the major components of ORION affect end-to-end regression detection performance?
• RQ3: Average runtime and cost overhead. What are the average time and LLM cost overheads for processing a single PR?
• RQ4: Effectiveness on real-world regressions. How effective is our approach at finding unknown regressions in newly merged PRs from real projects?
A. Experimental Setup
- Baselines and Configuration: We compare our approach with five baselines. The first is Testora, an existing tool specifically designed for regression detection at the pull-request level. We evaluate Testora under two configurations: an adapted setting that removes its native filters for full-benchmark evaluation, and its original native setting for a scope-faithful comparison.
The second baseline is PatchGuru, a closely related PR-level regression detection approach. PatchGuru's current implementation requires a PR diff to modify exactly one source function. Therefore, we first identify the RegBench-Py PRs satisfying this requirement and conduct a direct comparison on the common subset for which both PatchGuru and ORION produce valid outputs.
The third baseline is a simple LLM baseline that directly judges regression risks using raw PR metadata and diff content. This baseline receives the same PR information used by our approach, including the PR title, description, code diff, and comments, and is prompted to directly determine whether the PR introduces a regression.
The fourth baseline is Codex, an agentic programming baseline built on OpenAI's GPT-5-series Codex programming agent. For each PR, Codex receives the same PR-level information, including the title, description, code diff, and comments, and is asked to analyze the change and determine whether it introduces a regression.
The fifth baseline is Claude Code with Claude Sonnet 5, which serves as another agentic programming baseline. Like Codex, it receives the same PR-level information and is asked to analyze the change and determine whether it introduces a regression. Claude Code is evaluated on the full RegBench-Py benchmark.
For LLM-based analysis, we evaluate ORION, Testora, and the simple LLM baseline with DeepSeek-Chat-V3.2 and Claude-4.5-haiku to assess cross-model robustness. Codex and Claude Code are evaluated separately as agentic baselines because they use their respective agent backends rather than the two LLM backends used by the other methods. All experiments use consistent API parameters, prompt settings, and execution environments where applicable.
- Metrics: To quantitatively evaluate the performance of our approach and baselines under various LLM backends, we first clarify the standard confusion matrix entries tailored to regression PR detection:
-
TP: Correctly identified regression-inducing PRs.
-
TN: Correctly identified non-regression PRs.
-
FP: Non-regression PRs misclassified as regression.
-
FN: Regression-inducing PRs misclassified as non-regression.
Then we calculate Precision, Recall, and F1-score.
- Implementation: Our prototype is implemented in Python 3 and consists of approximately 10,104 lines of code. The system performs repository analysis, PR change extraction, and regression detection through a multi-stage pipeline.
For static code analysis, we use Python's built-in AST module to parse source files and perform lightweight analyses such as import validation and symbol resolution. Generated tests are validated using AST-based checks to ensure correct imports and executable code structure.
Target projects are installed in isolated Conda/Dockers environments, with separate environments created for the pre-commit and post-commit versions of each PR. All experiments are conducted on a server running Ubuntu 22.04.
B. RQ1: Classification Accuracy on RegBench-Py
This research question evaluates the ability of ORION to identify regression-inducing pull requests (PRs) through PR-level binary classification on RegBench-Py. We compare ORION with five baselines: Testora, PatchGuru, a direct LLM prompting baseline, Codex, and Claude Code. ORION, Testora, PatchGuru, and the direct LLM baseline are evaluated with DeepSeek-Chat-V3.2 and Claude-4.5-haiku to assess cross-model robustness. Codex uses its OpenAI GPT-5-series Codex agent backend, while Claude Code uses Claude Sonnet 5. All executable methods run in the same Conda/Docker environments. We adopt Precision, Recall, and F1-score to quantify classification performance, with detailed definitions provided in Section V-A2.
We evaluate Testora under both adapted and native filtering settings. For full-benchmark evaluation, the adapted setting removes its original 200-line diff limit and PR-level filters that exclude PRs with more than three non-test files, no non-test source files, documentation-only changes, or comment-only changes. To assess performance under its original configuration, we also evaluate Testora with these filters enabled and compare it with ORION on the resulting subset. Testora's multi-label outputs are mapped to binary predictions: regression is mapped to Regression, while intended_change, coincidental_fix, and checked are mapped to Clean.
Under the adapted setting, ORION and the direct LLM baseline successfully process all 154 PRs, whereas Testora produces valid outputs for 152 PRs and fails on the remaining two. These failures are primarily caused by extreme diff characteristics, including excessively long diffs that exceed the model's effective reasoning capacity and overly short diffs that lead to uninformative responses. We count these failures as incorrect predictions, contributing a false positive for a clean PR or a false negative for a regression-inducing PR, to account for end-to-end failures. PatchGuru is evaluated separately because its implementation requires each PR diff to modify exactly one source function. We first identify PRs satisfying this requirement and then compare PatchGuru with ORION on the common subset for which both methods produce valid outputs. We report PatchGuru's applicability and execution completion separately from its classification performance on this subset.
TABLE I CLASSIFICATION PERFORMANCE ON ALL 154 PRS IN REGBENCH-PY. TESTORA USES THE ADAPTED FILTERING SETTING. BOLD VALUES INDICATE THE BEST RESULTS WITHIN EACH SHARED-BACKEND GROUP.
| Method | Backend | Precision | Recall | F1 |
|---|---|---|---|---|
| Codex | OpenAI Codex agent | 0.5833 | 0.1818 | 0.2772 |
| Claude Code | Claude Sonnet 5 | 0.7111 | 0.4156 | 0.5246 |
| Direct LLM | DeepSeek | 0.7368 | 0.1818 | 0.2917 |
| Testora | DeepSeek | 0.5294 | 0.2338 | 0.3243 |
| ORION | DeepSeek | 0.5904 | 0.6364 | 0.6125 |
| Direct LLM | Claude | 0.6333 | 0.2468 | 0.3551 |
| Testora | Claude | 0.4857 | 0.2208 | 0.3036 |
| ORION | Claude | 0.5857 | 0.5325 | 0.5578 |
Classification results. Table I summarizes the full-benchmark results. ORION achieves the highest Recall and F1-score under both shared LLM backends. With DeepSeek, it obtains a Recall of 0.6364 and an F1-score of 0.6125; with Claude, these values are 0.5325 and 0.5578, respectively. The direct LLM baseline achieves higher Precision than ORION under both backends, reaching 0.7368 with DeepSeek and 0.6333 with Claude. However, its Recall is only 0.1818 and 0.2468, respectively, indicating that direct judgment from raw PR information misses many regression-inducing PRs. Testora achieves F1-scores of 0.3243 with DeepSeek and 0.3036 with Claude, showing limited effectiveness on RegBench-Py.
Among the agentic baselines, Codex achieves a Precision of 0.5833, a Recall of 0.1818, and an F1-score of 0.2772. Claude Code achieves a Precision of 0.7111, a Recall of 0.4156, and an F1-score of 0.5246. Although Claude Code performs better than Codex, both configurations of ORION achieve higher Recall and F1-score. Overall, ORION provides a more balanced precision–recall trade-off on the full benchmark, improving Recall while maintaining competitive Precision. Nevertheless, the remaining false positives and false negatives suggest that ORION is best used as a non-blocking CI assistant or a tool for analyzing high-risk PRs, with developers reviewing its findings.
Testora's native filters retain 94 of the 154 PRs, including 41 regression-inducing and 53 clean PRs. Table II compares Testora and ORION on this same subset. With DeepSeek, Testora achieves a Precision of 0.3000, a Recall of 0.1463, and an F1-score of 0.1967, whereas ORION achieves 0.4884, 0.5122, and 0.5000, respectively. With Claude, Testora
TABLE II CLASSIFICATION PERFORMANCE ON THE 94 PRS RETAINED BY TESTORA'S NATIVE FILTERS: 41 REGRESSION-INDUCING AND 53 CLEAN PRS.
| Method | Backend | Precision | Recall | F1 |
|---|---|---|---|---|
| Testora | DeepSeek | 0.3000 | 0.1463 | 0.1967 |
| ORION | DeepSeek | 0.4884 | 0.5122 | 0.5000 |
| Testora | Claude | 0.2632 | 0.1220 | 0.1667 |
| ORION | Claude | 0.4571 | 0.3902 | 0.4211 |
TABLE III CLASSIFICATION RESULTS ON THE 33 PRS COMPLETED BY BOTH PATCHGURU AND ORION: 12 REGRESSION-INDUCING AND 21 CLEAN PRS.
| Method | Backend | TP | FP | FN | TN |
|---|---|---|---|---|---|
| PatchGuru | DeepSeek | 2 | 5 | 10 | 16 |
| ORION | DeepSeek | 2 | 6 | 10 | 15 |
| PatchGuru | Claude | 1 | 3 | 11 | 18 |
| ORION | Claude | 2 | 7 | 10 | 14 |
achieves 0.2632, 0.1220, and 0.1667, compared with 0.4571, 0.3902, and 0.4211 for ORION. Thus, ORION's advantage over Testora persists when the comparison is restricted to PRs accepted by Testora's original filters.
For PatchGuru, 48 of the 154 PRs (31.2%) satisfy its single-function requirement. PatchGuru successfully completes 33 of these PRs, including 12 regression-inducing and 21 clean PRs. The remaining 15 runs fail mainly because the generated driver does not exercise the target function or the generated specification does not terminate cleanly. Table III reports the confusion counts for PatchGuru and ORION on the 33 common completed PRs. With DeepSeek, both methods identify two regression-inducing PRs, while PatchGuru produces five false positives and ORION produces six. With Claude, PatchGuru identifies one regression-inducing PR with three false positives, whereas ORION identifies two with seven false positives. Neither method consistently dominates on this restricted subset. Accordingly, these results do not establish a classification advantage for ORION over PatchGuru on common completed cases. The main distinctions of ORION are its broader applicability to multi-function PRs and its separation of behavioral specification from executable-test instantiation.
Qualitative analysis. We examine the behavioral constraints involved in the 49 true-positive PRs from the reported DeepSeek run. Of these, 25 involve both preservation and intended-change constraints, 18 involve intended-change constraints only, and six involve preservation constraints only. The corresponding prediction groups have Precisions of 0.500, 0.818, and 0.545, respectively. We also examine the five explicit structural-risk patterns and find that only 13 of the 154 PRs contain at least one such pattern. The remaining 141 PRs are assessed through ORION's general LLM-based behavioral judgment over pre- and post-change execution evidence.
To examine whether the detected regressions correspond to those reported by developers, two authors independently
TABLE IV ABLATION STUDY RESULTS ON REGBENCH-PY.
| Setting | Precision | Recall | F1 |
|---|---|---|---|
| w/o analysis-guided oracle generation | 0.5161 | 0.6234 | 0.5647 |
| w/o oracle-guided test generation | 0.4444 | 0.2597 | 0.3279 |
| w/o oracle-driven augmentation | 0.5441 | 0.4805 | 0.5103 |
| w/o intent/oracle context in final judgment | 0.5875 | 0.6104 | 0.5987 |
| Full ORION | 0.5904 | 0.6364 | 0.6125 |
compare the generated tests and execution evidence with the developer-reported regression. A PR is counted as consistent only when both annotators judge the evidence to be fully or partially related to the reported regression; disagreements are treated conservatively. This analysis identifies 38 consistent cases among the 49 true positives.
Run-to-run variability. We assess LLM nondeterminism through three DeepSeek runs. The full-benchmark results in Table I come from the first run rather than a best-of-multiple selection. Across the three runs, the standard deviations of Precision, Recall, and F1-score are 0.040, 0.057, and 0.048, respectively, indicating moderate run-to-run variability.
C. RQ2: Impact of Key Components
To understand the contribution of each major stage in ORION, we conduct a controlled ablation study on RegBench-Py with DeepSeek-Chat-V3.2 as the backbone LLM. This study follows the staged design of ORION: analysis-guided oracle generation, oracle-guided test generation, oracle-driven augmentation, and intent/oracle-aware final judgment. The goal is to examine where structured oracles contribute most to end-to-end regression detection.
We construct four ablated variants by removing or weakening one key stage at a time:
-
w/o analysis-guided oracle generation: Oracles are synthesized from the raw PR diff without static-analysis-derived risk signals.
-
w/o oracle-guided test generation: Tests are generated directly from the PR diff, bypassing intent extraction, impact analysis, oracle synthesis, and target-view construction.
-
w/o oracle-driven augmentation: Only the initially generated tests are used, without oracle coverage checking or oracle-driven augmentation.
-
w/o intent/oracle context in final judgment: The final judgment retains the deterministic rules and five-question protocol, but removes PR intent and oracle context from the LLM input.
-
Full ORION: The complete pipeline described in Section III.
Experimental Setup. All variants are evaluated on the full RegBench-Py dataset under identical execution settings. We report Precision, Recall, and F1-score to measure end-to-end binary classification performance. The results are shown in Table IV.
As shown in Table IV, the full ORION achieves the best overall performance. Removing oracle-guided test generation causes the largest degradation, reducing Recall from 0.6364 to 0.2597 and F1-score from 0.6125 to 0.3279. This indicates that

Fig. 4. Runtime breakdown of ORION pipeline.
the structured oracle is important for guiding the LLM toward regression-relevant test scenarios instead of relying only on raw PR diffs.
Oracle-driven augmentation also has a clear impact. Without this stage, Recall drops to 0.4805 and F1-score drops to 0.5103, showing that the initial tests alone leave some oracle-specified behaviors uncovered. Removing intent/oracle context from the final judgment leads to a smaller decrease, with Recall dropping to 0.6104 and F1-score to 0.5987. These results show that structured oracles contribute across the pipeline, with the largest impact appearing in test generation and augmentation.
D. RQ3: Average Runtime and Cost Overhead
We analyze the runtime, token consumption, and approximate API cost of ORION to assess its practical overhead. On average, ORION takes approximately 870 seconds ( 15 minutes) per PR. As shown in Figure 4, the overhead is dominated by LLM-enabled stages and environment provisioning, while lightweight static analysis contributes negligibly. Test generation is the most expensive LLM stage, and test execution is another major bottleneck because most of its time is spent on Conda/Docker environment setup.
For LLM cost, each PR consumes approximately 60K–100K tokens across intent extraction, oracle synthesis, test generation, augmentation, and final classification, as shown in Figure 5. This corresponds to about 0.02 per PR with DeepSeek-Chat and 0.23 per PR with Claude Haiku 4.5. Overall, monetary cost is modest, whereas runtime remains the main practical bottleneck; parallel execution and environment caching can further reduce this overhead.
E. RQ4: Effectiveness on Real-World Regressions
Finally, we evaluate whether ORION can discover unknown, unreported regressions in real pull requests from popular open-source projects. Our goal in this study is to assess the practical effectiveness of ORION in realistic development settings, rather than to perform large-scale mining.
We selected four widely used Python projects from diverse domains: FastAPI for web/API frameworks, SymPy for symbolic mathematics, NetworkX for graph analysis, and Keras for deep learning. For each project, we collected PRs merged after June 1, 2025 using the query is:pr is:merged merged:>=2025-06-01. We retained PRs with valid base branches and 1–10 modified Python files, excluding test-only, documentation-only, formatting, typing, versioning, backport, and CI-only changes. After filtering, ORION was applied to 1,459 PRs in total: 198 from NetworkX, 352 from SymPy, 127 from FastAPI, and 782 from Keras, as summarized in Table V. Across the complete study, ORION produces 28 warnings. When revisiting these warnings, 9 are no longer reproducible on the current repository versions because later upstream changes removed the corresponding behavior. We manually inspect the remaining 19 currently reproducible warnings and identify 9 reproducible bug candidates. Eight have been confirmed by project maintainers, while one remains under discussion.

Fig. 5. LLM token consumption per PR.
TABLE V SUBJECTS AND PRS EVALUATED IN THE REAL-WORLD STUDY.
| Project | Domain | Approx. Stars | #PRs |
|---|---|---|---|
| NetworkX | Graph analysis | 17.3k | 198 |
| SymPy | Symbolic mathematics | 15.0k | 352 |
| FastAPI | Web/API framework | 103.3k | 127 |
| Keras | Deep learning framework | 64.4k | 782 |
| Total | - | - | 1,459 |
In total, ORION identified 9 reproducible, previously unreported bug candidates in these recent real-world PRs. Among them, 8 have been confirmed by maintainers and 1 remains under discussion, as shown in Table VI. These findings cover several forms of behavioral regression introduced by code evolution, including boundary-condition errors, backward-compatibility breaks, semantic logic changes, error-handling drift, and runtime exceptions caused by unsafe evaluation or incorrect field access.
Overall, this study shows that ORION can be applied to hundreds of recently merged PRs across multiple active Python ecosystems. The goal of RQ4 is not to estimate the prevalence of regressions in these projects, but to evaluate whether ORION can surface concrete, previously unreported behavioral regressions under a reproducible PR selection protocol. The results show that structured-oracle-guided regression detection can uncover non-trivial real-world issues that evade existing quality assurance processes.
TABLE VI REAL-WORLD REGRESSIONS DETECTED BY ORION.
| ID | Project | Type | Regression Description | Status |
|---|---|---|---|---|
| 1 | NetworkX | Boundary | Similarity function raises exception for small graphs without auto-clamping parameters. | Confirmed |
| 2 | NetworkX | Error handling | Invalid backend parameter triggers ImportError instead of being stored as an attribute. | Confirmed |
| 3 | NetworkX | Numerical stability | HITS normalization divides by zero after an eigensolver change, producing infinite or NaN scores. | Confirmed |
| 4 | NetworkX | Semantic logic | VF2++ isomorphism functions return reversed node mappings, breaking the original mapping direction. | Confirmed |
| 5 | NetworkX | Semantic logic | Positive-weight self-loops overwrite zero self-distances in Floyd-Warshall, producing incorrect shortest-path distances. | Confirmed |
| 6 | FastAPI | Compatibility | Public attribute removed without backward compatibility or depreciation. | Confirmed |
| 7 | FastAPI | Runtime exception | NameError in parsing stringified type hints under Python 3.10+ due to unsafe evaluation. | Confirmed |
| 8 | Keras | Runtime exception | AttributeError in ZIP extraction caused by wrong file name field access. | Confirmed |
| 9 | SymPy | Semantic logic | Removed imaginary value checks, failing to return EmptySet for complex-real intersections. | Discussing |
VI. THREATS TO VALIDITY
Internal validity: ORION reconstructs pre- and post-change environments with Conda/Docker, where underspecified dependencies, unavailable packages, or toolchain incompatibilities may cause execution failures unrelated to regressions. It also relies on LLM-generated oracles and PR intent modeling, so implicit developer intent or inaccurate oracles may affect test generation and final classification. ORION is more effective for regressions with explicit observable differences, such as return values, exceptions, CLI/config/IO, and serialization behavior. It may miss cases involving complex states, remote services, caches, asynchronous behavior, or optional dependencies, and may produce false positives for intended API evolution or over-sensitive exception/message differences. The average 15-minute runtime makes ORION more suitable for asynchronous CI/CD analysis or high-risk PR screening than interactive review. LLM-based stages are nondeterministic and may produce different oracles, tests, or final judgments across repeated runs. The repeated DeepSeek-V3.2 evaluation in RQ1 shows moderate run-to-run variability, which should be considered when interpreting single-run performance. Moreover, because the exact training corpora of the evaluated LLMs are unavailable, we cannot rule out their prior exposure to public GitHub PRs included in RegBench-Py. Although ORION requires executable pre- and post-change evidence, this requirement does not eliminate the potential threat of training-data leakage.
External validity: Our evaluation is based on RegBench-Py and real-world Python projects, so the results may not generalize to other languages, ecosystems, or development workflows. RegBench-Py is limited in size and may not cover all regression patterns. Although regression and clean PRs have comparable typical churn, regression PRs show a wider spread and heavier tail, leaving PR size as a potential confounder. We mitigate this issue using a balanced dataset and churn-distribution analysis, but broader benchmarks are needed.
Construct validity: Precision, recall, and F1-score measure PR-level binary regression detection rather than oracle quality, intent fidelity, or exact bug-instance matching. Manual inspection shows that 38 of the 49 PRs predicted by ORION at least partially cover the developer-reported regression. Baselines show similar limitations but detect fewer positives, with only 6/18, 7/14, and 9/14 cases consistent for Testora, the pure LLM baseline, and Codex, respectively. Thus, our results should be interpreted as PR-level detection rather than exact localization or full reproduction. Because the exact training corpora of the evaluated LLMs are unavailable, we cannot exclude the possibility that some public GitHub PRs in RegBench-Py were encountered during model pretraining. ORION additionally relies on executable pre/post evidence rather than model-only judgment, but this does not eliminate the potential training-data leakage threat.
VII. RELATED WORK
A. Regression Detection and Behavioral Differences
Regression detection has been extensively studied through regression test selection, prioritization, and minimization [21]–[23], which improve testing efficiency but depend on existing test suites and may miss uncovered regressions. Other work detects behavioral differences across program versions, including differential testing and its variants [24]–[26], as well as change-aware techniques such as differential assertion checking [27]. However, these approaches mainly expose differences rather than determine whether they are intended. Commits and PRs have also been used for defect prediction and change risk analysis [28], [29], while recent PR-level regression detection work [7] still relies on unstructured diffs and lacks explicit behavioral modeling. PatchGuru [8] is also closely related to ORION in that it reasons about PR intent and operationalizes intended behavior into executable assertions paired with concrete inputs. ORION differs in first constructing a function-indexed structured behavioral oracle that separately represents preservation requirements, intended evolution, setup requirements, and control-flow conditions. These oracle items subsequently guide multiple executable tests and targeted augmentation. Moreover, PatchGuru's current implementation targets single-function PRs, whereas ORION supports PRs involving multiple impacted functions and retains local caller/callee context. In contrast, ORION performs intent-aware regression detection by jointly modeling structural changes and expected behavior.
B. Automated Test Generation
Automated test generation includes random testing [30], search-based testing [5], symbolic/concolic execution, and hybrid approaches [31], [32], which improve coverage but are largely agnostic to code-change semantics. Recent LLM-based techniques further generate unit tests, fuzzing inputs, and bug-reproduction tests [14], [33]–[40], often with feedback loops or search integration [41]–[43]. Despite their effectiveness, most methods optimize general coverage or mutation score [5], [44] and entangle behavioral reasoning with test synthesis, limiting their ability to target regression-relevant behaviors and reducing interpretability. ORION instead separates behavioral-oracle synthesis from test generation and explicitly targets regression-inducing conditions.
C. Modeling Code Changes, Intent, and Oracles
Understanding code evolution requires reasoning about both structural changes and developer intent. Prior work mines version histories to predict defects and characterize changes [28], [45], [46], while empirical studies show that subtle interface changes and dynamic-language behaviors are important regression sources [11], [12], [47], [48]. Natural language artifacts have been used to infer intent [7], [49], but are typically treated as unstructured input. Meanwhile, the test oracle problem remains fundamental [9], [50]; existing techniques derive oracles from specifications, invariants, metamorphic relations [51], [52], or oracle-aware regression test selection [53]. These approaches usually assume stable expected behavior and do not explicitly model evolving expectations across versions. In contrast, ORION integrates intent and structural signals to construct change-aware oracles that distinguish preserved and changed behaviors.
D. LLM-Based Program Analysis
LLMs have been widely applied to program analysis tasks [20], [34], [54], [55], but still struggle with fine-grained structural reasoning and consistency on code changes [15], [56]. Prior work often incorporates lightweight static analysis to guide LLM reasoning, yet few systems explicitly couple static risk signals, structured behavioral oracles, and differential execution for PR-level regression detection. ORION adopts this staged design to improve robustness and interpretability without heavy analysis overhead.
VIII. Conclusion
We present ORION, a PR-level behavioral regression detection framework that combines PR intent modeling, structured oracle synthesis, oracle-guided test generation, and differential execution. We construct RegBench-Py, a benchmark of 154 Python PRs with verified labels. ORION achieves F1-scores of 0.6125 with DeepSeek-Chat-V3.2 and 0.5578 with Claude-4.5-haiku, outperforming the baselines evaluated on the full benchmark under the corresponding settings. A scope-aware comparison with PatchGuru shows that neither method consistently dominates on the commonly completed single-function PRs, while ORION supports a broader range of multi-function PRs. ORION requires approximately 15 minutes per PR, making it practical for asynchronous CI/CD or high-risk PR analysis. In an extended real-world analysis of 1,459 PRs, ORION identifies 9 reproducible bug candidates, 8 of which have been confirmed by maintainers. Overall, these results demonstrate that structured behavioral oracles provide a practical foundation for intent-aware PR-level regression detection.
IX. DATA AVAILABILITY STATEMENT
Our source code and experimental data are available at https://github.com/wenwen-666/ORION.
REFERENCES
[1] H. K. Leung and L. White, “A study of integration testing and software regression at the integration level,” in Proceedings. Conference on Software Maintenance 1990. IEEE, 1990, pp. 290–301.
[2] M. A. Jamil, M. Arif, N. S. A. Abubakar, and A. Ahmad, “Software testing techniques: A literature review,” in 2016 6th international conference on information and communication technology for the Muslim world (ICT4M). IEEE, 2016, pp. 177–182.
[3] C. Cadar, D. Dunbar, and D. R. Engler, “KLEE: Unassisted and automatic generation of high-coverage tests for complex systems programs,” in Proceedings of the 8th USENIX Symposium on Operating Systems Design and Implementation, 2008, pp. 209–224.
[4] R. Majumdar and K. Sen, “Hybrid concolic testing,” in 29th International Conference on Software Engineering (ICSE'07). IEEE, 2007, pp. 416–426.
[5] G. Fraser and A. Arcuri, “Evosuite: automatic test suite generation for object-oriented software,” in Proceedings of the 19th ACM SIGSOFT symposium and the 13th European conference on Foundations of software engineering, 2011, pp. 416–419.
[6] M. Harman, S. A. Mansouri, and Y. Zhang, “Search-based software engineering: Trends, techniques and applications,” ACM Computing Surveys (CSUR), vol. 45, no. 1, pp. 1–61, 2012.
[7] M. Pradel, “Testora: Using natural language intent to detect behavioral regressions,” arXiv preprint arXiv:2503.18597, 2025.
[8] T. Le-Cong, B. Le, T. Murray, M. Pradel, and C. Cadar, “PatchGuru: Patch oracle inference from natural language artifacts,” arXiv preprint arXiv:2602.05270, 2026. [Online]. Available: https://arxiv.org/abs/2602.05270
[9] E. T. Barr, M. Harman, P. McMinn, M. Shahbaz, and S. Yoo, “The oracle problem in software testing: A survey,” IEEE Transactions on Software Engineering, vol. 41, no. 5, pp. 507–525, 2015.
[10] M. Pezze and C. Zhang, “Automated test oracles: A survey,” in Advances in computers. Elsevier, 2014, vol. 95, pp. 1–48.
[11] A. Brito, M. T. Valente, L. Xavier, and A. Hora, “You broke my code: understanding the motivations for breaking changes in apis,” Empirical Software Engineering, vol. 25, no. 2, pp. 1458–1492, 2020.
[12] R. G. Kula, A. Ouni, D. M. German, and K. Inoue, “An empirical study on the impact of refactoring activities on evolving client-used apis,” Information and Software Technology, vol. 93, pp. 186–199, 2018.
[13] K. Huang, Y. Yan, B. Chen, Z. Tao, and X. Peng, “Scalable and precise application-centered call graph construction for python,” arXiv preprint arXiv:2305.05949, 2023.
[14] G. Ryan, S. Jain, M. Shang, S. Wang, X. Ma, M. K. Ramanathan, and B. Ray, “Code-aware prompting: A study of coverage-guided test generation in regression setting using llm,” Proceedings of the ACM on Software Engineering, vol. 1, no. FSE, pp. 951–971, 2024.
[15] M. L. Siddiq, J. C. Da Silva Santos, R. H. Tanvir, N. Ulfat, F. Al Rifat, and V. Carvalho Lopes, “Using large language models to generate junit tests: An empirical study,” in Proceedings of the 28th International Conference on Evaluation and Assessment in Software Engineering, ser. EASE '24. New York, NY, USA: Association for Computing Machinery, 2024, pp. 313–322.
[16] R. Just, D. Jalali, and M. D. Ernst, “Defects4j: A database of existing faults to enable controlled testing studies for java programs,” in Proceedings of the 2014 international symposium on software testing and analysis, 2014, pp. 437–440.
[17] X. Song, Y. Lin, S. H. Ng, Y. Wu, X. Peng, J. S. Dong, and H. Mei, "Regminer: towards constructing a large regression dataset from code evolution history," in Proceedings of the 31st ACM SIGSOFT International Symposium on Software Testing and Analysis, 2022, pp. 314–326.
[18] R. Widyasari, S. Q. Sim, C. Lok, H. Qi, J. Phan, Q. Tay, C. Tan, F. Wee, J. E. Tan, Y. Yieh et al., “Bugsinpy: a database of existing bugs in python programs to enable controlled testing and debugging studies,” in Proceedings of the 28th ACM joint meeting on european software engineering conference and symposium on the foundations of software engineering, 2020, pp. 1556–1560.
[19] yt-dlp, “[patreon] fix some vimeo embed downloads,” https://github.com/yt-dlp/yt-dlp/pull/9613, 2024, GitHub pull request #9613, merged Apr 8, 2024, accessed Mar 19, 2026.
[20] A. Fan, B. Gokkaya, M. Harman, M. Lyubarskiy, S. Sengupta, S. Yoo, and J. M. Zhang, “Large language models for software engineering: Survey and open problems,” in 2023 IEEE/ACM International Conference on Software Engineering: Future of Software Engineering (ICSE-FoSE). IEEE, 2023, pp. 31–53.
[21] S. Yoo and M. Harman, “Regression testing minimization, selection and prioritization: a survey,” Software testing, verification and reliability, vol. 22, no. 2, pp. 67–120, 2012.
[22] E. Engström, P. Runeson, and M. Skoglund, “A systematic review on regression test selection techniques,” Information and Software Technology, vol. 52, no. 1, pp. 14–30, 2010.
[23] G. Rothermel, R. H. Untch, C. Chu, and M. J. Harrold, “Prioritizing test cases for regression testing,” IEEE Transactions on software engineering, vol. 27, no. 10, pp. 929–948, 2001.
[24] W. M. McKeeman, “Differential testing for software,” Digital Technical Journal, vol. 10, no. 1, pp. 100–107, 1998.
[25] T. Petsios, A. Tang, S. Stolfo, A. D. Keromytis, and S. Jana, “Nezha: Efficient domain-independent differential testing,” in 2017 IEEE Symposium on security and privacy (SP). IEEE, 2017, pp. 615–632.
[26] L. Da Silva, P. Borba, W. Mahmood, T. Berger, and J. Moisakis, “Detecting semantic conflicts via automated behavior change detection,” in 2020 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 2020, pp. 174–184.
[27] S. K. Lahiri, K. L. McMillan, R. Sharma, and C. Hawblitzel, “Differential assertion checking,” in Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering, 2013, pp. 345–355.
[28] S. Kim, E. J. Whitehead, and Y. Zhang, “Classifying software changes: Clean or buggy?” IEEE Transactions on software engineering, vol. 34, no. 2, pp. 181–196, 2008.
[29] Y. Kamei, E. Shihab, B. Adams, A. E. Hassan, A. Mockus, A. Sinha, and N. Ubayashi, “A large-scale empirical study of just-in-time quality assurance,” IEEE Transactions on Software Engineering, vol. 39, no. 6, pp. 757–773, 2012.
[30] C. Pacheco and M. D. Ernst, “Randoop: feedback-directed random testing for java,” in Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companion, 2007, pp. 815–816.
[31] P. Godefroid, M. Y. Levin, and D. A. Molnar, “Automated whitebox fuzz testing,” in Proceedings of the Network and Distributed System Security Symposium, 2008, pp. 151–166.
[32] N. Tillmann and J. de Halleux, “Pex-white box test generation for .net,” in Tests and Proofs. Springer, 2008, pp. 134–153.
[33] M. Tufano, D. Drain, A. Svyatkovskiy, S. K. Deng, and N. Sundaresan, "Unit test case generation with transformers and focal context," arXiv preprint arXiv:2009.05617, 2020.
[34] M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. D. O. Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman et al., “Evaluating large language models trained on code,” arXiv preprint arXiv:2107.03374, 2021.
[35] M. Schäfer, S. Nadi, A. Eghbali, and F. Tip, “An empirical evaluation of using large language models for automated unit test generation,” IEEE Transactions on Software Engineering, vol. 50, no. 1, pp. 85–105, 2023.
[36] S. Alagarsamy, C. Tantithamthavorn, and A. Aleti, “A3test: Assertion-augmented automated test case generation,” Information and Software Technology, vol. 176, p. 107565, 2024.
[37] Q. Zheng, X. Xia, X. Zou, Y. Dong, S. Wang, Y. Xue, L. Shen, Z. Wang, A. Wang, Y. Li et al., “Codegeex: A pre-trained model for code generation with multilingual benchmarking on humaneval-x,” in Proceedings of the 29th ACM SIGKDD conference on knowledge discovery and data mining, 2023, pp. 5673–5684.
[38] S. Fakhoury, A. Naik, G. Sakkas, S. Chakraborty, and S. K. Lahiri, “Llm-based test-driven interactive code generation: User study and empirical evaluation,” IEEE Transactions on Software Engineering, vol. 50, no. 9, pp. 2254–2268, 2024.
[39] Z. Wang, K. Liu, G. Li, and Z. Jin, “Hits: High-coverage llm-based unit test generation via method slicing,” in Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, 2024, pp. 1258–1268.
[40] S. Gu, Q. Zhang, K. Li, C. Fang, F. Tian, L. Zhu, J. Zhou, and Z. Chen, "Testart: Improving llm-based unit testing via co-evolution of automated generation and repair iteration," arXiv preprint arXiv:2408.03095, 2024.
[41] J. Altmayer Pizzorno and E. D. Berger, “Coverup: Effective high coverage test generation for python,” Proceedings of the ACM on Software Engineering, vol. 2, no. FSE, pp. 2897–2919, 2025.
[42] A. Deljouyi, R. Koohestani, M. Izadi, and A. Zaidman, “Leveraging large language models for enhancing the understandability of generated unit tests,” in 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE). IEEE, 2025, pp. 1449–1461.
[43] X. Chen, Z. Tao, K. Zhang, C. Zhou, X. Zhang, W. Gu, Y. He, M. Zhang, X. Cai, H. Zhao et al., “Revisit self-debugging with self-generated tests for code generation,” in Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 2025, pp. 18003–18023.
[44] M. Papadakis, M. Kintis, J. Zhang, Y. Jia, Y. Le Traon, and M. Harman, "Mutation testing advances: an analysis and survey," in Advances in computers. Elsevier, 2019, vol. 112, pp. 275–378.
[45] S. Kim, T. Zimmermann, E. J. Whitehead Jr, and A. Zeller, “Predicting faults from cached history,” in 29th International Conference on Software Engineering (ICSE'07). IEEE, 2007, pp. 489–498.
[46] A. Mockus and D. M. Weiss, “Predicting risk of software changes,” Bell Labs Technical Journal, vol. 5, no. 2, pp. 169–180, 2000.
[47] X. Ge, S. Sarkar, J. Witschey, and E. Murphy-Hill, “Refactoring-aware code review,” in 2017 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC). IEEE, 2017, pp. 71–79.
[48] S. Serbout and C. Pautasso, “An empirical study of web api versioning practices,” in International Conference on Web Engineering. Springer, 2023, pp. 303–318.
[49] A. Di Sorbo, S. Panichella, C. V. Alexandru, J. Shimagaki, C. A. Visaggio, G. Canfora, and H. C. Gall, “What would users change in my app? summarizing app reviews for recommending software changes,” in Proceedings of the 2016 24th ACM SIGSOFT international symposium on foundations of software engineering, 2016, pp. 499–510.
[50] E. J. Weyuker, “On testing non-testable programs,” The Computer Journal, vol. 25, no. 4, pp. 465–470, 1982.
[51] T. Y. Chen, S. C. Cheung, and S. M. Yiu, “Metamorphic testing: a new approach for generating next test cases,” arXiv preprint arXiv:2002.12543, 2020.
[52] S. Segura, G. Fraser, A. B. Sanchez, and A. Ruiz-Cortés, “A survey on metamorphic testing,” IEEE Transactions on software engineering, vol. 42, no. 9, pp. 805–824, 2016.
[53] T. Yu, X. Qu, M. Acharya, and G. Rothermel, “Oracle-based regression test selection,” in 2013 IEEE Sixth International Conference on Software Testing, Verification and Validation. IEEE, 2013, pp. 292–301.
[54] H. Pearce, B. Ahmad, B. Tan, B. Dolan-Gavitt, and R. Karri, “Asleep at the keyboard? assessing the security of github copilot’s code contributions,” Communications of the ACM, vol. 68, no. 2, pp. 96–105, 2025.
[55] L. Chen, Q. Guo, H. Jia, Z. Zeng, X. Wang, Y. Xu, J. Wu, Y. Wang, Q. Gao, J. Wang et al., “A survey on evaluating large language models in code generation tasks,” arXiv preprint arXiv:2408.16498, 2024.
[56] J. Cordeiro, S. Noei, and Y. Zou, “Llm-driven code refactoring: Opportunities and limitations,” in 2025 IEEE/ACM Second IDE Workshop (IDE). IEEE, 2025, pp. 32–36.