Skip to content

fix(ui): prevent empty tool-group border stubs after filtering#21852

Merged
jacob314 merged 1 commit intogoogle-gemini:mainfrom
Aaxhirrr:fix/ui-block-collapse-21685
Mar 10, 2026
Merged

fix(ui): prevent empty tool-group border stubs after filtering#21852
jacob314 merged 1 commit intogoogle-gemini:mainfrom
Aaxhirrr:fix/ui-block-collapse-21685

Conversation

@Aaxhirrr
Copy link
Contributor

@Aaxhirrr Aaxhirrr commented Mar 10, 2026

Summary

Fixes a UI rendering bug where tool-related blocks could collapse into an orphan bottom border line after state transitions (notably plan approval and hidden tool-error flows).

The change ensures ToolGroupMessage only renders a standalone closing border when the item is an explicit empty closing slice (tools: []) used for static/pending border continuity.

Details

Root cause:

  • ToolGroupMessage could end up with visibleToolCalls.length === 0 after filtering (low error verbosity, plan-mode filtering, confirming/in-progress hidden paths).
  • Previous logic could still render a closing border when borderBottom=true, producing the “empty border stub”.

Fix:

  • Updated the empty-render guard in ToolGroupMessage:
    • If all visible tools are filtered out, return null.
    • Exception: allow rendering only for explicit closing slices (allToolCalls.length === 0) with borderBottom=true.

Validation hardening (new tests):

  • Hidden low-verbosity internal error with borderBottom=true renders no fragment.
  • Plan-mode filtered write tool with borderBottom=true renders no fragment.
  • Confirming-only group with borderBottom=true renders no fragment.
  • Transition case (visible -> fully filtered) leaves no stub.
  • Stress case (50 filtered hidden errors + 1 visible tool) keeps visible output and hides filtered tools.
  • Explicit closing slice still renders (normal and very narrow width) to preserve split static/pending continuity.

Related Issues

Fixes #21685

How to Validate

  1. Run targeted tests:

    • npm run test --workspace @google/gemini-cli -- src/ui/components/messages/ToolGroupMessage.test.tsx
    • Expected: all tests pass (including new edge/extreme cases).
  2. Run nearby integration surface:

    • npm run test --workspace @google/gemini-cli -- src/ui/components/MainContent.test.tsx
    • Expected: pass; split static/pending tool-group behavior remains intact.
  3. Run typecheck:

    • npm run typecheck --workspace @google/gemini-cli
    • Expected: no type errors.
  4. Manual interactive verification:

    • Set ui.errorVerbosity to low.
    • Reproduce tool failure flow and plan approval transition (Ask User / Exit Plan Mode path).
    • Expected: no orphan bottom-border fragments; either full content appears or block cleanly disappears.
    • Switch ui.errorVerbosity to full.
    • Expected: tool error content remains visible; no border stubs.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@Aaxhirrr Aaxhirrr requested a review from a team as a code owner March 10, 2026 09:52
@Aaxhirrr
Copy link
Contributor Author

Aaxhirrr commented Mar 10, 2026

/gemini review

Edit: Was expecting Gemini bot feedback, but it looks like the bot isn’t attached on this PR from my side.

@gemini-cli gemini-cli bot added priority/p1 Important and should be addressed in the near term. area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Mar 10, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 a visual glitch in the UI where tool-related blocks would sometimes display an unwanted bottom border after their content was filtered or hidden. The changes ensure that these empty border fragments are correctly suppressed, improving the cleanliness and consistency of the user interface during dynamic state changes, while preserving necessary visual cues for specific tool group transitions.

Highlights

  • UI Rendering Fix: Resolved a UI bug where ToolGroupMessage could render orphan bottom border lines after tool filtering or state transitions (e.g., plan approval, hidden tool errors).
  • Rendering Logic Update: Modified ToolGroupMessage to only render a closing border when it's an explicit empty closing slice (tools: []) for static/pending border continuity, preventing rendering when all tools are filtered out.
  • Test Coverage Enhancement: Added comprehensive new test cases to validate the fix across various scenarios, including low verbosity errors, plan-mode filtering, confirming-only groups, transition cases, and stress tests.
Changelog
  • packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
    • Added lowVerbositySettings mock for testing.
    • Introduced new test cases to verify that bottom-border fragments are not rendered when all tools are filtered out due to low verbosity settings.
    • Added a test to ensure explicit closing slices for split static/pending groups still render.
    • Included tests to confirm no border fragments are rendered when plan-mode tools or confirming-only tools are filtered out.
    • Added a test for the transition case from visible to fully filtered tools, ensuring no border stub remains.
    • Implemented a stress test to verify visible tools render correctly even with many filtered tools.
    • Added a test to confirm explicit closing slices render correctly even at very narrow terminal widths.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
    • Modified the conditional rendering logic to prevent ToolGroupMessage from emitting standalone border fragments when all tools are filtered out.
    • Introduced isExplicitClosingSlice to specifically allow rendering for empty tool groups (allToolCalls.length === 0) that are intended as closing slices for border continuity.
Activity
  • No specific activity (comments, reviews, progress updates) 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 effectively addresses the UI rendering bug where empty tool-group border stubs could appear after filtering. The updated logic in ToolGroupMessage.tsx correctly distinguishes between genuinely empty tool groups and explicit closing slices, ensuring that standalone bottom borders are only rendered when intended for static/pending continuity. The addition of comprehensive test cases in ToolGroupMessage.test.tsx provides excellent coverage for various filtering scenarios, including low verbosity errors, plan-mode tools, confirming tools, and transition states, which significantly hardens the validation of this fix. The changes are well-implemented and directly resolve the reported issue.

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 effectively resolves a UI rendering bug that caused orphan borders to appear when tool groups became empty after filtering. The proposed change correctly adjusts the rendering logic to prevent this, while carefully preserving the intended behavior for explicit closing borders. The fix is well-supported by a comprehensive suite of new unit tests that cover various edge cases and state transitions, confirming the robustness of the solution. The changes are well-contained and I have not identified any issues.

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

@jacob314 jacob314 force-pushed the fix/ui-block-collapse-21685 branch from 18f596c to a6277ab Compare March 10, 2026 18:55
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

@jacob314 jacob314 enabled auto-merge March 10, 2026 18:56
@jacob314 jacob314 added this pull request to the merge queue Mar 10, 2026
Merged via the queue into google-gemini:main with commit b00d7c8 Mar 10, 2026
27 checks passed
@jacob314
Copy link
Contributor

/patch preview

@jacob314
Copy link
Contributor

/patch stable

@github-actions
Copy link

🚀 [Step 1/4] Patch workflow(s) waiting for approval!

📋 Details:

  • Channels: preview
  • Commit: b00d7c88ad8d7c9f14eba4a66f04c91c85bf5ffd
  • Workflows Created: 1

⏳ Status: The patch creation workflow has been triggered and is waiting for deployment approval. Please visit the specific workflow links below and approve the runs.

🔗 Track Progress:

@github-actions
Copy link

🚀 [Step 1/4] Patch workflow(s) waiting for approval!

📋 Details:

  • Channels: stable
  • Commit: b00d7c88ad8d7c9f14eba4a66f04c91c85bf5ffd
  • Workflows Created: 1

⏳ Status: The patch creation workflow has been triggered and is waiting for deployment approval. Please visit the specific workflow links below and approve the runs.

🔗 Track Progress:

JaisalJain pushed a commit to JaisalJain/gemini-cli that referenced this pull request Mar 11, 2026
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 12, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
yashodipmore pushed a commit to yashodipmore/geemi-cli that referenced this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] UI blocks (plans and tool errors) collapse into empty border fragments after completion

2 participants