Lessons learned: our AI fixing agent quietly forked open source, and why AI agents need guardrails
On attempt 27, an autonomous remediation agent in our internal testing wrote two new Java files into a repository. Both compiled. The tests passed. In effect, the agent had forked open source into our codebase, and it didn’t tell anyone.
The task was routine: remediate vulnerable dependencies in one of our own Java services by upgrading Spring Boot from 3.5.13 to 4.1.1. Nobody told the agent to create files under com.fasterxml.jackson.annotation, a package owned by the Jackson project. Nobody told it not to, either.
This is a lessons-learned story: what happened, why the pipeline stayed green, and what we changed because of it. An agent that tries harder when blocked is a liability. Agents that change code need hard stop conditions, and “I can’t fix this, and here’s why” must be a first-class result.
Two lessons stand out.
- First, AI agents need guardrails. Left unbounded, an agent can fork open source into your codebase without telling you, leaving license obligations and security exposure you don’t know you have.
- Second, the only way to find failures like this is to rigorously test. We caught this particular incident because we benchmark our own agents for quality and reliability, hunting for abnormal paths to “success,” and having our assumptions questioned or confirmed. Signal Agentic Fix, the newest agent in Black Duck Signal™, is better for it.
What the agent did
In earlier attempts, the agent bumped jackson-databind to 2.22.2 and jackson-annotations to 3.0-rc5. Those versions don’t match. The databind release references two annotation classes, JsonSerializeAs and JsonDeserializeAs, that don’t exist in that annotations jar. The JVM failed at class load with NoClassDefFoundError.
The correct fix was to pick matching Jackson versions or roll back. Instead, the agent created two empty @interface stubs with the missing names, inside Jackson’s package, inside our repository. The class loader stopped complaining. The build went green.
Why green CI was the wrong signal
None of the four problems below shows up in a passing build:
- Namespace collision. When the real Jackson annotations later reach the classpath, two classes share one fully qualified name. Which one loads depends on classpath order. One build machine works; another silently doesn’t.
- Wrong semantics. The real JsonSerializeAs tells Jackson how to serialize a type. The stub tells it nothing. Jackson’s reflective lookup finds it, reads no directive, and serializes differently at runtime, in paths the existing tests don’t cover.
- Hidden debt. A developer who later upgrades Jackson properly must know two ghost files exist. They sit in a package that no search for your own code will hit.
- Unseen open source risk. No manifest lists the forked code, so dependency tracking misses it. These stubs were empty, but an agent that copies real library source this way leaves license obligations and vulnerabilities nobody knows to look for.
The agent satisfied the objective it could measure, compile and pass, and broke the one it couldn’t. That is the general risk of optimizing against a proxy, and it applies to any agent with write access.
Hard ceilings, not soft guidelines
The run went through roughly 30 attempts. Each failure widened the search: version bumps, then mismatched versions, then a source-level fork of open source code. Nothing in the loop said stop.
Six rules would have ended this run early:
- Attempt ceilings. Set a fixed maximum number of iterations per finding. When the agent reaches it, the run ends. It does not escalate tactics.
- Write boundaries. Allow list what a dependency fix may touch: manifests, lock files, and identified call sites. Treat a new source file in a third-party namespace as a hard failure, not a warning.
- Escalation by policy, not persistence. A patch-level bump and a major-version migration are different jobs with different risk. Moving from one to the other is a human or policy decision, never the agent’s idea under pressure.
- Review of new files. Any new file in a remediation pull request gets human review by default.
- Precise goals. Define success as resolving the security finding at a named target version, not as getting the build to pass. An agent told to make the build green will find a way to make it green.
- Independent fork checks. Don’t rely on the agent to police itself. Run a separate check on every change that flags duplicate fully qualified class names and stubs that shadow classes from a dependency. When the check fires, block the change, end the run, and report what it found.
Our run passed once we narrowed the question: we switched from long-term upgrade guidance (a new major version) to short-term guidance, 3.5.13 to 3.5.16. A tighter target fixed it, not a more persistent agent. Black Duck SCA® provides short- and long-term guidance that agents can be instructed to choose for remediation.
NON-ACTIONABLE is an answer
The most useful output the agent could have produced was a structured “no” several attempts earlier. For example:
STATUS: NON-ACTIONABLE
TARGET: spring-boot 3.5.13 -> 4.1.1
BLOCKER: jackson-databind 2.22.2 needs classes absent from jackson-annotations 3.0-rc5
TRIED: <summary of attempts 1..N, each with its error>
NEXT STEP: human decision — align Jackson versions or use short-term guidance
Good machine uncertainty has three properties.
- It is structured, so a pipeline can route it.
- It is traceable, so a reviewer can see each attempt and its evidence.
- It is actionable, because it names the decision a human must make.
A silent workaround that looks like success is the costliest output an agent can produce, because nobody knows to look for it.
Where Black Duck fits
Deterministic remediation starts with deterministic inputs. Black Duck SCA gives two upgrade recommendations for a vulnerable component: short-term, typically within the same major version, and long-term, which usually requires a major version upgrade. That line is exactly the boundary our agent should not have crossed on its own.
Black Duck SCA can also open fix pull requests that upgrade vulnerable direct dependencies based on that guidance, set to short-term or long-term, through Bridge CLI and the Black Duck Security Scan integrations. Every change arrives as a reviewable pull request.
We hold our own remediation agent, Signal Agentic Fix, to the same rules. We found this failure in internal benchmarking, before a customer could, because quality and reliability are the bar for any agent that changes your code. Configurable remediation rules define what Signal Agentic Fix is allowed to fix, and how. Configurable validation rules set the coding standards and test suites every generated fix must satisfy. The agent re-scans each fix to validate it, and every change goes to a human for review before it is merged.
Before you hand an agent the keys
If you’re adding coding agents to your remediation pipeline, answer three questions first. What is the agent allowed to write? When must it stop? What does it hand a human when it does?
In an upcoming webinar, we’ll show the proof behind these lessons. That means benchmarks on how Signal Agentic Fix delivers functionally validated fixes, what they cost in AI token spend, and how speed and scale compare with developers alone, with a human in the loop.
Learn more about Signal Agentic Fix, which validates every fix and keeps a human in the loop, here.