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.

  1. Read session sync status in the Chat view’s Copilot status bar.
  2. 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.
  3. 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.
Separate VS Code and GitHub session cleanup branches
Original documentation diagram: deletion-scope choices belong to the VS Code command; GitHub separately supports individual hiding or deletion. Source: Sync and query session history, Save, sync, and query session history, checked 30 Oct 2026

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.