What I Built
ReviewFlow is an automated Code Review pipeline driven by a custom Multi-Agent architecture written in native TypeScript. Instead of relying on a single monolithic prompt, it structures and routes incoming Pull Requests to specialized agents (Security, Logic, and Style) to perform parallel reviews. The workflow is orchestrated through GitHub Actions and posts comments via the Octokit API.
The Blind Spot: When Brilliant AI Meets Silent Failures
Getting the pipeline to trigger GitHub Actions felt like a huge win. But then, I noticed a fatal issue: the comments were disappearing.
The logs showed the LLM was generating brilliant security and logic feedback, but on the actual Pull Request page, nothing was posted. After digging into the Octokit error logs, I found a subtle reliability bug: Coordinate Hallucination.
Even when the model correctly identified a vulnerability, it couldn't reliably anchor that feedback to a valid line in the Git Diff. My system had a strict VerifierNode designed to block invalid API requests. When it saw these hallucinated out-of-bound coordinates, it silently dropped the comments. A single hallucinated number was wiping out the entire review pipeline. During initial testing across 5 dummy Pull Requests, the LLM generated 14 highly valuable security and architectural suggestions. However, because of coordinate hallucination, 9 of them were completely dropped by the verifier node due to invalid line ranges. That's a 64% silent failure rate—brilliant engineering ideas lost in the ether simply because the AI couldn't read the Git Diff index accurately.
The Fix: Deterministic Guardrails
I needed an engineering solution. I built a Deterministic Validation Layer (parseDiffToValidLines) to pre-calculate an exact "Valid Diff Index" map before the LLM even sees the prompt.
At the boundary of this layer, we enforce a hard check to strip away any out-of-bounds coordinates or malformed responses before they hit the GitHub API:
typescript
// 3. 执行确定性验证 (Validation Layer)
const validatedComments = rawComments.filter(comment => {
return typeof comment.path === "string" &&
Number.isInteger(comment.line) && comment.line >= 1 &&
typeof comment.body === "string" && comment.body.length > 0;
});
// 4. 透明度反馈:告知用户过滤掉了多少无效内容
if (rawComments.length !== validatedComments.length) {
console.warn(`⚠️ Filtered ${rawComments.length - validatedComments.length} invalid comments from AI output.`);
}
1. Engineering with Copilot: I outlined the logic in comments, and Copilot rapidly generated the core parsing function and comprehensive unit tests to prove this layer was bulletproof.
2. The Result: The agents now have a hard constraint: Choose a line number strictly from this pre-verified list, or drop the comment.
By using Copilot to offload the heavy lifting of structural verification, I was able to inject deterministic reliability into a non-deterministic LLM pipeline. The silent failures stopped, and the agents finally pinned their feedback to the exact lines of code.
The Takeaway: In an LLM pipeline, non-deterministic components need deterministic guardrails.
**Demo**
1. Automated PR Feedback (GitHub Action):

2. Engineering Implementation (VS Code):

Explore the Code
https://github.com/ywu593412-afk/diffens


























