Repository navigation
Conversation
Summary of ChangesHello, 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 significantly improves the robustness of tool error handling by providing more detailed and actionable information to the model. By embedding structured metadata like error type, recoverability, and specific hints directly into tool error responses, the system enables more intelligent and adaptive error recovery strategies. This enhancement ensures that the model can distinguish between different error conditions and receive guidance on how to proceed, leading to more resilient and effective tool interactions. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces structured error classification and recovery hints to tool error responses, which is a significant improvement for the model's ability to understand and self-correct from tool failures. The changes are consistently applied across ToolExecutor, CoreToolScheduler, and Scheduler, ensuring a unified approach to error reporting. The update to contentLength calculation to use the serialized response payload size is also a correct and necessary adjustment. Comprehensive test cases have been added for isFatalToolError, getRecoveryHint, and the structured error response format, demonstrating thorough validation of the new functionality.
4b323b6 to
c80307c
Compare
…o tool error responses Tool error responses sent to the model were unstructured strings, forcing the model to infer error category and recovery strategy from natural language. - Add getRecoveryHint() with lookup table mapping ToolErrorType variants to actionable recovery hints - Include error_type, recoverable, and hint fields in functionResponse.response when errorType is available - Update all three createErrorResponse sites (ToolExecutor, CoreToolScheduler, Scheduler) for consistency - Fix contentLength to use serialized response size instead of display text - Add test coverage for structured error fields in coreToolScheduler Backward compatible — new fields only appear when errorType is defined. Fixes google-gemini#23156 Made-with: Cursor
c80307c to
287c668
Compare
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
Summary
error_type,recoverable,hint) to tool errorfunctionResponse.responseso the model can distinguish recoverable errors from fatal ones and get actionable guidancecreateErrorResponsesites (ToolExecutor, CoreToolScheduler, Scheduler) for consistencycontentLengthto use serialized response payload size instead of display text lengthDetails
Before:
{ "error": "Error: File not found: /src/utils/halper.ts" }After:
{ "error": "Error: File not found: /src/utils/halper.ts", "error_type": "file_not_found", "recoverable": true, "hint": "Verify the file path exists. Use glob or list_directory to find the correct path." }Changes:
tool-error.ts—getRecoveryHint()with lookup table mapping 10ToolErrorTypevariants to hintstool-executor.ts— structured error fields in ToolExecutor'screateErrorResponse()coreToolScheduler.ts— same enhancement to CoreToolScheduler'screateErrorResponse()scheduler.ts— same enhancement to Scheduler'screateErrorResponse()tool-error.test.ts— 14 tests forisFatalToolErrorandgetRecoveryHinttool-executor.test.ts— 3 tests for structured error response formatcoreToolScheduler.test.ts— added structured field assertions to policy violation testsBackward compatible — new fields only appear when
errorTypeis defined. No interface changes, no new dependencies.How to Validate
```bash
npx -w @google/gemini-cli-core vitest run src/tools/tool-error.test.ts src/scheduler/tool-executor.test.ts src/core/coreToolScheduler.test.ts
```
All 53 tests pass.
tsc --noEmitclean.Fixes #23156