Skip to content

sessions: Delete user-shared environments from Remotes - #344083

Merged
Christof Marti (chrmarti) merged 2 commits into
mainfrom
chrmarti/remotes-environment-delete
Oct 25, 2026
Merged

Christof Marti (chrmarti) merged 2 commits into
mainfrom
chrmarti/remotes-environment-delete

Conversation

@chrmarti

Copy link
Copy Markdown
Collaborator

Fixes #343985.

Changes

  • Add a trash-icon Delete action after Rename on Environment rows, including offline environments. Delete acts immediately, with no confirmation dialog.
  • Restrict the action and inventory operation to user-local registrations. Managed sandboxes and unknown environment kinds are excluded.
  • Call DELETE /agents/environments/{id} using the selected account's credential. Successful deletion (or an already absent record) invalidates discovery caches, persists inventory removal, cancels pending connections, and withdraws the local connection/provider. Errors retain the row and are reported to the user.
  • Preserve keyboard navigation and restore table focus after deletion; prevent duplicate row actions while deletion is pending.
  • Update accessibility help and add light/dark/high-contrast fixtures and regression tests.

Deleting a user-local environment removes its registration, not the machine or its local files. It is not a session-history erasure operation. The owning application can register a new environment afterward.

This branch starts from origin/main at 86db3b69224; it is not stacked on an open PR.

Validation

Passed:

npm run build-fast -- --client-only
npm run typecheck-client
.\scripts\test.bat --run src\vs\sessions\contrib\providers\remoteAgentHost\test\browser\remotesModel.test.ts --run src\vs\sessions\contrib\providers\remoteAgentHost\test\browser\remotesWidget.test.ts --run src\vs\workbench\contrib\chat\test\browser\remoteAgentHost\missionControlEnvironmentService.test.ts --run src\vs\workbench\contrib\chat\test\browser\remoteAgentHost\cloudSandboxApiService.test.ts --reporter dot
npm run test-browser-no-install -- --browser webkit --browser chromium-msedge --run src\vs\sessions\contrib\providers\remoteAgentHost\test\browser\remotesWidget.test.ts --run src\vs\sessions\contrib\providers\remoteAgentHost\test\browser\remotesModel.test.ts --run src\vs\workbench\contrib\chat\test\browser\remoteAgentHost\missionControlEnvironmentService.test.ts --run src\vs\workbench\contrib\chat\test\browser\remoteAgentHost\cloudSandboxApiService.test.ts --reporter dot
  • Electron: 625 passing.
  • Edge/WebKit: 1,247 passing combined.
  • Changed-TypeScript ESLint and direct hygiene: 14 files passed each (npm run eslint -- <changed TypeScript files> and node build\hygiene.ts <changed TypeScript files>).
  • git diff --check: passed.
  • Component Explorer: inspected EnvironmentActions in dark, light, dark high contrast, and light high contrast; dark high-contrast stability check passed.
  • Isolated Edge keyboard check: select the offline row, Tab to Rename, Right Arrow to Delete, Enter. The row disappeared without a dialog, the other environment remained, and focus returned to the table.

Tests cover 204/404 responses, HTTP failures, account-bound credentials, late completion after an account switch, stale discovery, persistence, pending connection cancellation, unsupported kinds, offline deletion, duplicate actions, and focus restoration.

No real environment was deleted during validation. Live backend deployment/proxy behavior and live host re-registration were not exercised.

Manual test

  1. Open Manage Remote Environments with GitHub Environments enabled and available.
  2. Hover or focus a disposable user-shared Environment row and activate Delete after Rename.
  3. Verify there is no confirmation; the row disappears after success. Check both online and offline rows, and confirm SSH/WSL/Tunnel rows do not gain Delete.
  4. Refresh or reopen the editor and verify the deleted registration remains absent unless its owning application has registered again.
  5. With a failing request, verify the row stays, an error is reported, and Delete can be retried.

Add an inline Delete action without confirmation for user-local registrations. Guard account ownership, invalidate stale inventory, and withdraw local connections after deletion. Fixes #343985.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 22:59
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 4f383697 Current: 8a633842

Added (1)

sessions/remotes/remotesWidget/EnvironmentActions/Light

current

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A stale discovery response in another window can restore a successfully deleted environment to shared inventory.

1 open issue
What changed in this PR

Adds deletion of user-shared environment registrations to the Agents Window’s Remotes editor, addressing #343985 without deleting machines or their files.

Changes:

  • Adds Delete after Rename for user-local environments, including offline rows, with pending-action guards and focus restoration.
  • Adds account-bound API deletion and inventory cleanup, including cache invalidation and connection withdrawal.
  • Updates accessibility help, documentation, themed fixtures, and regression tests.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​missionControlEnvironmentService.test.ts Tests inventory deletion, persistence, cancellation, and account changes.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​cloudSandboxApiService.test.ts Tests deletion responses, cache invalidation, and account-bound requests.
src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​missionControlEnvironmentService.ts Implements guarded deletion and persisted inventory removal.
src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxTelemetry.ts Adds the environment-deletion request action.
src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxApiService.ts Sends authenticated DELETE requests and invalidates discovery.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​test/​browser/​remotesWidget.test.ts Tests Delete availability, duplicate prevention, errors, and focus.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​test/​browser/​remotesWidget.fixture.ts Adds themed environment-action fixtures.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​test/​browser/​remotesModel.test.ts Tests deletion routing and environment eligibility.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​REMOTE_AGENT_HOST_SESSIONS_PROVIDER.md Documents registration deletion semantics.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​electron-browser/​remotes.contribution.ts Updates accessibility help for Delete.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​browser/​remotesWidget.ts Handles deletion, pending state, errors, and focus restoration.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​browser/​remotesTable.ts Adds the conditional trash-icon action.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​browser/​remotesModel.ts Routes environment removal to the inventory service.
src/​vs/​platform/​agentHost/​common/​missionControlEnvironment.ts Exposes the inventory deletion contract.
src/​vs/​platform/​agentHost/​common/​cloudSandboxAgentHost.ts Exposes the account-bound API deletion contract.

Review effort: Balanced

Ask before deleting an environment registration and revalidate the target after confirmation. Cover cancellation and stale account, inventory, and availability changes.

Co-authored-by: Copilot <[email protected]>
@chrmarti
Christof Marti (chrmarti) merged commit 416e5d6 into main Oct 25, 2026
61 checks passed
@chrmarti
Christof Marti (chrmarti) deleted the chrmarti/remotes-environment-delete branch October 25, 2026 14:30
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let's support deleting environments

3 participants