arXiv:2610.35223cs.SEOct 2026

Manuscript Offprint

arXiv:2610.35223

Behavioral Regression Detection for Pull Requests via Structured Oracles

Yiwen Fu, Binhang Qi, Xiao Li, Runlin Liu, Hailong Sun, Xiang Gao

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.

References (56)