Skip to content

fix - Integrate CLS session persistence and restoration for conversation history#161

Merged
jdneo merged 5 commits into
mainfrom
tori/supportClsPersistence
May 12, 2026
Merged

fix - Integrate CLS session persistence and restoration for conversation history#161
jdneo merged 5 commits into
mainfrom
tori/supportClsPersistence

Conversation

@xinyi-gong
Copy link
Copy Markdown
Member

cls related PR: https://github.com/microsoft/copilot-language-server-internal/pull/893

Summary

Integrate CLS (Copilot Language Server) server-side session persistence so that restored conversations can resume with full context instead of relying solely on IDE-side turn history.

Changes

Session restoration protocol:

  • Add conversationId and restoreToTurnId fields to ConversationCreateParams for CLS server-side restoration
  • Add turnId field to Turn for tracking CLS-assigned turn IDs in the protocol layer
  • Update CopilotLanguageServerConnection.createConversation() to accept and forward restoration parameters

Turn ID management:

  • User turns are now persisted with turnId = null initially (instead of using workDoneToken as a fake turnId)
  • CLS-assigned turnId is set via setUserTurnId() when onChatProgress(begin) arrives
  • findOrCreateUserTurn / findOrCreateCopilotTurn use type-aware findTurn(conversation, turnId, Class) to avoid collisions when user and copilot turns share the same turnId

Turn pairing in convertToTurns():

  • User and copilot turns are now paired into a single Turn object (request + response) instead of being split into separate Turn objects, matching CLS expectations

Transcript directory configuration:

  • Add transcriptDirectory field to CopilotAgentSettings
  • Set ~/.copilot/eclipse as transcript directory on startup (matching IntelliJ's ~/.copilot/jb convention)
  • Add PlatformUtils.getTranscriptDirectory() and Constants.TRANSCRIPT_SUBDIR

@xinyi-gong xinyi-gong marked this pull request as ready for review May 9, 2026 08:42
@xinyi-gong xinyi-gong requested a review from jdneo as a code owner May 9, 2026 08:42
Copilot AI review requested due to automatic review settings May 9, 2026 08:42
Copy link
Copy Markdown
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 integrates Copilot Language Server (CLS) session persistence/restoration into the Eclipse plugin so history-based conversations can be resumed server-side with full context (via conversation/turn restoration parameters), and aligns turn modeling/IDs with CLS expectations.

Changes:

  • Adds protocol support for restoration (conversationId, restoreToTurnId) and turn tracking (turnId on Turn).
  • Updates persistence to manage CLS-assigned turn IDs (persist user turns with turnId=null, later set from CLS progress begin).
  • Configures a consistent transcript directory (~/.copilot/eclipse) for CLS session persistence.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/LanguageServerSettingManager.java Sets agent transcript directory into LSP settings during configuration updates.
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ChatView.java Sets CLS turnId on persisted user turns; passes restoration parameters when creating history-based conversations.
com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/preferences/LanguageServerSettingManagerTests.java Updates expected settings to include transcript directory.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/utils/PlatformUtils.java Adds helper to compute transcript directory path.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/persistence/ConversationPersistenceManager.java Adds type-aware turn lookup and async API to set CLS-assigned user turnId.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/persistence/ConversationDataFactory.java Changes turn conversion to pair user+copilot into a single protocol Turn and propagate turnId.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/Turn.java Adds turnId field, constructor, accessors, and updates equality/hash.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotAgentSettings.java Adds transcriptDirectory setting for agent configuration.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ConversationCreateParams.java Adds restoration fields (conversationId, restoreToTurnId) to the create payload.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageServerConnection.java Adds overload to forward restoration parameters into ConversationCreateParams.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/Constants.java Introduces transcript subdirectory constant.

@jdneo jdneo merged commit 9aeae2b into main May 12, 2026
4 checks passed
@jdneo jdneo deleted the tori/supportClsPersistence branch May 12, 2026 03:59
@jdneo jdneo changed the title feat - Integrate CLS session persistence and restoration for conversation history fix - Integrate CLS session persistence and restoration for conversation history May 15, 2026
@jdneo jdneo mentioned this pull request May 18, 2026
37 tasks
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.

3 participants