fix(review-memory): enforce structured output#4090
Conversation
| return stackFrames ? sanitizeReviewMemoryDiagnosticMessage(stackFrames) : null; | ||
| } | ||
|
|
||
| function getSafeErrorClass(error: unknown): string { |
There was a problem hiding this comment.
[SUGGESTION]: getSafeErrorClass is duplicated from ./llm.ts
This helper is byte-for-byte identical to getSafeErrorClass in ./llm.ts (added in this same PR). Consider exporting it from llm.ts (or a shared review-memory util) and importing it here so the two implementations don't drift apart. The repo's coding style asks to report DRY violations rather than silently duplicate.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Executive SummaryStructured-output enforcement is well built with careful sanitization; the only finding is a minor DRY duplication of Overview
Issue Details (click to expand)SUGGESTION
Other Observations (not in diff)No blocking issues. A few low-confidence notes for the author's consideration:
Files Reviewed (14 files)
Fix these issues in Kilo Cloud Reviewed by glm-5.2-20260616 · 761,644 tokens Review guidance: REVIEW.md from base branch |
Summary
Review Memory now asks the model for schema-checked JSON instead of trying to recover JSON from plain text. Bad or incomplete replies fail before any GitHub branch or pull request is created, while safe request details make failures easier to trace without storing prompts or model output. Structured-output routing is applied only where the selected provider supports it.
Verification
Visual Changes
N/A
Reviewer Notes
Provider-facing schemas remove unsupported rules, but the complete Zod schemas still validate every model reply inside the app. Failure reports contain only fixed messages, counts, and request IDs; they do not contain prompts, repository content, or raw model output.