-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add session sharing and forking in the extension #4145
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
Conversation
🦋 Changeset detectedLatest commit: aa3c6b5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
useful for integration tests
sessions can be forked from a share or from own session id
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 adds session sharing and forking functionality to the KiloCode extension, enabling users to share their coding sessions with others and fork shared sessions to continue work independently.
Key Changes
- Adds UI components for sharing sessions via a new share button in the history panel
- Implements
/session shareand/session fork <id>slash commands in the chat interface - Adds backend handlers for creating shareable session links and forking sessions from shared/session IDs
- Refactors session management to support creating sessions from historical tasks and sharing them
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| webview-ui/src/components/history/ShareSessionButton.tsx | New component providing a button to share task sessions via the history panel |
| webview-ui/src/components/history/TaskItemFooter.tsx | Integrates the new ShareSessionButton into task item footers |
| webview-ui/src/components/chat/ChatTextArea.tsx | Adds slash command handling for /session share and /session fork commands |
| webview-ui/src/utils/slash-commands.ts | Registers the /session command in the slash commands list |
| src/shared/kilocode/cli-sessions/types/ITaskDataProvider.ts | New interface defining methods to retrieve task data for session creation |
| src/shared/kilocode/cli-sessions/types/IExtensionMessenger.ts | Updates comment documentation for the sendWebviewMessage method |
| src/shared/kilocode/cli-sessions/core/SessionManager.ts | Adds getSessionFromTask method to create/retrieve sessions for historical tasks, updates shareSession to accept optional sessionId, adds KILO_DISABLE_SESSIONS environment check |
| src/shared/WebviewMessage.ts | Adds new message types: sessionShare, shareTaskSession, sessionFork, and shareId field |
| src/services/kilo-session/ExtensionPathProvider.ts | Refactors path generation logic, renames parameter from workspaceDir to workspaceName, removes ensureDirectories method |
| src/services/kilo-session/ExtensionMessengerImpl.ts | Changes sendWebviewMessage to call webviewMessageHandler directly instead of postMessageToWebview |
| src/core/webview/webviewMessageHandler.ts | Adds handlers for sessionShare, shareTaskSession, and sessionFork message types |
| src/activate/handleUri.ts | Adds URI handler for /kilo/fork deep links to populate fork command in chat |
| cli/src/index.ts | Updates fork option description from "Fork a shared session by share ID" to "Fork a session by ID" |
| cli/src/commands/session.ts | Renames parameter from shareId to id throughout fork command, updates descriptions and error messages |
| .changeset/twenty-rocks-joke.md | Changelog entry for session sharing and forking feature |
| .changeset/late-paths-kick.md | Changelog entry for shared session URL update |
| <div className="flex flex-row gap-0 -mx-2 items-center text-vscode-descriptionForeground/60 hover:text-vscode-descriptionForeground"> | ||
| <CopyButton itemTask={item.task} /> | ||
| <FavoriteButton isFavorited={item.isFavorited ?? false} id={item.id} /> | ||
| <ShareSessionButton id={item.id} /> |
Copilot
AI
Dec 2, 2025
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.
The new ShareSessionButton component added to the TaskItemFooter lacks test coverage. The existing test file TaskItemFooter.spec.tsx validates other action buttons (copy, export, delete) but doesn't include tests for the share session button. Consider adding test cases to verify:
- The share session button is rendered when not in selection mode
- The share session button is hidden during selection mode
- Clicking the button posts the correct message with the task ID
| } | ||
| } | ||
|
|
||
| if (process.env.KILO_DISABLE_SESSIONS) { |
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.
@RSO @catrielmuller @pandemicsyn I noticed integration tests are creating sessions - once this is merged, they should probably set this env var.
|
This is ready for a look, I'll add the |
|
|
|
|
||
| // kilocode_change start | ||
| function handleSessionCommand(trimmedInput: string, setInputValue: (value: string) => void) { | ||
| if (trimmedInput.startsWith("/session share")) { |
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.
Tbh i don't really like this; it feels a bit fiddly, and I would expect there to be proper parsing somewhere, but then again, I'm afraid my expectation is false :(
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.
There's some parsing in parseKiloSlashCommands, but that's on the extension side and seemed complicated to integrate with. 🤔
Context
This PR is a continuation of #4066, allowing users to:
/session shareor by clicking the share button on the bottom right of the task card/session fork <id>, or by clicking the "Open in VSCode" button, which I'm assuming will be the main way this feature will be usedImplementation
The new commands are intercepted on the webview side - they send special messages to the extension, which then does all the heavy lifting.
Screenshots
How to Test
Use sessions in the extension/cli/cloud agents.