Fix #432: Add error rule for empty message content validation#433
Fix #432: Add error rule for empty message content validation#433
Conversation
Add a new error rule to handle the "all messages must have non-empty content except for the optional final assistant message" validation error from Claude API. This is a non-retryable client error that should not trigger provider retries. Closes #432 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary of ChangesHello @ding113, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial enhancement to error handling by implementing a new default error rule. The primary goal is to accurately identify and categorize a specific validation error from the Claude API related to empty message content. By doing so, the system will now correctly mark this error as non-retryable and present a clear, localized error message to the user, improving both system efficiency and user experience. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a new error rule to correctly handle a specific validation error from the Claude API regarding empty message content. The change is well-implemented and follows the existing structure for error rules. I have one suggestion to improve the specificity of the pattern for better long-term robustness.
🧪 测试结果
总体结果: ✅ 所有测试通过 |
There was a problem hiding this comment.
Code Review Summary
No significant issues identified in this PR.
PR Size: XS
- Lines changed: 17
- Files changed: 1
Review Coverage
- Logic and correctness - Clean
- Security (OWASP Top 10) - Clean
- Error handling - Clean
- Type safety - Clean
- Documentation accuracy - Clean
- Test coverage - Adequate
- Code clarity - Good
Automated review by Codex AI
There was a problem hiding this comment.
- Identified open PR
#433(“Fix #432: Add error rule for empty message content validation”). - PR size classified as XS (17 additions, 0 deletions, 1 file) and applied label
size/XS. - Completed review of the diff (
src/repository/error-rules.ts) across logic/security/error-handling/types/comments/tests/simplification perspectives; no issues meeting the report threshold were found. - Submitted the review summary to GitHub via
gh pr review 433 --comment.
Summary
Problem
Fixes #432
When Claude API returns this validation error, it was not being classified as a non-retryable error, potentially causing unnecessary retry attempts.
Solution
Added a new error rule with the following configuration:
all messages must have non-empty content(contains match)validation_errorChanges
DEFAULT_ERROR_RULESinsrc/repository/error-rules.tsTesting
🤖 Generated with Claude Code