arXiv:2610.34098cs.SEOct 2026

Manuscript Offprint

arXiv:2610.34098

Securing Agent-Generated Code with Its Own Development History

Prateek Kumar Rajput, Shahzeb Khan, El-Hacen Diallo, Yewei Song, Jacques Klein, Tegawendé F. Bissyandé

Prateek Kumar Rajput*, Shahzeb Khan†, El-Hacen Diallo*, Yewei Song*, Jacques Klein*, and Tegawendé F. Bissyandé*

*University of Luxembourg, Luxembourg

{prateek.rajput, el-hacen.diallo, yewei.song, jacques.klein, tegawende.bissyande}@uni.lu

†Nostrum Biodiscovery S.L., Barcelona, Spain

shahzeb.khan@nostrumbiodiscovery.com

Abstract—Pull requests written by coding agents can pass a project's test suite while omitting a guard or a validation step. To find the missing condition, a reviewer currently relies on static analysis of the final code. An agent-generated change, however, is accompanied by a development history that a human commit does not provide. The agent's trajectory records each edit together with the agent's stated assumptions, and structural differencing shows how each changed function evolved. We present TRACER, a workflow that uses this development history as evidence for security review. TRACER tracks changes at the symbol level, treats the agent's recorded rationale as claims to be verified against the current code, accepts a repair only after assessment and functional validation, and attaches to each accepted repair an executable check that later changes must satisfy. On the SusVibes benchmark, symbol-level tracking places the vulnerable symbol in the review scope for 94.6% of agent patches, compared with 13.4% for the primary scanner warning. With two investigator models, the configuration that includes the agent's rationale yields the largest number of verified security repairs while preserving functionality, and adding AST history to it does not increase that number. A funnel analysis identifies where the remaining candidates are lost. In a study of structural-biology software, the combination of repair memory and a boundary check allows a subsequent feature request to succeed in nine of ten tasks without reintroducing the repaired vulnerability, whereas functional feedback alone succeeds in four and reintroduces the vulnerability in three.

Index Terms—Agentic Software Engineering, Vulnerability Repair, Provenance and Reasoning Traces, Silent Security Fixes, Continuous Software Evolution, Static and Dynamic Analysis.

I. INTRODUCTION

Coding agents now navigate repositories, edit source files, and run test suites through interfaces such as SWE-agent [1], and agent-based repair systems apply the same tool-driven loop to debugging [2]. A patch that passes the project's tests may still be insecure. Studies of generated code and of developers working with coding assistants report recurring security weaknesses [3]–[5], and SusVibes measures the gap at repository scale by grading functionality and security with separate test suites [6], [7]. In the cohort studied in this paper, 350 of 354 agent patches pass their functional tests and 69 pass their security tests. A team that merges a functionally correct patch therefore merges the missing security condition with it.

Reviewing such a patch requires reconstructing what the agent assumed and which condition it omitted. We refer to this reconstruction as code archaeology. Static application security testing (SAST) tools such as CodeQL [8] and Semgrep [9] report locations and flows in the final snapshot, and industrial deployments have established that diagnostics must be actionable at review time to be used [10]–[12]. LLM-assisted taint and dataflow analysis [13]–[15], analyzer-guided repair [16], and analysis-guided proof-of-concept generation [17] connect model judgments to source and execution evidence. All of these techniques operate on the current source. They do not explain why the agent omitted a guard or what it assumed about upstream inputs, and in our cohort the primary SAST warning is located on the symbol touched by the reference security fix in 13.4% of patches. In the remaining cases, the reviewer must first determine which symbol to examine.

An agent-generated change is accompanied by evidence that a human commit does not provide. The trajectory records each edit, each tool call, and the agent's ReAct-style explanation of its actions [18]. Structural differencing [19] shows how each changed function evolved, for instance a guard added at one turn and removed at a later one. The recorded rationale states assumptions about inputs, callers, and libraries. These statements are not faithful accounts of the model's internal reasoning [20], [21], and we treat them as claims to be verified. A claim that an input is already validated, for example, creates an obligation to inspect the validator and its callers. The thesis of this paper is that this development history constitutes security evidence, and that review of agent-generated code should be organized around the changed symbols and the recorded claims in addition to scanner warnings.

A second problem is that repairs are not preserved over time. Security fixes are often committed without being labelled as such [22], and a later change can undo them [23]. Section II describes an observed case in which a request for legacy checkpoint compatibility re-enabled the unrestricted deserialization that an earlier repair had removed, while every functional test passed. The evidence gathered during investigation, that is the invariant, its rationale, and an executable boundary check, can remain attached to the repaired symbol and be evaluated against every later proposal.

We present TRACER (Trace-based Runtime Analysis for Continuous Evolution and Release), a workflow that addresses both problems and is packaged as a portable skill that a coding

Figure

Fig. 1. TRACER links symbol-level development evidence to guarded security repair, then preserves repair invariants and executable checks for subsequent feature evolution. C0 to C3 vary the investigation evidence.

agent or a continuous-integration pipeline can load. Given a Git range or an agent trajectory, TRACER tracks changes at symbol level, keeps typed AST evolution and recorded rationale as separate evidence channels, and admits a repair only through a gate that requires a supported assessment of the current source, review of downstream consumers, and public functional validation. We call this guarded investigation. After a repair, TRACER writes a note that binds the invariant to the symbol's structural hash and to an independently owned boundary check that later changes must pass.

We evaluate TRACER in two settings. On SusVibes, 387 agent patches from seven coding generators are reviewed in four evidence configurations by two investigator models, DeepSeek-V3.2 and Gemini-3.8-Flash, for 3,096 repair runs. Symbol-level tracking brings the reference-vulnerable symbol into the review scope for 94.6% of patches, against 13.4% for the primary SAST location. Adding the agent's recorded rationale gives the highest verified security count with both investigators, 76 and 75 passes from 68 on the 345 patches evaluated in every configuration, with at most one functional regression. The gain is modest and its confidence interval includes zero, so we report it as an ordering that holds across two independent investigators rather than as a large effect. Adding AST history to the rationale configuration lowers the count with both investigators. In a second study, five components of structural-biology software relevant to the in silico drug discovery pipeline of Nostrum Biodiscovery, our industrial partner [24]–[29], are repaired and then followed through ten feature-evolution tasks under a one-retry budget. Functional feedback alone delivers both the feature and the repaired property in 4 of 10 tasks and accepts three contract violations. Repair memory with a boundary gate reaches 9 of 10 and accepts none.

The paper makes three contributions.

• A provenance-aware workflow and a portable skill. TRACER connects symbol-level change tracking, separate AST-evolution and rationale channels, guarded static and dynamic investigation, and persistent repair memory, and runs alongside an agent-generated change in an agent host or in CI.

• A two-investigator evaluation on 387 agent patches. The SusVibes study compares four evidence configurations across seven coding generators, reporting review coverage, verified security outcomes, and functional preservation together. The structural-biology study isolates repair memory from boundary feedback in a 2×22 \times 2 factorial under silent-fix feature evolution.

• A four-step repair funnel and a failure analysis. Following every attempt from hypothesis to retained patch separates losses in diagnosis, turn scheduling, and semantic repair from operational errors, and yields design lessons for agentic review systems.

References (50)