arXiv:2610.23782cs.SEOct 2026

Manuscript Offprint

arXiv:2610.23782

Enforcing Code Reasoning in Agentic Scaffold for More Effective Issue Resolution

Changshu Liu, Ji young Kim, Alireza Ghazanfari, Saanvi Nallu, Reyhaneh Jabbarvand

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

CHANGSHU LIU, JI YOUNG KIM, ALIREZA GHAZANFARI, SAANVI NALLU, REYHANEH JABBARVAND

Reasoning is essential to existing ReAct-based agents. In programming tasks such as issue resolution, the agent should reason about both textual artifacts and code. Despite agents being deployed at scale to automate many programming tasks, it remains unclear whether they perform any form of code reasoning in their thoughts, or to what extent it helps. To shed light on the impact of explicit code reasoning in programming agents, we focus on issue-resolution tasks from SWE-bench-Verified, SWE-bench-Pro, and SWE-bench-Lite, and present a large-scale empirical study on 7,955 trajectories from six single/multi-agent scaffolds across four programming languages. The results show that code reasoning, in 12 different forms, is already part of the problem-solving process in 66.95% of trajectories, though at varying intensity. Agents involving code reasoning in their trajectories achieve higher resolution rates, and they reason more intensively as task complexity increases. While the empirical study positions code reasoning as a first-class citizen for programming agents, agents perform it largely unguided and spontaneous, resulting in the following symptoms in their solutions: they may (1) reproduce only the surface-level symptoms of an issue during localization, (2) fail to validate near-hit patches whose behavior is hard to exercise with tests, (3) overlook requirements specified in the issue description, and (4) insufficiently validate patches, with tests that lack behavioral diversity.

To address these limitations, we propose DeskCheck, an agentic scaffold that systematically enforces code reasoning at each stage of repository-level issue resolution: DeskCheck simulates execution paths to trace the root cause during localization, simulates the execution of candidate patches to refine near-misses, audits patches against the requirements in the issue description, and reasons about inputs and expected outputs for corner cases before generating validation tests. Evaluation on 731 SWE-bench-Pro instances shows that DeskCheck improves the resolution rate over two widely used baselines, mini-SWE-Agent and Claude Code, by 6.29% to 10.53%, incurring only 0.02–0.02–0.28 (average = 0.14)additionalcostperinstance.Aprocess−centricanalysisshowsthat,comparedtothebaselines,DeskCheckconsistentlyachieveshigherrecallatmethod−levellocalization,repairsmoreissuesthatwerenotpreciselylocalized,andcapturesmissedcornercasesinnear−hitpatchesthatcanbeeasilyfixedandsubmittedsuccessfully.TheexactMcNemartestandrepeatedexperimentsconfirmthattheobservedsuperiorityisnotrandom(0.14) additional cost per instance. A process-centric analysis shows that, compared to the baselines, DeskCheck consistently achieves higher recall at method-level localization, repairs more issues that were not precisely localized, and captures missed corner cases in near-hit patches that can be easily fixed and submitted successfully. The exact McNemar test and repeated experiments confirm that the observed superiority is not random (p < 10^{-10}$ for all subject LLMs) and is unlikely to change due to inherent nondeterminism in agent behavior. These detailed per-phase analyses confirm that the improved outcome is not accidental but grounded in the design.

CCS Concepts: • Software and its engineering → Software creation and management.

Additional Key Words and Phrases: Programming agents, code reasoning, large language models

ACM Reference Format:

Changshu Liu, Ji young Kim, Alireza Ghazanfari, Saanvi Nallu, Reyhaneh Jabbarvand. 2018. Enforcing Code Reasoning in Agentic Scaffold for More Effective Issue Resolution. In Proceedings of Make sure to enter the correct conference title from your rights confirmation email (Conference acronym 'XX). ACM, New York, NY, USA, 22 pages. https://doi.org/XXXXXXX.XXXXXXX

Author's Contact Information: Changshu Liu, Ji young Kim, Alireza Ghazanfari, Saanvi Nallu, Reyhaneh Jabbarvand.

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.

Conference acronym 'XX, Woodstock, NY

© 2018 Copyright held by the owner/author(s). Publication rights licensed to ACM.

ACM ISBN 978-1-4503-XXXX-X/2018/06

https://doi.org/XXXXXXX.XXXXXXX

Anonymous et al.

1 Introduction

Reasoning is key to generalizability of Large Language Models (LLMs) [12, 19], allowing them to apply learned knowledge to unseen tasks. Assessing it helps ensure LLMs are not overfitting to specific workflows or training data [36, 50, 63, 71], ultimately leading to more robust and reliable decisions. Code reasoning [7, 10, 16, 17, 35, 39, 40, 58, 66], which requires understanding syntax as well as program execution, generalizes LLMs' knowledge to a broad range of programming tasks, such as test generation, issue resolution, code translation, and program verification. Beyond single-turn LLMs, programming agents [61, 67] autonomously navigate repositories and invoke tools, guided by reasoning about the problem specification and tool-execution observations. Prior work [9, 43, 44, 56] has analyzed trajectories of programming agents, focusing on the action or tool usage at each step, overlooking the underlying reasoning process that leads to actions. Specifically, there is a dearth of research on the analysis and impact of code reasoning.

To mitigate this gap, we performed a large-scale empirical study ( §2§2) on the reasoning of programming agents performing repository-level issue resolution, which has become the most dominant task to evaluate the overall coding capability of agentic systems [13, 14, 27, 69]. Specifically, we investigated the prevalence of different forms of code reasoning in issue resolution trajectories (RQ1, §2.2.1§2.2.1), its correlation with the resolution outcome (RQ2, §2.2.2§2.2.2), and the factors triggering code reasoning in agents for issue resolution (RQ3, §2.2.3§2.2.3). We systematically analyzed 7,955 trajectories from six single- and multi-agent scaffolds on issue-resolution tasks from SWE-bench-Pro, SWE-bench-Verified, and SWE-bench-Lite in Python, Go, TypeScript, and JavaScript.

We observed code reasoning in 66.95% of trajectories, though to varying degrees. Code reasoning strongly correlates with resolution outcome. Agents turn to code reasoning more frequently as problems become harder. Strikingly, despite the importance of code reasoning and its strong positive correlation with the final outcome, agents use it spontaneously rather than in a systematic, guided way. We illustrate the need for code reasoning in different stages of the issue resolution task (localization, patching, and validation) with the following examples from the study: A manual analysis of trajectories reveals four recurring limitations in different phases of issue resolution (localization, patching, and validation), each of which could have been avoided with a systematic incorporation of forms of code reasoning:

Limitation 1: Surface-level issue reproduction. Reproduction tests should turn issue descriptions into executable oracles for bug localization [52, 64, 67]. However, many agents rely heavily on the issue description and generate tests that capture only surface-level symptoms, resulting in partial localization and incorrect patch. Figure 1a shows an issue description from SWE-bench-Pro, with the buggy code in Figure 1b. The code initializes a YamlMigrations object from a settings in line 222, and calls the migrate function on this object in line 224. The YamlMigrations class consists of eight helper methods (Figure 1c), all of which are invoked by YamlMigrations.migrate(). The issue description says that when a settings object (and hence migrations) includes invalid data

Issue description: .....When settings contain invalid data types like integers or booleans instead of expected dictionary structure, migration methods crash with unhandled exceptions.....Configuration migration methods attempt to iterate over setting values without type checking, causing crashes when encountering non-dictionary values.....

(a) Issue description

YamlConfig.load 196: def load(self) -> None: ... else: settings = self.load_settings_object(yaml_data) self.dirty = False migrations = YamlMigrations(settings, parent=self) migrations.changed.connect(self.mark_changed) migrations.migrate()

(b) YamlConfig.load() before patching

7 similar helper functions YamlMigrations.migrate() reached by the hidden test migrate_string_value calls .items() to iterate over setting values ..... _remove_empty_patterns calls del and in to manipulate keys in a dictionary

(c) Call dependency in .migrate()

migrations._migrate_string_value('tabs.title.format', ...) → AttributeError: 'int' object has no attribute 'items'

(d) Surface-level reproduction test

Fig. 1. Claude Code (Claude Haiku-4.5) failure to resolve SWE-bench-Pro quitebrowser-8d05f028 due to surface-level issue reproduction.

types such as a boolean or an integer instead of a dictionary, the code will crash. It does not explain which methods expect a dictionary type, but gives a hint about "iterating over settings values." Claude Code with Claude Haiku-4.5 focuses on this overly specific hint, correctly localizing the bug to the YamlMigrations class, and writes reproduction unit tests for seven out of eight helpers, since they invoke items() API that iterates over settings values. Yet, it misses the _remove_empty_patterns function, as its implementation does not involve iterations over the dictionary values, yet it still crashes on non-dictionary settings. DeskCheck successfully resolves this issue by reasoning about the call chains and execution paths involving (YamlMigrations.migrate()), localizing the root cause precisely and repairing the issue

Limitation 2: Test harness complexity. Covering the code for the purpose of validation or bug reproduction can be tricky, when reachability occurs under peculiar environmental settings or conditions. Such tests may require mocking or importing specific libraries solely for testing, not for the patch itself. Figure 2 shows such a case, where per the issue description, the patch should implement a new function set_queue in the Display class to set the class property _final_q to the provided queue. When this function runs in a parent process, it should terminate with a RuntimeException. The mini-SWE-Agent with MiniMax-M3 implements the function as shown in Figure 2b, almost correctly but with

..... The method Display.set_queue must raise a RuntimeException if called in the parent process, and must set _final_q to the provided queue when called in a forked worker.....

(a) Issue description

4 files changed, 95 insertions, 59 deletions Class Display

..... 246 + def set_queue(self, queue): F2P: 2/5

247 + if self._final_q: 248 + raise RuntimeException("display queue already set") 249 + self._final_q = queue

(b) Patch by mini-SWE-Agent (MiniMax-M3)

1 file changed, 2 insertions, 2 deletions. Class Display

246 def set_queue(self, queue): F2P: 5/5

247 - if self._final_q: 248 - raise RuntimeException("display queue already set") 247 + if multiprocessing.parent_process() is None: 248 + raise RuntimeException("display: set_queue called on parent process (not in a forked worker); this is not supported") 249 self._final_q = queue

(c) Final patch by DeskCheck

Fig. 2. mini-SWE-Agent failure to resolve SWE-bench-Pro ansible-5e369604 due to difficulty of test generation.

an incorrect conditional check in line 247 (a near-hit patch [29, 34, 37, 46, 55, 62]). It attempts to generate tests to run this function in a forked process for 14 trajectory steps, but fails to set up the environment properly to run the tests. It finally gives up and submits the patch without testing, passing only two of five golden tests. The correct fix requires replacing the previous condition with multiprocessing.parent_process() is None (lines 247–248 in Figure 2c) to pass all five tests. Interestingly, DeskCheck generates the same initial patch, but refines it to the one in Figure 2c after simulating execution of the initial patch (without real execution; more details in §3.1.3) and realizing that the RuntimeException is not raised under the required condition.

Limitation 3: Neglecting requirements in the issue description. Issue descriptions can be long with multiple intertwined requirements. Although agents are instructed to understand the issue description, several studies show they overlook critical information in long issue descriptions [31, 73]. Therefore, they may generate incomplete patches that satisfy only a subset of issue description requirements. For example, mini-SWE-Agent (GPT-5.6-Luna), when attempting to resolve the problem protonmail-ac23d1ef from SWE-bench-Pro, generates a partial patch (editing 15 out of 23 edit locations from the golden patch), satisfying some of the requirements in the long issue description [21].

R1. during cancellation, the UI must always display the expiry date of the currently active subscription period.

R2. any date tied to a scheduled future plan should be ignored, because cancellation prevents that future plan from starting.

R7. With the context active or auto-renew disabled, use the active term only.

R8. In that "active-term only" case return subscriptionExpiresSoon/renewDisabled = true, renewEnabled = false, plus the date and plan name.

(a) Requirements extracted from the issue

helpers/payment.ts

120 export function subscriptionExpires(subscription:SubscriptionModel):SubscriptionResult; 121 export function subscriptionExpires( subscription?: SubscriptionModel | FreeSubscription | null // ✗ R7 ..... 131 const latestSubscription=subscription.UpcomingSubscription?subscription; // ✗ R7 ..... 140 const renewEnabled = latestSubscription Renew === Renew.Enabled; 141 const subscriptionExpiresSoon = renewDisabled; // ✗ R8 142 const planName = latestSubscription.Plans?.[0].Title; // ✗ R8 .....

(b) Code snippet need to be patched

Fig. 3. The buggy code corresponding to the specified requirements extracted from the issue description of SWE-bench-Pro protonmail-ac23d1ef.

Anonymous et al.

With more explicit specification reasoning [39], DeskCheck prepares a list of eight requirements from the issue description (Figure 3a), and it simulates the execution of the generated patch under all requirements to confirm the patch satisfies all the requirements, resolving the issue.

Limitation 4: Insufficient validation. Issue resolution is complex, involving multiple sub-tasks: understanding the issue description, generating reproduction tests, patching, and generating validation tests for the new code (different from reproduction tests) [11]. As a result, agents may not focus deeply on a single sub-task. Specifically, for test generation, agents usually reason about general corner cases of the newly generated code rather than maximizing behavioral diversity and covering the full input space. Figure 4a shows a patch generated by mini-SWE-Agent (MiniMax-M3) to resolve issue openlibrary-3f7db6bb from SWE-bench-Pro. The agent's generated tests (Figure 4c) fall short not in number but in the variety of conditions they cover: they never consider case-insensitivity (t2) or multi-word (t3) inputs, resulting in failure. An enforced reasoning step to identify diverse inputs, determine their corresponding outputs helps DeskCheck resolve this issue.

def is_nonbook(binding: str, nonbooks: list[str]) -> bool: return any(word in binding for word in nonbooks)

(a) Buggy patch (is_nonbook) from Mini-SWE-Agent

NONBOOK = [ 'Audiobook', 'Audio CD', 'DVD', ..., 'DVD-ROM', 'Video', 'Video Game', 'Vinyl', 'Audio Cassette']

(b) Constant NONBOOK

idHidden testsmini-SWE-Agent tests
t1("DVD", NONBOOK) → True("DVD", NONBOOK) → True("Audiobook", NONBOOK) → True
t2("dvd", NONBOOK) → TrueNA
t3("audio cassette", NONBOOK) → TrueNA
t4("paperback", NONBOOK) → False("paperback", NONBOOK) → False("Hardcover", NONBOOK) → False

(c) Comparison between hidden tests and mini-SWE-Agent validation tests

Fig. 4. Comparison between SWE-bench-Pro hidden tests and mini-SWE-Agent validation tests for issue openlibrary-3f7db6bb from mini-SWE-Agent (MiniMax-M3)

To overcome the mentioned limitations, this work proposes DeskCheck 1^{1} , an agentic scaffold that enforces various forms of code reasoning at different stages of issue resolution: in the Localization phase, DeskCheck simulates the execution paths mined from the call graph to trace the root cause of the issue from surface-level symptoms in the issue description ( §3.1.2\S3.1.2 ); in the Repair & Refine phase, DeskCheck simulates the execution of the initial patch to check if it matches the expected behavior, and refines it based on the feedback collected from the simulation ( §3.1.3\S3.1.3 ); in the Audit phase, DeskCheck extracts requirements from the issue description and leverages code reasoning to check if the generated patch fulfills all the requirements ( §3.1.4\S3.1.4 ); finally, in the Validation phase, it reasons about a diverse set of input-expected output pairs to ensure a thorough validation ( §3.1.5\S3.1.5 ).

Extensive evaluation of DeskCheck on 731 problems in SWE-bench-Pro show consistent improvement in issue resolution compared to mini-SWE-Agent (+6.29%–10.53%) and Claude Code (+8.34%) baselines, agnostic to the studied backbone models, i.e., MiniMax-M3, GPT-5.6-Luna and Claude Haiku-4.5. This comes with negligible overhead, increasing token usage by 7.6% on average. Every stage of guided code reasoning contributes to this gain (RQ5, §3.4). Without executing reproduction tests, DeskCheck's localization achieves an average method-level recall of 0.66, outperforming mini-SWE-Agent (0.46), Claude Code (0.38), and SWE-Doctor (0.23) with the same LLMs, even though SWE-Doctor executes 28.0 reproduction tests per instance on average. Among the instances the baselines fail to resolve, patches revised in the Repair & Refine, Audit, Validation phase by DeskCheck are more likely to be successfully resolved, which is supported by chi-square tests (p < 0.05). We also provide qualitative examples illustrating how guided code reasoning in each stage contributes to successful issue resolution (§4). Finally, our ablation (§5) shows that the resolution rate grows monotonically from 53% to 68% as code reasoning is incorporated stage by stage, supporting that the improvement comes from code reasoning at different levels.

Our notable contributions are: (1) a large-scale study of 7,955 issue resolution trajectories (from six single- and multi-agent scaffolds resolving SWE-bench-family instances) to understand whether and

1^{1} Inspired by desk checking: programmers trace a program by hand with concrete inputs to find bugs without running it.

Figure

Fig. 5. Code Reasoning Pattern Categorization.

how agents incorporate code reasoning in their problem-solving; (2) the design and implementation of DeskCheck, a code reasoning-driven multi-agent scaffold for issue resolution; and (3) extensive quantitative and qualitative evaluation of DeskCheck.

References (27)