Make chat sessions available across workspaces (global chat history)
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
# Make chat sessions available across workspaces (global chat history)
## Problem
Copilot chat sessions are strictly workspace-scoped. Each workspace storage folder
(`workspaceStorage/`) holds its own `chatSessions/*.jsonl` files plus a
`chat.ChatSessionStore.index` entry in `state.vscdb`, and the Chat view / "Show Chats…"
picker only ever lists that one workspace's sessions.
As a developer working across many repos daily, this means:
- I can never pull up a chat from another workspace without closing my window and
reopening the other folder — losing my current context.
- Chats "disappear" when the workspace identity changes: opening the same folders as a
different multi-root combination, saving an untitled workspace as a `.code-workspace`
file, or renaming/moving a folder all create a new storage hash with an empty history.
- **Silent data loss:** chats created in an untitled multi-root workspace are purged.
When the auto-saved workspace file goes away, the storage folder is marked `obsolete`
and deleted — months of chat history gone, including pinned chats. Pinning a chat gives
no protection against this.
## Proposal
Store chat sessions globally (per profile), with workspace association as metadata rather
than as a storage boundary — similar to how the Timeline/local history and settings
profiles work. Concretely:
- The Chat history picker and Sessions view offer a filter: current workspace (default)
/ all workspaces, with the workspace/repo shown per session.
- A session opened from another workspace is read-only or fully usable, whichever is
feasible — even read-only access would already be a huge win.
- Pinned chats are never purged, regardless of workspace lifecycle.
## Why this fits the current direction
1.136's agent host explicitly enables "connecting to the same agent session from multiple
VS Code windows", and the Agents window already lists agent-host sessions across
workspaces. Classic Chat-view sessions are the missing piece: they remain bound to one
workspace storage hash, with no UI to reach them from anywhere else.
## Workarounds tried
- Manually copying `chatSessions/*.jsonl` between storage folders — insufficient, sessions
stay invisible until `chat.ChatSessionStore.index` in `state.vscdb` is also merged,
which can only be done while the window is closed (the DB is rewritten on shutdown).
- A custom sync script that does both steps across all workspace storages — works, but is
fragile by nature (internal storage format, no API) and needs VS Code to be closed for
a reliable run.
Neither should be necessary; this belongs in the product.
Contributor guide
Research direction
Start by tracing the Chat view and “Show Chats…” picker, then inspect workspaceStorage//chatSessions/*.jsonl and the chat.ChatSessionStore.index entry in state.vscdb. Compare how the Agents window lists sessions across workspaces. Done means history can be filtered by current or all workspaces, sessions show workspace context, and pinned chats survive workspace cleanup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100