By Kim · Facts checked 30 Oct 2026 · Session controls from official VS Code documentation
You can control VS Code agent session history sync with settings, but turning uploads off doesn’t remove history already on GitHub.com. We compared the official documentation for configuration, synced-history cleanup and session resource handling. The consequential finding: Delete Session Sync Data requires sync to be enabled; when it’s off or disabled by policy, use GitHub.com’s Agents tab for previously synced sessions.
We separate that cleanup choice from stopping model requests. In the VS Code command, you can retain local history or remove both copies. GitHub separately supports hiding or deleting individual synced sessions.
| Enable experimental sync | Set chat.sessionSync.enabled to true; github.copilot.chat.localIndex.enabled must also be enabled |
|---|---|
| Disable sync | Set chat.sessionSync.enabled to false; existing GitHub.com data remains |
| Exclude repositories | Use chat.sessionSync.excludeRepositories with exact owner/repo names or glob patterns |
| Check status | Copilot status bar in the Chat view |
| Cleanup access | Enabled: Delete Session Sync Data. Off or policy-disabled: GitHub.com’s Agents tab |
| VS Code command scope | Cloud only retains local data; local and cloud is irreversible |
Check sync status before choosing a cleanup control
Check the Copilot status bar in the Chat view before choosing your cleanup control. Based on official documentation (checked 30 October 2026), the VS Code deletion command requires sync to be enabled.
- Read session sync status in the Chat view’s Copilot status bar.
- If enabled, run Delete Session Sync Data from the Command Palette and select sessions in its picker. If off or Disabled by policy, use GitHub.com’s Agents tab for previously synced sessions.
- In the VS Code command, choose Delete from cloud only to retain local data or Delete from local and cloud for irreversible removal. On GitHub.com, instead hide or delete an individual synced session; hiding removes it from the index and query results.

Set upload preferences separately from cloud cleanup
Use chat.sessionSync.enabled to enable or disable experimental session sync, and chat.sessionSync.excludeRepositories to exclude repositories. Turning sync off leaves previously synced GitHub.com data intact.
Control:chat.sessionSync.enabled = true |
Documented scope: Enables experimental session sync |
Requirement or limit:github.copilot.chat.localIndex.enabled must also be enabled |
Control:chat.sessionSync.enabled = false |
Documented scope: Disables session-history sync |
Requirement or limit: Local tracking can remain enabled; existing cloud data remains |
Control:chat.sessionSync.excludeRepositories |
Documented scope: Prevents matching repositories’ sessions from uploading |
Requirement or limit: Accepts exact owner/repo names or glob patterns |
For Copilot Business and Copilot Enterprise, enterprise and organization owners control the GitHub.com policy Store local sessions in the Cloud. If status shows Disabled by policy, you can’t override it.
Choose cloud-only removal to keep local history
Choose Delete from cloud only in the VS Code command when you want to remove GitHub.com session data while keeping local data intact. The command identifier is github.copilot.sessionSync.deleteSessions.
| Choice: Delete from cloud only |
Interface: VS Code command |
Documented effect: Removes GitHub.com data; keeps local data |
Decision condition: You want to retain local history |
| Choice: Delete from local and cloud |
Interface: VS Code command |
Documented effect: Removes machine and GitHub.com data irreversibly |
Decision condition: You intend to remove both copies |
| Choice: Hide |
Interface: GitHub.com Agents tab |
Documented effect: Removes the session from its index and query results |
Decision condition: You want it excluded from query results |
Preserve worktree changes before session deletion
Integrate or commit worktree changes before ordinary session deletion: uncommitted files that exist only in a removed worktree can be lost. To delete a session, right-click it and select Delete.
For Copilot harness sessions, deletion also removes associated worktrees created for the session. A shared worktree remains while another session uses it and is removed only after the last linked session is deleted or archived.
For Dev Container sessions, deletion removes the container only when no other session or unsent draft uses it, even if automatic idle shutdown is off.
Archive worktree sessions with resource removal in mind
Archiving a worktree session preserves changes on its branch before removing the worktree folder. If preservation or removal fails, the worktree remains; the retained branch and commits let restoration re-create it.
For a Dev Container session, marking done removes its container without waiting for idle shutdown only when no other session or unsent draft uses it. Restoring starts a replacement container and retains the conversation.
Closing a chat tab instead hides it without deleting its conversation, and you can reopen it later. Marking a chat done removes it from the active sessions list while retaining its title and history.
Note: In the Agents window, main chats, side chats and subagent chats can’t be marked done independently.
Keep history cleanup separate from model requests
Turning off session-history sync doesn’t stop prompts and context from being sent to a model during an agent session.
The local session store records session metadata, conversation turns, file paths from tool calls and external references. Synced sessions are tied to your personal GitHub account and accessible only to you unless you explicitly share them.
Note: VS Code filters detected secrets before syncing using known patterns and secret values, but it might not detect every secret.
VS Code cleanup leaves model requests separate
- Turning sync off doesn’t delete previously synced GitHub.com data.
- Delete from local and cloud in the VS Code command cannot be undone.
- Policy-disabled sync cannot be overridden by the user.
- Secret filtering might not detect every secret.
It depends: Choose upload settings separately from the cleanup action for existing history.
Good fit: For controlling session sync, excluding repositories and removing previously synced sessions.
Not a fit: Turning off history sync doesn’t stop prompts and context being sent to a model during an agent session.
Before you begin, set scope and preserve work
- Set your upload preference with
chat.sessionSync.enabled; enabling also requiresgithub.copilot.chat.localIndex.enabled. - Use
chat.sessionSync.excludeRepositoriesfor exact owner/repo names or glob patterns you want excluded. - Check sync status before selecting the cleanup control.
- In the VS Code command, choose whether to retain local data or remove local and cloud data irreversibly; on GitHub.com, choose individual hiding or deletion.
- Integrate or commit worktree changes before ordinary session deletion.
- Account for worktree or container removal before archiving or marking a session done.
Retain VS Code conversations with resource limits in mind
- Close the chat tab: Choose this to hide the chat from the chat area while keeping its conversation available to reopen.
- Archive a worktree session: Choose this when retaining the conversation and branch history suits your goal and worktree removal is acceptable. Changes are committed before folder removal; failed preservation or removal leaves the worktree in place, and restoration re-creates it from retained commits.
- Mark a Dev Container session done: Choose this when retaining the conversation while releasing an unused container suits your goal. Removal requires no other session or unsent draft to use it; restoration starts a replacement container.
- Export or copy the conversation: Choose this to retain content separately as JSON or Markdown. Review its contents before sharing.
- Initial selection of individual sessions for synchronization, minimum supported versions and broader account eligibility aren’t established.
- Whether repository exclusions remove existing cloud history, or retained local history can upload again after cloud-only deletion, isn’t established.
- Whether ordinary session deletion also removes its synced cloud copy, or GitHub-side deletion affects local data, isn’t established.
- Preservation, deletion and restoration behavior in an installed VS Code environment wasn’t tested.
Quick questions
Does enabling enterprise sync policy give administrators access to my sessions?
No. Enabling the policy doesn’t give administrators access to session data; synced sessions are tied to your personal account and accessible only to you by default.
Does synced history provide access to a running agent?
Synced history doesn’t by itself provide access to a running agent.
Is session-history sync the same as Settings Sync?
They have different documented scopes: synced sessions back up history to your GitHub account for cross-device access, while Settings Sync carries approved settings, keybindings, extensions and snippets between machines.

Choose upload settings and existing-history cleanup separately. – Turning sync off leaves existing cloud history intact. – In the VS Code command, cloud-only deletion retains local data; local-and-cloud deletion is irreversible. – On GitHub.com, hide or delete individual synced sessions. – Preserve worktree changes before ordinary session deletion.
Sources we used
- Save, sync, and query session history (checked 30 Oct 2026)
- Manage agent sessions in VS Code (checked 30 Oct 2026)
- Visual Studio Code (checked 30 Oct 2026)
- Visual Studio Code (checked 30 Oct 2026)
This guide draws on Save, sync, and query session history, Manage agent sessions in VS Code and Visual Studio Code (4 pages), and its figures were checked against that text. Facts last checked 30 Oct 2026.