fix: 模型输出不可解析时优雅降级 + 记录原始输出便于诊断#8
Merged
Merged
Conversation
…gnosis A weak model occasionally returns an empty/invalid structured result; after retries this threw a raw ZodError, failing the run and posting nothing (contradicts the non-blocking design). Now: - review() surfaces InvalidModelOutputError carrying the raw output. - The Action catches it: logs the raw output snippet + token usage (so the run log reveals what the model returned), upserts a degraded "couldn't generate a valid review" comment, and exits green (non-blocking). Other errors still fail the run. 55 tests green; bundle rebuilt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
真实实测(BanDB#48)暴露:DeepSeek 返回了空的结构化结果,重试后仍空,旧代码抛原始 ZodError → Action 变红且什么都没发,违背"不阻塞"原则;而且看不到模型到底返回了什么,无法诊断。
改动
review()在重试耗尽且输出不可解析时抛InvalidModelOutputError,携带原始输出。价值
既修了健壮性缺口(弱模型返回垃圾不该让工具崩),又为当前这个"空输出"问题提供了诊断手段。
验证
55 个单测全绿(新增 errors 测试 + 降级评论测试 + review 错误类型断言);bundle 已重打包。
🤖 Generated with Claude Code