Skip to content

Conversation

@iscekic
Copy link
Collaborator

@iscekic iscekic commented Dec 2, 2025

Context

This PR is a continuation of #4066, allowing users to:

  • share sessions from the extension using /session share or by clicking the share button on the bottom right of the task card
  • fork sessions by using /session fork <id>, or by clicking the "Open in VSCode" button, which I'm assuming will be the main way this feature will be used

Implementation

The new commands are intercepted on the webview side - they send special messages to the extension, which then does all the heavy lifting.

Screenshots

image image image image

How to Test

Use sessions in the extension/cli/cloud agents.

@iscekic iscekic self-assigned this Dec 2, 2025
@changeset-bot
Copy link

changeset-bot bot commented Dec 2, 2025

🦋 Changeset detected

Latest commit: aa3c6b5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Minor

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

Copilot finished reviewing on behalf of iscekic December 2, 2025 19:18
Copy link
Contributor

Copilot AI left a 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 share and /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} />
Copy link

Copilot AI Dec 2, 2025

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:

  1. The share session button is rendered when not in selection mode
  2. The share session button is hidden during selection mode
  3. Clicking the button posts the correct message with the task ID

Copilot uses AI. Check for mistakes.
}
}

if (process.env.KILO_DISABLE_SESSIONS) {
Copy link
Collaborator Author

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.

@iscekic
Copy link
Collaborator Author

iscekic commented Dec 2, 2025

This is ready for a look, I'll add the // kilocode_change markers tomorrow.

@iscekic iscekic marked this pull request as ready for review December 2, 2025 19:35
@iscekic
Copy link
Collaborator Author

iscekic commented Dec 3, 2025

030e81a (#4145) closes #4161 (I hope)


// kilocode_change start
function handleSessionCommand(trimmedInput: string, setInputValue: (value: string) => void) {
if (trimmedInput.startsWith("/session share")) {
Copy link
Contributor

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 :(

Copy link
Collaborator Author

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. 🤔

@iscekic iscekic merged commit 6852e80 into main Dec 3, 2025
12 checks passed
@iscekic iscekic deleted the add-session-commands branch December 3, 2025 17:51
@github-actions github-actions bot mentioned this pull request Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants