This post goes live on 2 December 2026.

§ Writing10 min read

Coding agents repaired 86% of the security bugs they were shown. Next session, the repair barely mattered.

A new coding-agent study asks whether a repaired vulnerability changes what the agent writes in its next session.

When coding agents were shown a failing security test, they repaired the vulnerability 85.7% of the time. Then they started new sessions on later tasks. Agents that had seen the earlier fix introduced the same class of weakness in 26.7% of executions. Agents that hadn’t seen it did so in 27.5%.

Those figures come from a 24 November preprint by Guo and colleagues. It follows the sequence past the repaired diff. The starting point was deliberately hard: 14 task sequences selected from cases where each of the three tested agents had written working but insecure Python. These are results for those benchmark sequences, not a production failure rate.

The paper proposes PRECEPT, a method for evolving a library of security principles from failures and testing revisions against both security and functionality. I find the lesson useful even without adopting that method: a repaired pull request gives me evidence about that change. It does not establish that a future session will recognise the same problem in different code.

This is design analysis with illustrative TypeScript. I haven’t run PRECEPT or measured the workflow below. The example is hypothetical and the paper is a preprint.

What the study actually measured

The authors tested Codex, Claude Code and Qwen Code as different agent scaffolds, all using the same underlying Qwen3.6-35B-A3B model in the main study. They later tested transfer to another model, but the headline recurrence figures are not a comparison of the agents’ usual default models. The 14 sequences covered 12 weakness classes, with later tasks from both the original task family and a different family sharing the same Common Weakness Enumeration, or CWE.

The authors describe the distinction this way:

“Each task’s security tests check whether its implementation withstands the attacks that its CWE describes, and we call code ‘secure’ when it passes them, so our claims about security are limited to those attacks.”

Guo et al., submitted 24 November 2026.

That definition matters. Passing a test suite is evidence against the attacks represented by that suite. It is not a proof that code is secure against every input, deployment configuration or attacker.

PRECEPT turns published guidance and agent failures into a versioned library. Its principles can describe where a rule applies, what check must hold and what legitimate behaviour must remain allowed. The method uses fresh paired executions to estimate whether a revision helps and keeps a functional floor relative to the unmodified agent. The library is still guidance read by the model, not a runtime security control.

The authors report two results worth keeping together. On held-out SeCodePLT function-level tasks, 97.1% to 98.5% of the agents’ functional executions passed the benchmark’s security tests with their evolved libraries. The share of all executions that were both functional and secure was 47.8% to 50.6%. Those are different denominators. A high secure share among working code does not mean almost every attempt produced working, secure code.

The repository experiment is a useful counterweight. On 48 held-out SusVibes repository tasks, with Codex on Qwen3.6 and three runs per task, the paper found no statistically significant improvement in security over no guidance. Across the conditions, only 10.5% to 13.5% of functional executions passed the benchmark’s security tests. The authors note that this experiment could detect only large differences. I would not call that evidence that the method can never help repositories; I would not promise that its function-level results transfer to a real codebase either.

Imagine a coding agent adding a search endpoint to an invoice application. The endpoint takes a customer-supplied search term and returns invoices belonging to the signed-in tenant. A security test reveals that the first implementation concatenates the term into SQL. The agent changes that query to bind the value and the test passes.

This is a hypothetical task, not a vulnerability I have encountered. Next week the agent starts a fresh session to add a supplier search. It has a different table, route and function name, but it may need the same protection for untrusted values. The earlier pull request is useful evidence; it is a poor mechanism for ensuring the new query uses the same rule.

I would turn that failure into a small record that can be reviewed and tested:

Field Record for the example Question for review
Situation Query includes caller-controlled values Where else does this apply?
Required behaviour Bind values through the database API Is the query structure still application-owned?
Valid behaviour Search terms remain usable as data Do ordinary searches still work?
Exclusions Identifiers and sort directions need fixed choices Can an untrusted string become SQL syntax?
Evidence Security and functional tests, source revision Which attacks and valid cases were tested?
Owner Security reviewer and application owner Who approves a change or exception?

This is my proposed record, not PRECEPT’s wire format. Its contents are a candidate lesson, not a finding that the invoice application exists or was vulnerable. The source for the rule is OWASP’s SQL injection guidance: parameterise dynamic data values and use fixed application-owned choices for identifiers and sort directions.

The code still needs a boundary

A useful instruction can make the next diff easier to get right. It cannot stop an agent from ignoring the instruction or finding a different database client. For this example I would combine the lesson with a reviewed query API, least-privilege database access, security tests and an independent review of the change.

The distinction between values and SQL structure is small enough to show in code. This TypeScript is illustrative and unrun. The database driver’s exact API, database-specific syntax and authorisation model need to be checked in a real implementation.

type InvoiceSort = "date" | "amount";

const sortColumns: Record<InvoiceSort, string> = {
  date: "issued_at",
  amount: "total_amount",
};

function parseSort(value: unknown): InvoiceSort {
  if (value === "date" || value === "amount") return value;
  throw new Error("Unsupported sort key");
}

function invoiceSearch(
  tenantId: string,
  term: string,
  sort: InvoiceSort,
) {
  const column = sortColumns[sort];
  return {
    text: `SELECT id FROM invoices
           WHERE tenant_id = $1 AND supplier_name = $2
           ORDER BY ${column}`,
    values: [tenantId, term],
  };
}

The tenant ID must come from a trusted, authenticated authorisation context, not a caller-supplied parameter. The request boundary must call parseSort before calling invoiceSearch: TypeScript types do not validate JSON. The ORDER BY interpolation is safe only if every caller uses that runtime check and the map contains only fixed application-owned strings. A real implementation should enforce that boundary rather than relying on a comment.

Even then, parameterisation does not prove tenant isolation. The application and database need their own access checks, and tests must cover one tenant trying to read another tenant’s data. A correct query can still run under an overprivileged connection. The coding instruction and the enforcement boundary solve different parts of the problem.

Do not let the agent grade its own lesson

An agent can propose a lesson after a security test fails. I would not let that same run silently rewrite the instructions, relax the tests and declare the result an improvement. The learning path needs its own review and authority boundaries.

For the invoice example, the proposal should link to the failing test, the affected code version, the published principle it interprets and a minimal change to the instruction. The proposal should not copy customer data, credentials or an unreviewed external comment into a widely loaded project file. A security reviewer can decide whether the diagnosis and rule are sound; the application owner can check that normal search remains useful.

Then I would run the existing security suite and a separate functional suite in a restricted environment. The agent editing application code should not be able to disable the protected checks or approve changes to the instruction library on its own. Branch protection and test ownership only provide that separation if their configuration and credentials are outside the agent’s control.

GitHub’s code-scanning documentation describes analysing code for vulnerabilities and errors and surfacing results for review. I would use a scanner as an additional signal, not as an oracle that proves a query safe. Test blind spots, unsupported frameworks and changed policies still need an owner.

The preprint assumes trusted tasks, tests and learning infrastructure. A deployed workflow cannot assume every failure report or retrieved note is trustworthy. I would restrict who can propose and approve library changes, record the exact revision used by each run, and treat external issue text as data rather than instructions. If the provenance of a lesson is unknown, it belongs in an exception queue until someone checks it.

Measure the lesson on new work

The easiest test of the new rule is to rerun the invoice task that produced it. That is necessary for regression coverage, but it is not a good estimate of whether the lesson transfers. The rule might just encode the invoice route’s function name.

I would collect task families before testing: invoice search, supplier search and other query construction work. Keep entire families apart when selecting a candidate and evaluating it. Compare the current library with the candidate on the same held-out tasks, across fresh sessions and repeated executions. Do not use the held-out test failures to keep editing the candidate and still call that set held out; once it drives revisions, reserve another evaluation set.

For each condition, I would report at least these counts:

  • Executions attempted and executions with a testable result.
  • Functional passes, including legitimate inputs wrongly rejected.
  • Both functional and security-test passes, out of all attempts.
  • Security-test passes among functional executions, with that denominator shown.
  • Unread guidance, test failures, timeouts and unavailable tools as separate outcomes.

Suppose a candidate rejects every search request. An injection test might no longer find the injected value in a query, but the customer cannot search. The joint pass count catches that failure if the functional tests cover ordinary searches. It still depends on those tests being representative; a missing legitimate case will remain invisible.

Repeated runs help expose variation, but they do not create independent task families. I would analyse paired outcomes by task or family and report uncertainty, model version, agent configuration and test revisions. If the data is too small to distinguish a gain from noise, keep the change in review rather than announcing a percentage improvement. This is a proposed local evaluation, not a reproduction of PRECEPT’s acceptance rule.

Put the lesson where the edit happens

The repository result makes me cautious about simply adding more pages to AGENTS.md. In the authors’ repository experiment, the agent often edited long after it last read the relevant guidance. Some fixes also depended on project-specific permission or framework behaviour that a general principle could not supply.

For a real codebase, I would have the harness identify relevant repository-owned guidance at the point a database query is edited, then record which revision it supplied. That retrieval is itself a proposed design: it may miss a file, choose the wrong rule or add noise. Measure whether the agent used the guidance and whether the resulting code passed independent tests. Don’t treat a document-read event as proof that the rule was followed.

This builds on my post on code review as a bottleneck. That post asks how a team reviews a growing volume of code. This one asks what can be carried from a security failure into a later change, and how to test that the lesson still applies. The answer still includes a reviewer, because a model-written lesson can be wrong or overly broad.

What I’d do on Monday

  1. Choose a recent security regression with a reproducible, non-sensitive test case.
  2. Record the rule’s situation, required check and valid behaviour, with a link to its source and an owner.
  3. Check that the agent cannot modify the protected test or approve its own instruction change.
  4. Split related tasks by family and reserve fresh sessions for evaluation.
  5. Compare functional, security and joint outcomes, including failures and unknowns, over repeated runs.
  6. Review proposed guidance as code: version it, bound who can change it and retain its provenance.
  7. Keep runtime authorisation, database permissions and code review independent of the agent’s instructions.

Limitations

This is design analysis. The code and tests are illustrative and unrun. I haven’t evaluated PRECEPT or established that the proposed workflow improves a production system.

The paper is a preprint, with selected benchmark tasks, test-defined security and a shared underlying model in its main comparison. Its function-level gains did not translate into a statistically significant improvement in the reported repository experiment. Tests, scanners and guidance can each miss vulnerabilities; none is a substitute for the others.

Sources


  1. 7 min read

    Perplexity needs a measurement contract

    OpenAI proposes perplexity as a shared progress metric. Compare scores only with their dataset, scorer, tokenizer and model stage attached.


  2. 10 min read

    Azure AI Gateway's migration keeps your tool names. The policies on those tools don't carry over.

    Azure AI Gateway brings models and tools into one place. A migration still has to preserve the caller's authority at the backend.


  3. 11 min read

    Anthropic's Rust API passed 98% of its tests. A quarter of production inputs matched.

    Anthropic's API migration shows how to compare two implementations without confusing model variance with a regression.