fix(core): prioritize structured display titles in tool invocation#27863
fix(core): prioritize structured display titles in tool invocation#27863aniruddhaadak80 wants to merge 1 commit into
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 updates the getDisplayTitle method within the BaseToolInvocation class to ensure that structured display names and tool names are prioritized over the default description. This change improves the consistency of tool identification in the UI and includes updated test cases to validate the new behavior. 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 the 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 counterproductive. 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
|
|
📊 PR Size: size/S
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
There was a problem hiding this comment.
Code Review
This pull request updates the getDisplayTitle method in BaseToolInvocation to prioritize _toolDisplayName and _toolName before falling back to getDescription(), and adds corresponding unit tests. The feedback suggests trimming these optional string properties before evaluating their truthiness to prevent whitespace-only strings from being displayed as empty titles in the CLI.
| getDisplayTitle(): string { | ||
| return this.getDescription(); | ||
| return this._toolDisplayName || this._toolName || this.getDescription(); | ||
| } |
There was a problem hiding this comment.
If _toolDisplayName or _toolName are provided as whitespace-only strings (e.g., " "), they will be evaluated as truthy and returned as the display title, resulting in blank or empty titles in the CLI. Trimming these values before checking their truthiness ensures a robust fallback to the tool description.
| getDisplayTitle(): string { | |
| return this.getDescription(); | |
| return this._toolDisplayName || this._toolName || this.getDescription(); | |
| } | |
| getDisplayTitle(): string { | |
| return this._toolDisplayName?.trim() || this._toolName?.trim() || this.getDescription(); | |
| } |
References
- When using an optional string with a fallback value, trim the optional string and use the fallback if the result is empty to avoid uninformative messages from whitespace-only strings.
Fixes #23018