I once deployed an automated release pipeline that piped raw git diff outputs straight into an LLM prompt. Two hours later, our generated release notes claimed that version 1.4.0 "optimized JSON payload serialization for low-latency clients."
In reality, the underlying commit was an emergency patch for a memory leak that crashed Kubernetes pods under peak traffic. The code diff happened to delete several buffer allocations, and the model fabricated an appealing performance feature out of thin air.
That incident exposed a fundamental blind spot in how engineering teams automate changelogs with AI.
When we ask an LLM to read a git commit or unified diff, we are asking it to divine human intent from syntax changes.
A diff tells you that timeoutMs changed from 5000 to 15000. It does not tell you that downstream payment gateways began dropping socket handshakes during cloud provider migrations. Without grounding context, the model resolves the ambiguity by inventing the most statistically plausible narrative: "improved network stability."
This becomes dangerous when breaking changes are involved. According to the Conventional Commits v1.0.0 specification, breaking changes can reside inside commit message footers or body paragraphs. A naive diff parser summarizes the altered function signature, while completely erasing the migration path requested by the engineer.
The problem deepens as more code is authored by autonomous AI coding agents. Agent-generated pull requests often arrive with beautifully formatted markdown descriptions. When I analyzed hundreds of these descriptions, I identified three recurring archetypes:
Standard summarization prompts routinely latch onto the unsupported-plausible archetype. The resulting changelog looks convincing to release managers, but distributes false technical claims to your users.
To stop LLMs from hallucinating reasons, I re-engineered the extraction pipeline in @necoz-oss/changelog-bot (hosted on GitHub).
Instead of relying solely on PR descriptions or diffs, the engine tracks back to where the problem was originally defined: the linked GitHub issue. Under the GitHub Issue Linking specification, closing keywords establish verifiable causal links.
// Match GitHub closing keywords preceding an issue reference or URL.
// See: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue
export const CLOSING_KEYWORD_PATTERN =
/(?:\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?))\s*[::]?\s*(?:\[[^\]]+\]\((?<markdownUrl>https?:\/\/[^\s)]+)\)|(?<issueUrl>https?:\/\/[^\s)]+\/issues\/(?<urlIssueNumber>\d+)\b)|(?:(?<repoPrefix>[\w.-]+\/[\w.-]+)?#(?<issueNumber>\d+)))/gi;
export function resolveLinkedIssueNumbers(
prBody: string,
repo: { owner: string; repo: string },
): number[] {
const matches = Array.from(prBody.matchAll(CLOSING_KEYWORD_PATTERN));
const issueNumbers = matches
.map((match) => match.groups?.issueNumber || match.groups?.urlIssueNumber)
.filter(Boolean)
.map(Number);
return Array.from(new Set(issueNumbers)).slice(0, 2);
}
Mining issue context introduces network risk. To protect CI runners against GitHub API rate limits, I bounded issue resolution concurrency and implemented strict sanitization. Noisy stack traces and debug dumps are stripped before candidate snippets reach the evaluation step, falling back gracefully to heuristic summaries if the API degrades.
The differences between an ad-hoc AI prompt and a ground-truth pipeline determine whether your changelog can be trusted in production.
| Architectural Dimension | Naive Git Diff + LLM Prompt | Grounded Pipeline (ChangelogBot Approach) |
|---|---|---|
| Primary Context Source | Raw lines added and deleted | Linked issue bodies and closing keywords |
| Noise Filtering | Ingests raw stack traces and AST churn | Sanitizes logs; bounds concurrent API requests |
| Hallucination Defense | None (pure probability generation) | Counterfactual calibration and archetype scoring |
| Delivery Decoupling | Hardcoded to create PRs or write files | Unix-compliant output ( stdout ,file ,pull-request ) |
| API Failure Fallback | Hard CI build failure | Graceful degradation to deterministic heuristics |
How do you verify whether an extractor captures genuine rationale rather than plausible fluff? You cannot rely on human intuition when reviewing hundreds of releases.
I built a counterfactual test corpus containing matched case families. For each pull request, the benchmark provides:
By tracking the False Positive Rate (FPR) when the extractor is presented with decoy options, I could mathematically penalize models that pick convincing-sounding lies. If an extraction engine cannot consistently reject a counterfactual candidate, it has no place in an automated production release pipeline.
The final anti-pattern I eliminated was coupling changelog generation to write-heavy side effects.
Traditional tools halt your CI pipeline if you do not grant them a write-scoped GitHub personal access token to open a pull request. I restructured changelog-bot so that changelog generation is completely decoupled from delivery:
--output stdout: Emits clean, streamable release markdown to standard out, redirecting all telemetry and diagnostic logs strictly to stderr.--output file: Appends updates locally to CHANGELOG.md with zero network overhead.--output pull-request: Reserves write token requirements strictly for automated PR creation.
This separation means developers can test release notes locally or pipe them into custom release scripts without provisioning repository write access.
stdout without mandating write permissions.
What failure modes have you encountered when feeding git logs or PR descriptions into LLMs?
If you found this article helpful, let's connect!