Skip to content

Comments

Fix #432: Add error rule for empty message content validation#433

Merged
ding113 merged 1 commit intodevfrom
fix/issue-432-empty-content-error-rule
Dec 24, 2025
Merged

Fix #432: Add error rule for empty message content validation#433
ding113 merged 1 commit intodevfrom
fix/issue-432-empty-content-error-rule

Conversation

@ding113
Copy link
Owner

@ding113 ding113 commented Dec 24, 2025

Summary

  • Add a new default error rule to detect and properly handle the "all messages must have non-empty content except for the optional final assistant message" validation error from Claude API

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:

  • Pattern: all messages must have non-empty content (contains match)
  • Category: validation_error
  • Priority: 89 (same as other validation errors)
  • Override Response: Returns a user-friendly Chinese error message explaining that message content cannot be empty

Changes

  • Added new error rule to DEFAULT_ERROR_RULES in src/repository/error-rules.ts

Testing

  • TypeScript typecheck passes
  • Lint check passes
  • New rule follows existing patterns for validation errors

🤖 Generated with Claude Code

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>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • New Error Rule: A new default error rule has been added to detect and properly handle the 'all messages must have non-empty content' validation error originating from the Claude API.
  • Error Classification: This specific validation error is now correctly classified as a non-retryable error, preventing unnecessary retry attempts.
  • User Feedback: The new rule includes an override response that provides a user-friendly Chinese error message, explaining that message content cannot be empty.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions bot added size/XS Extra Small PR (< 50 lines) bug Something isn't working area:Error Rule labels Dec 24, 2025
@ding113 ding113 merged commit c9339c7 into dev Dec 24, 2025
14 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Dec 24, 2025
@github-actions
Copy link
Contributor

🧪 测试结果

测试类型 状态
代码质量
单元测试
集成测试
API 测试

总体结果: ✅ 所有测试通过

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 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.

@ding113 ding113 deleted the fix/issue-432-empty-content-error-rule branch December 30, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Error Rule bug Something isn't working size/XS Extra Small PR (< 50 lines)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant