Skip to content

deleteSession() does not clean tool output directories (UUID / filename mismatch) #21568

@h30s

Description

@h30s

What happened?

When a session is manually deleted using --delete-session or the interactive session browser, the chat JSON file is removed but the corresponding tool output files remain on disk.

This appears to happen because deleteSession() receives the chat filename while tool output directories are created using the session UUID.
As a result, the cleanup code looks for the wrong directory path and the tool output folder is never removed.

Over time this can cause unused tool output files to accumulate on disk.

What did you expect to happen?

When a session is deleted, all related data should also be removed, including:

  • chat JSON file
  • associated tool-outputs/session-* directory

The cleanup should use the correct session UUID so the tool output directory is properly deleted.

Client information

Client Information

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here

Login information

No response

Anything else we need to know?

While investigating this issue, I noticed that tool output directories are created using the session UUID, but deleteSession() appears to receive the chat filename instead. Because of this mismatch, the cleanup logic constructs an incorrect directory path and fails to remove the associated tool output files.

This results in unused tool output folders remaining on disk after a session is deleted manually.

The cleanup logic used in sessionCleanup.ts seems to correctly reference the session UUID, which might be helpful as a reference when fixing this issue.

Metadata

Metadata

Assignees

Labels

area/coreIssues related to User Interface, OS Support, Core Functionalitypriority/p2Important but can be addressed in a future release.type/bug

Type

No fields configured for Bug.

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions