Skip to content

Comments

feat(cleanup): enable 30-day session retention by default#18854

Merged
skeshive merged 14 commits intomainfrom
session-cleanup
Feb 13, 2026
Merged

feat(cleanup): enable 30-day session retention by default#18854
skeshive merged 14 commits intomainfrom
session-cleanup

Conversation

@skeshive
Copy link
Contributor

@skeshive skeshive commented Feb 11, 2026

Summary

This PR enables automatic session cleanup by default with a 30-day retention period. It introduces a startup dialog for users to acknowledge this policy change, offering an option to either enable a 30 or 120 day retention period.

Screenshot 2026-02-13 at 4 47 36 PM Screenshot 2026-02-13 at 4 48 46 PM

Dive Deeper

To manage disk usage effectively, the CLI now enforces a default retention policy for chat sessions and tool outputs.

  • Configuration Changes:

    • Added internal settings warningAcknowledged to track user consent and deferral status.
  • UI/UX:

    • Implemented SessionRetentionWarningDialog using Ink.
    • Added useSessionRetentionCheck hook to determine if the warning is necessary (shows if the policy is active but not yet acknowledged or manually customized).
    • The dialog blocks the main application UI until a choice is made.

Linked Issues

https://github.com/google-gemini/maintainers-gemini-cli/issues/1194

Rollout Schedule:
2/17: Preview build
2/24: Stable build (submit PR to default retention to 30 days/remove warning)
3/3: Stable build week 2 (preview build default retention enabled)
3/3: Preview & stable build default retention enabled

@skeshive skeshive requested review from a team as code owners February 11, 2026 23:08
@skeshive skeshive marked this pull request as draft February 11, 2026 23:08
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Feb 11, 2026

Hi @skeshive, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @skeshive, 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 introduces a significant change to the CLI's session management by enabling a default 60-day retention policy for chat sessions and tool outputs. This aims to improve disk usage efficiency. Users will be prompted with a dialog on startup to acknowledge this change and decide on immediate cleanup or a 30-day deferral, ensuring a smooth transition while maintaining user control over their data.

Highlights

  • Default Session Retention Enabled: Automatic session cleanup is now enabled by default with a 60-day retention period to manage disk usage effectively.
  • User Acknowledgment Dialog: A new startup dialog is introduced to inform users about the session retention policy change, allowing them to either initiate cleanup immediately or defer it for 30 days.
  • New Internal Settings: Two new internal settings, warningAcknowledged and retentionEnforcementDate, have been added to track user consent and deferral status for the cleanup policy.
  • Cleanup Logic Update: The session and tool output cleanup logic has been updated to respect the retentionEnforcementDate, skipping cleanup if the current date is before the enforcement date.
  • UI/UX Integration: A new useSessionRetentionCheck hook and SessionRetentionWarningDialog component were implemented to manage the display and interaction of the retention policy warning.
Changelog
  • docs/cli/settings.md
    • Updated the default value for general.sessionRetention.enabled to true in the settings documentation.
  • docs/get-started/configuration.md
    • Updated the default value for general.sessionRetention.enabled to true.
    • Set the default value for general.sessionRetention.maxAge to "60d".
    • Added documentation for new internal settings general.sessionRetention.warningAcknowledged and general.sessionRetention.retentionEnforcementDate.
  • packages/cli/src/config/settings.ts
    • Added warningAcknowledged and retentionEnforcementDate properties to the SessionRetentionSettings interface.
  • packages/cli/src/config/settingsSchema.ts
    • Changed the default value for general.sessionRetention.enabled to true.
    • Set the default value for general.sessionRetention.maxAge to "60d".
    • Added schema definitions for new internal settings warningAcknowledged and retentionEnforcementDate.
  • packages/cli/src/ui/AppContainer.tsx
    • Imported the useSessionRetentionCheck hook.
    • Integrated the shouldShowRetentionWarning and retentionCheckComplete states from the new hook.
    • Updated the dialogsVisible condition to include the session retention warning.
    • Passed shouldShowRetentionWarning to the UI state context.
  • packages/cli/src/ui/components/DialogManager.tsx
    • Imported SessionRetentionWarningDialog, useCallback, and SettingScope.
    • Implemented handlers for onCleanUpNow and onCleanUpIn30Days to update settings.
    • Added conditional rendering for SessionRetentionWarningDialog based on shouldShowRetentionWarning.
  • packages/cli/src/ui/components/SessionRetentionWarningDialog.test.tsx
    • Added a new test file for the SessionRetentionWarningDialog component, including rendering tests and interaction tests for selecting cleanup options.
  • packages/cli/src/ui/components/SessionRetentionWarningDialog.tsx
    • Added a new React component SessionRetentionWarningDialog to display the session retention policy update message and options.
  • packages/cli/src/ui/contexts/UIStateContext.tsx
    • Added shouldShowRetentionWarning to the UIState interface.
  • packages/cli/src/ui/hooks/useSessionRetentionCheck.test.ts
    • Added a new test file for the useSessionRetentionCheck hook, covering various scenarios for showing or hiding the warning.
  • packages/cli/src/ui/hooks/useSessionRetentionCheck.ts
    • Added a new React hook useSessionRetentionCheck to determine if the session retention warning dialog should be displayed based on user settings.
  • packages/cli/src/utils/sessionCleanup.ts
    • Modified cleanupExpiredSessions to honor the retentionEnforcementDate, deferring cleanup if the current date is before it.
    • Modified cleanupToolOutputFiles to honor the retentionEnforcementDate, deferring cleanup if the current date is before it.
  • schemas/settings.schema.json
    • Updated the default value for enabled to true and maxAge to "60d".
    • Added JSON schema definitions for warningAcknowledged and retentionEnforcementDate.
Activity
  • No human activity has been recorded on 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 enables session retention by default and introduces a warning dialog for users. The implementation has a logic flaw in determining when to show this warning, which could lead to a poor user experience for those who have already configured session retention. I've suggested a fix to the useSessionRetentionCheck hook and its usage in AppContainer to correctly identify manually configured settings. Additionally, the tests for this new hook are outdated and need to be updated to match the implementation.

@github-actions
Copy link

github-actions bot commented Feb 11, 2026

Size Change: +6.82 kB (+0.03%)

Total Size: 24.4 MB

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

compressed-size-action

@skeshive skeshive changed the title feat(cleanup): enable 60-day session retention by default feat(cleanup): enable 30-day session retention by default Feb 13, 2026
@skeshive
Copy link
Contributor Author

/gemini review

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 default 30-day session retention policy, along with a startup dialog for user acknowledgment. The changes are well-structured, touching upon configuration, UI components, hooks, and documentation, and include good test coverage for the new logic. My review includes one high-severity suggestion to improve the efficiency and atomicity of settings updates in DialogManager.tsx by consolidating multiple state updates into a single operation.

@skeshive skeshive marked this pull request as ready for review February 13, 2026 21:56
@skeshive skeshive enabled auto-merge February 13, 2026 22:03
@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 13, 2026
@skeshive skeshive added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit 4e1b3b5 Feb 13, 2026
45 of 48 checks passed
@skeshive skeshive deleted the session-cleanup branch February 13, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants