Skip to content

feat(ui): build interactive session browser component#13351

Merged
mrcabbage972 merged 2 commits intogoogle-gemini:mainfrom
Piebald-AI:build-interactive-session-browser-component
Nov 21, 2025
Merged

feat(ui): build interactive session browser component#13351
mrcabbage972 merged 2 commits intogoogle-gemini:mainfrom
Piebald-AI:build-interactive-session-browser-component

Conversation

@bl-ue
Copy link
Copy Markdown
Contributor

@bl-ue bl-ue commented Nov 19, 2025

This PR introduces the <SessionBrowser /> component and its supporting hooks.


Note: This PR is the 6th in a series of PRs that implement automatic chat recording and resuming in both interactive and non-interactive modes, with command line flags for non-interactive resuming and session management, and an interactive session browser.

PR #4401 was the original monolithic PR, which implemented this feature from the ground up. It's too large to merge as-is, however, and so it was broken up into several smaller PRs, of which this PR is the 6th.

Please see #4401's description for the full context of this PR. The original monolithic PR's description contains a detailed analysis of the entire system, with an example of the recording JSON and a demo video.

@bl-ue bl-ue requested a review from a team as a code owner November 19, 2025 01:29
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @bl-ue, 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 delivers a significant enhancement to the CLI's user interface by integrating an interactive session browser. This new component empowers users with a robust way to navigate and manage their past conversations, offering functionalities like searching, sorting, and resuming sessions directly from the terminal. It aims to streamline the workflow for users who frequently engage with the chat feature and need to revisit or continue previous interactions.

Highlights

  • New Interactive Session Browser Component: Introduces the <SessionBrowser /> component, providing an interactive terminal UI for managing saved chat sessions.
  • Session Management Features: The browser allows users to view, filter, sort, search, resume, and delete recorded chat sessions.
  • Supporting Hooks: Includes new and modified React hooks (useSessionBrowserState, useLoadSessions, useMoveSelection, useCycleSortOrder, useSessionBrowserInput, useSessionBrowser) to manage the component's state, data loading, and user interactions.
  • Part of a Larger Feature: This PR is the sixth in a series aimed at implementing comprehensive automatic chat recording and resuming capabilities within the CLI.
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
Copy Markdown
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 new <SessionBrowser /> component for interactively browsing, searching, and managing chat sessions. The implementation is comprehensive, with a well-structured set of components and hooks. However, there are several critical and high-severity issues related to React hook dependencies that need to be addressed. Specifically, several hooks depend on the entire state object, which will cause significant performance problems and potential bugs due to unnecessary re-renders and data fetching. I've also pointed out a magic number that harms maintainability. Addressing these issues will greatly improve the stability and performance of the new component.

Comment thread packages/cli/src/ui/components/SessionBrowser.tsx Outdated
Comment thread packages/cli/src/ui/components/SessionBrowser.tsx Outdated
Comment thread packages/cli/src/ui/components/SessionBrowser.tsx Outdated
Comment thread packages/cli/src/ui/components/SessionBrowser.tsx Outdated
Comment thread packages/cli/src/ui/components/SessionBrowser.tsx Outdated
bl-ue added a commit to Piebald-AI/gemini-cli that referenced this pull request Nov 20, 2025
…onBrowser` component, and de-duplicate session handling
@bl-ue bl-ue force-pushed the build-interactive-session-browser-component branch from 6ebcd7b to 6d7e8ea Compare November 20, 2025 02:04
@bl-ue
Copy link
Copy Markdown
Contributor Author

bl-ue commented Nov 20, 2025

/gemini review

Copy link
Copy Markdown
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 new interactive session browser component, which is a great feature. The implementation is well-structured, using custom hooks to separate concerns effectively. However, I've identified a few high-severity issues related to performance, correctness, and test coverage. My review includes specific suggestions to address inefficient data loading, fix a bug that impacts search functionality, and restore important test cases to ensure the feature's robustness.

Comment thread packages/cli/src/ui/components/SessionBrowser.tsx
Comment thread packages/cli/src/ui/hooks/useSessionBrowser.test.ts
Comment thread packages/cli/src/ui/hooks/useSessionBrowser.ts Outdated
Comment thread packages/cli/src/utils/sessionUtils.ts Outdated
bl-ue added a commit to Piebald-AI/gemini-cli that referenced this pull request Nov 21, 2025
@bl-ue
Copy link
Copy Markdown
Contributor Author

bl-ue commented Nov 21, 2025

/gemini review

Copy link
Copy Markdown
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 new interactive session browser component, which is a significant and well-implemented UI feature. The code is well-structured, using custom React hooks to effectively separate concerns like state management, data loading, and input handling. The overall code quality is high. I've identified two high-severity issues: one is a usability bug related to inverted keyboard navigation controls, and the other concerns a significant reduction in test coverage for a critical utility function, which could lead to future regressions. The other changes, including enhancements to session utilities and test updates, are solid improvements that enhance the robustness of the session management system.

Comment on lines +849 to +854
else if (key.sequence === 'd') {
moveSelection(-Math.round(SESSIONS_PER_PAGE / 2));
} else if (key.sequence === 'u') {
moveSelection(Math.round(SESSIONS_PER_PAGE / 2));
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The keyboard controls for half-page scrolling are inverted. In less and vim, d scrolls down and u scrolls up. The current implementation has d scrolling up (moveSelection with a negative delta) and u scrolling down (positive delta). This is counter-intuitive for users familiar with standard terminal pager controls.

To fix this, the deltas for the d and u keys should be swapped.

        // less-like u/d controls.
        else if (key.sequence === 'd') {
          moveSelection(Math.round(SESSIONS_PER_PAGE / 2));
        } else if (key.sequence === 'u') {
          moveSelection(-Math.round(SESSIONS_PER_PAGE / 2));
        }

});

// The convertSessionToHistoryFormats tests are self-contained and do not need changes.
describe('convertSessionToHistoryFormats', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The tests for convertSessionToHistoryFormats have been significantly simplified, and several granular test cases that covered important edge cases have been removed. This function has complex logic for converting different message types and tool calls, and the removal of these tests introduces a risk of regressions and makes the function harder to maintain.

The removed tests covered cases like:

  • Handling of info, warning, and error message types.
  • Skipping empty tool call arrays.
  • Graceful handling of missing tool call fields.
  • Behavior for tool calls in user messages.
  • Multiple tool calls in one message.

While the new tests cover the main paths, please consider reintroducing these or similar specific test cases to ensure the function's robustness.

@mrcabbage972 mrcabbage972 added this pull request to the merge queue Nov 21, 2025
Merged via the queue into google-gemini:main with commit b976615 Nov 21, 2025
21 checks passed
@bl-ue bl-ue deleted the build-interactive-session-browser-component branch November 22, 2025 18:57
thacio added a commit to thacio/auditaria that referenced this pull request Nov 23, 2025
werdnum pushed a commit to werdnum/gemini-cli that referenced this pull request Nov 24, 2025
danpalmer pushed a commit to danpalmer/gemini-cli that referenced this pull request Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants