Skip to content

Comments

Hide AskUser tool validation errors from UI (agent self-corrects)#18954

Merged
jerop merged 2 commits intomainfrom
fix/hide-ask-user-header-error
Feb 12, 2026
Merged

Hide AskUser tool validation errors from UI (agent self-corrects)#18954
jerop merged 2 commits intomainfrom
fix/hide-ask-user-header-error

Conversation

@jerop
Copy link
Contributor

@jerop jerop commented Feb 12, 2026

Suppresses AskUser tool errors (e.g. invalid params) that have no result display, allowing the agent to recover silently without cluttering the chat.

Fixes #18462
Fixes #18922

image image

Suppresses AskUser tool errors (e.g. invalid params) that have no result display, allowing the agent to recover silently without cluttering the chat.

Fixes #18462

Fixes #18922
@jerop jerop requested a review from a team as a code owner February 12, 2026 21:08
@jerop jerop changed the title fix: Hide AskUser validation errors from UI Hide AskUser validation errors from UI Feb 12, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jerop, 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 addresses an issue where AskUser tool validation errors would clutter the chat UI, even when they didn't provide useful information to the user. By suppressing these specific errors from the display, the agent can now silently recover from invalid tool parameters, leading to a cleaner and less confusing user experience. This change improves the robustness of the agent's interaction flow by preventing unnecessary error messages from being shown.

Highlights

  • Error Suppression: Implemented logic to suppress AskUser tool validation errors from being displayed in the UI when they have no result content, improving user experience by reducing visual clutter.
  • Tool Logic Enhancement: Enhanced the AskUser tool's validateBuildAndExecute method to clear returnDisplay for INVALID_TOOL_PARAMS errors, allowing the agent to recover silently.
  • UI Filtering Update: Updated the UI component filtering logic to hide AskUser error messages that specifically lack a resultDisplay.
  • Testing Improvements: Added comprehensive unit tests to verify the new AskUser filtering behavior across various statuses and error types, ensuring correct display and suppression.
Changelog
  • packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
    • Refactored Ask User Filtering tests to use a data-driven approach, including resultDisplay and shouldHide flags.
    • Modified test assertions to check for empty frames when shouldHide is true.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
    • Updated the toolCalls memoized filter to include a condition that hides AskUser tools with Error status and an empty resultDisplay.
  • packages/cli/src/ui/components/messages/snapshots/ToolGroupMessage.test.tsx.snap
    • Updated snapshot tests to reflect the new Ask User Filtering test cases and their expected output.
  • packages/core/src/tools/ask-user.test.ts
    • Added a new test suite for validateBuildAndExecute within AskUserTool.
    • Included a test case to confirm that validation errors result in an empty returnDisplay.
    • Added a test case to ensure non-validation errors (e.g., execution failures) still display their returnDisplay.
    • Imported ToolErrorType.
  • packages/core/src/tools/ask-user.ts
    • Imported ToolErrorType.
    • Overrode the validateBuildAndExecute method in AskUserTool to check for INVALID_TOOL_PARAMS errors and set returnDisplay to an empty string if such an error occurs.
Activity
  • No human activity (comments, reviews, etc.) has been recorded for this pull request yet.
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 introduces a change to hide validation errors for the AskUser tool from the user interface. This is achieved by overriding validateBuildAndExecute in AskUserTool to clear the returnDisplay for INVALID_TOOL_PARAMS errors. The ToolGroupMessage component is then updated to filter out AskUser tool calls that have an Error status but no returnDisplay. The changes are well-tested, with new unit tests for the tool's behavior and updated tests and snapshots for the UI component. The implementation is clean and effectively addresses the issue of cluttering the chat with recoverable agent errors.

@github-actions
Copy link

github-actions bot commented Feb 12, 2026

Size Change: +813 B (0%)

Total Size: 24.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.4 MB +813 B (0%)
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@jerop jerop enabled auto-merge February 12, 2026 21:14
@gemini-cli gemini-cli bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 12, 2026
@jerop jerop changed the title Hide AskUser validation errors from UI Hide AskUser tool validation errors from UI (agent self-corrects) Feb 12, 2026
Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

@jerop jerop added this pull request to the merge queue Feb 12, 2026
@jerop jerop removed this pull request from the merge queue due to a manual request Feb 12, 2026
@jerop jerop enabled auto-merge February 12, 2026 21:39
@jerop jerop added this pull request to the merge queue Feb 12, 2026
Merged via the queue into main with commit 8275871 Feb 12, 2026
27 checks passed
@jerop jerop deleted the fix/hide-ask-user-header-error branch February 12, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide AskUser tool options limit error from user Hide AskUser tool header error from user

2 participants