Files
vscode/src/vs/platform/workspaces
3c2dc15d94 sharedProcess: preserve agents window workspace storage (#317960)
Fix #317643

The shared-process `UnusedWorkspaceStorageDataCleaner` was deleting the
agents window's workspace storage folder (chat sessions, edits, images,
test results, etc.) when the agents window was not open within ~30s of
Code launching.

The agents window uses a synthetic workspace identifier computed in the
renderer via the browser-side `getWorkspaceIdentifier` (a short hex
hash). The on-disk storage folder is named with this short id, but none
of the cleaner's preservation checks matched it:
- length check expects 32-char MD5 ids
- ext-dev id check does not match
- main-side `window.workspace.id` is the 32-char MD5 (mismatch)
- `isUsed` only true while the agents window is actually open

Changes:
- Move `getWorkspaceIdentifier`/`getSingleFolderWorkspaceIdentifier`
  from `workbench/services/workspaces/browser/workspaces.ts` to
  `platform/workspaces/common/workspaceIdentifier.ts` so the
  shared-process cleaner can import them without layer violations.
- Promote `IEnvironmentService.agentSessionsWorkspace` to required and
  add a browser-side implementation in `BrowserWorkbenchEnvironmentService`
  (stub in `StandaloneEnvironmentService`).
- In the cleaner, preserve the folder matching
  `getWorkspaceIdentifier(env.agentSessionsWorkspace).id`.
- Add a unit test that asserts the agents window folder survives cleanup
  while other empty-workspace folders are removed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-22 09:22:21 +00:00
..