Skip to content

Sandbox profiles: concurrent windows can lose a host's last-known profile assignment #350028

Todo

Description

Follow-up to #350008 (backport: #350019). Refs #349807.

All windows on a machine share the saved list of each remote host's last-known sandbox profile (chat.sandboxProfileAssignments.v1, APPLICATION_SHARED). rememberSandboxProfileAssignment in src/vs/platform/agentHost/common/sandboxProfiles.ts reads the whole list from the window's cached storage, changes one entry and writes the whole list back.

Each window's cache only sees other windows' writes after they propagate. When two windows record different hosts before either sees the other's write, the second write replaces the list and drops the other host's entry.

Steps to reproduce

  1. Open two windows on the same machine that show different remote hosts in Remote Environments, for example host A in window 1 and host B in window 2, each with a sandbox profile assigned.
  2. Have both windows record their host's assignment at about the same time, before shared storage propagates between them (for example, both connect at once).
  3. Disconnect the host whose entry was written first.

Expected

The disconnected host shows its last-known sandbox profile, disabled, and that profile can't be deleted in Manage Sandbox Profiles.

Actual

The host's entry is gone, so:

It corrects itself the next time a window shows that host connected.

Suggested fix

Update the list with IStorageService.compareAndSwapApplicationSharedValue, retrying against the current value, so concurrent updates to different hosts merge instead of overwriting each other. Add a test with two independent window caches and delayed propagation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions