-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Cleanup and --list-sessions race each other #27273
Copy link
Copy link
Labels
area/coreIssues related to User Interface, OS Support, Core FunctionalityIssues related to User Interface, OS Support, Core Functionalityeffort/medium2-3 days: UI state, async flow, cross-component refactors2-3 days: UI state, async flow, cross-component refactorskind/bugpriority/p2Important but can be addressed in a future release.Important but can be addressed in a future release.status/bot-triaged
Metadata
Metadata
Assignees
Labels
area/coreIssues related to User Interface, OS Support, Core FunctionalityIssues related to User Interface, OS Support, Core Functionalityeffort/medium2-3 days: UI state, async flow, cross-component refactors2-3 days: UI state, async flow, cross-component refactorskind/bugpriority/p2Important but can be addressed in a future release.Important but can be addressed in a future release.status/bot-triaged
Type
Fields
Give feedbackNo fields configured for Bug.
Projects
StatusShow more project fields
No status
What happened?
Startup launches cleanupExpiredSessions() as a background task. It is not awaited. A few lines later, the CLI handles --list-sessions and starts reading the same session directory. Cleanup can delete files while listing is scanning them. A file can exist during readdir, then disappear before readFile. The list shown to the user can therefore depend on timing rather than a stable snapshot.
packages/cli/src/gemini.tsx:667
packages/cli/src/gemini.tsx:681
What did you expect to happen?
Listing sessions should produce a stable result. If cleanup must run on startup, finish it before listing starts. If startup delay is a concern, skip cleanup for --list-sessions or make listing use a stable snapshot. The user should not see sessions randomly vanish because two internal tasks touched the same files at once.
Client information
Client Information
Run
geminito enter the interactive CLI, then run the/aboutcommand.Login information
Signed in with Google
Anything else we need to know?
No response