-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix session cleanup #4204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix session cleanup #4204
Conversation
🦋 Changeset detectedLatest commit: 92563eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes critical race conditions in session management that could lead to incorrect session operations and data corruption.
Key Changes:
- Modified
renameSessionto accept an explicitsessionIdparameter to prevent renaming the wrong session whenthis.sessionIdchanges during async operations - Enhanced
destroy()method to clearcurrentTaskIdandsessionGitUrlto prevent session data clobbering across tasks - Updated
syncSession()to capture and use a stablesessionIdvalue throughout its execution
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/shared/kilocode/cli-sessions/core/SessionManager.ts |
Added explicit sessionId parameter to renameSession, captured local sessionId in syncSession for race-free operations, and cleared currentTaskId/sessionGitUrl in destroy |
src/shared/kilocode/cli-sessions/core/__tests__/SessionManager.test.ts |
Updated test expectations for new renameSession signature and added comprehensive test case validating currentTaskId clearing prevents session clobbering |
cli/src/commands/session.ts |
Updated renameSession call to pass explicit sessionId parameter and added early validation for active session |
Fixes a couple race conditions:
this.sessionIdchangingtaskIdnot being reset