feat(core,cli): implement session-linked tool output storage and cleanup#18416
feat(core,cli): implement session-linked tool output storage and cleanup#18416abhipatel12 merged 3 commits intomainfrom
Conversation
Summary of ChangesHello @abhipatel12, 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 improvement in how temporary tool output files are managed within the system. By linking these outputs directly to specific sessions and implementing automated cleanup mechanisms, it resolves issues related to file persistence and disk space management. The changes ensure that temporary files are properly isolated and removed, contributing to a more stable and efficient application lifecycle. Highlights
Changelog
Activity
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 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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces session-linked storage for tool outputs, improving temporary file organization and cleanup. However, it contains path traversal vulnerabilities where the sessionId is used unsanitized in file system paths, potentially allowing arbitrary file deletion. It's crucial to sanitize sessionId using sanitizeFilenamePart before path operations. Additionally, while the PR includes consistent renaming of tool_output to tool-outputs and improved testing, a high-severity suggestion exists to enhance the robustness of the deleteSession method for more resilient cleanup operations.
|
Size Change: +2.43 kB (+0.01%) Total Size: 23.8 MB
ℹ️ View Unchanged
|
…traversal vulnerabilities
Summary
This PR implements Session-Linked Tool Output Storage and Cleanup (Phase 1). It ensures that tool output files (from masking and truncation) are organized into session-specific subdirectories and are automatically purged when a session is deleted or expires. This fixes the issue of tool output files leaking across sessions and failing to be cleaned up reliably.
Details
tool-outputs/session-<sessionId>/instead of a flat root directory.tool_outputdirectory totool-outputsfor consistent naming across the codebase.ChatRecordingService.deleteSession: Now automatically deletes the associated session tool output folder.sessionCleanup.ts: UpdatedcleanupExpiredSessionsandcleanupToolOutputFilesto scan for and purge expired session-linked directories.toolOutputCleanup.test.tsand updated existing tests to reflect the new directory structure.Related Issues
Related to #session-cleanup-refinement
How to Validate
git log) to trigger truncation/masking.~/.gemini/tmp/<hash>/tool-outputs/session-<id>/contains the output file.gemini session delete <id>orgemini session clearand verify thesession-<id>folder is removed.gemini session cleanupto verify folder removal.Pre-Merge Checklist