feat(copilotcli): add WorktreeSessionIndex for managing chat session entries with JSONL persistence#311609
Merged
DonJayamanne merged 5 commits intomainfrom Apr 21, 2026
Merged
feat(copilotcli): add WorktreeSessionIndex for managing chat session entries with JSONL persistence#311609DonJayamanne merged 5 commits intomainfrom
DonJayamanne merged 5 commits intomainfrom
Conversation
…entries with JSONL persistence
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new persistence and indexing layer for Copilot CLI chat session metadata to better support cross-process visibility and scalable storage (shared bulk cache + JSONL worktree index), including migrations from legacy storage locations.
Changes:
- Add
WorktreeSessionIndexwith JSONL persistence for worktree-folder → session-id lookups. - Update
ChatSessionMetadataStoreto use a shared bulk cache file in~/.copilot/, addrefresh(), and implement last-modified-wins merging + top-N trimming. - Extend/adjust tests and integrations to exercise refresh, migration, JSONL behavior, and stale-cache safety.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/chatSessions/vscode-node/worktreeSessionIndex.ts | New in-memory + JSONL-persisted index for worktree session lookups. |
| extensions/copilot/src/extension/chatSessions/vscode-node/test/worktreeSessionIndex.spec.ts | Unit tests for WorktreeSessionIndex in-memory ops and JSONL persistence. |
| extensions/copilot/src/extension/chatSessions/vscode-node/test/chatSessionMetadataStoreImpl.spec.ts | Major test updates/additions for shared bulk cache, refresh, migration, JSONL index, trim, and merge behavior. |
| extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts | Calls metadata refresh() on session list changes/refresh actions. |
| extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts | Triggers metadata refresh() during session list refresh. |
| extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts | Stops using legacy globalState storage for worktrees (clears key) and routes persistence through metadata store. |
| extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionMetadataStoreImpl.ts | Implements shared bulk cache, refresh, migration, JSONL top-up + session-state scan, and timestamping/merge semantics. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/cliHelpers.ts | Adds helpers for shared bulk cache + worktree JSONL paths under ~/.copilot/. |
| extensions/copilot/src/extension/chatSessions/common/test/mockChatSessionMetadataStore.ts | Adds refresh() no-op to mock store interface. |
| extensions/copilot/src/extension/chatSessions/common/chatSessionMetadataStore.ts | Adds created/modified, defines WorktreeSessionEntry, and adds refresh() to the store interface. |
Copilot's findings
- Files reviewed: 10/10 changed files
- Comments generated: 8
…SessionMetadataStoreImpl.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
bpasero
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.