Skip to content

chat: clean up canceled automatic migrations - #340596

Merged
Ross Wollman (rwoll) merged 2 commits into
mainfrom
rwoll/cleanup-cancelled-chat-migration
Oct 8, 2026
Merged

Ross Wollman (rwoll) merged 2 commits into
mainfrom
rwoll/cleanup-cancelled-chat-migration

Conversation

@rwoll

Copy link
Copy Markdown
Member

Followup to #340585 addressing review feedback.

If the user switches away while an automatic migration is creating the Copilot
session, delete that unopened destination before cancelling. Keep the original
Local chat untouched and avoid publishing the cancelled destination.

Relates #338932.

Relates https://github.com/microsoft/vscode-internalbacklog/issues/9987.

🤖 Authored with GitHub Copilot on behalf of Ross Wollman (@rwoll).

Delete the rebound destination and release its provisional ownership if the source is hidden or switched during materialization. Publish its alias and materialized state only after the final visibility check. Preserve the original chat and surface cleanup failures.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 22:12

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

Success-path tests do not verify the moved alias and publication calls.

1 open finding
What changed in this PR

Cleans up unopened Copilot sessions when automatic Local-chat migration is cancelled.

Changes:

  • Deletes materialized destinations before cancellation.
  • Delays alias publication and adds cancellation regression tests.
File Description
chatContinueInAction.ts Cleans up cancelled migration destinations.
chatContinueInCopilotAction.test.ts Tests cancellation during materialization and cleanup failures.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

pwang347
Paul (pwang347) previously approved these changes Oct 8, 2026
Include alias registration and materialization notification in the success snapshot, with neither emitted for the empty-chat path.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*

Co-authored-by: Copilot <[email protected]>

@connor4312 Connor Peet (connor4312) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No confirmed actionable P1/P2 security or correctness issues found in the reviewed changes.

Written by Connor's agent running GPT-6.1 Sol

@rwoll
Ross Wollman (rwoll) merged commit 2c0fe00 into main Oct 8, 2026
55 of 56 checks passed
@rwoll
Ross Wollman (rwoll) deleted the rwoll/cleanup-cancelled-chat-migration branch October 8, 2026 23:29
@vs-code-engineering vs-code-engineering Bot added this to the 1.142.0 milestone Oct 8, 2026
Ross Wollman (rwoll) added a commit that referenced this pull request Oct 9, 2026
<!-- Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:
  https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
-->

Supersedes #340408. Builds on the automatic migration and cleanup in #340585 and #340596.

Any nonempty managed `permissions` object now requires Copilot Agent Host, including
defaults, explicit `false` / `"enable"`, and empty rule lists. This reuses the existing
Local chat migration without sending anything automatically.

Copilot's permission picker reflects runtime restrictions and defaults, allowing
admins to block Allow All while keeping Assisted available. Explicit new mode
restrictions replace the legacy blanket restriction; `defaultMode` alone does not.

Empty `permissions: {}` and legacy policy alone retain existing Local behavior.
Editor Inline Chat keeps its limited read/edit exception. Sandboxing remains independent.

## Policy behavior

**Legacy `ChatToolsAutoApprove: false` with no managed permissions still blocks
both Allow All and Assisted in Copilot Agent Host.** It does not force users off
Local. A nonempty `permissions` object determines harness eligibility; only an
explicit new mode restriction replaces the legacy blanket mode restriction.

The table shows selectable modes, not the starting selection. It assumes all
modes are supported and no additional restrictions. Legacy JSON represents policy
values, not OS-specific deployment syntax. Local does not support Assisted.

| # | Legacy policy JSON | Managed-settings JSON | Full Local chat | AH: Allow All | AH: Assisted | AH: Manual |
|---|---|---|---|:---:|:---:|:---:|
| 1 | `{}` | `{}` | Available | ✅ | ✅ | ✅ |
| 2 | `{"ChatToolsAutoApprove":false}` | `{}` | Available, legacy restrictions | ❌ | ❌ | ✅ |
| 3 | `{}` | `{"permissions":{"disableBypassPermissionsMode":"disable"}}` | Migrate to Copilot | ❌ | ✅ | ✅ |
| 4 | `{"ChatToolsAutoApprove":false}` | `{"permissions":{"disableBypassPermissionsMode":"disable"}}` | Migrate to Copilot | ❌ | ✅ | ✅ |
| 5 | `{}` | `{"permissions":{"disableAssistedPermissionsMode":true}}` | Migrate to Copilot | ✅ | ❌ | ✅ |
| 6 | `{"ChatToolsAutoApprove":false}` | `{"permissions":{"disableAssistedPermissionsMode":true}}` | Migrate to Copilot | ✅ | ❌ | ✅ |
| 7 | `{"ChatToolsAutoApprove":false}` | `{"permissions":{"disableBypassPermissionsMode":"disable","disableAssistedPermissionsMode":true}}` | Migrate to Copilot | ❌ | ❌ | ✅ |
| 8 | `{"ChatToolsAutoApprove":false}` | `{"permissions":{"disableBypassPermissionsMode":"enable"}}` | Migrate to Copilot | ✅ | ✅ | ✅ |
| 9 | `{"ChatToolsAutoApprove":false}` | `{"permissions":{"disableAssistedPermissionsMode":false}}` | Migrate to Copilot | ✅ | ✅ | ✅ |
| 10 | `{}` | `{"permissions":{"defaultMode":"assisted"}}` | Migrate to Copilot | ✅ | ✅ | ✅ |
| 11 | `{"ChatToolsAutoApprove":false}` | `{"permissions":{"defaultMode":"assisted"}}` | Migrate to Copilot | ❌ | ❌ | ✅ |
| 12 | `{"ChatToolsAutoApprove":false}` | `{"permissions":{"ask":[]}}` | Migrate to Copilot | ❌ | ❌ | ✅ |

`permissions: {}` behaves like no permissions object. Rows 6, 8, and 9 intentionally
replace the legacy restriction with the explicitly configured new mode controls.
Rows 11 and 12 require Agent Host but retain the legacy mode restriction.
In row 10, Assisted is the starting default unless an explicit or remembered
choice takes precedence; in row 11 it is unavailable, so the default falls back
to Manual.

“Migrate to Copilot” means full Local execution is unavailable: new chats use
Copilot and existing Local chats migrate when displayed. The editor-inline
exception above remains. Managed `sandbox.enabled: true` independently requires
Agent Host even when permissions are absent.

## Testing

Test with only `permissions.disableBypassPermissionsMode: "disable"`: full Local chats
should move to Copilot, Allow All should be unavailable, and Assisted should remain
selectable. Also test policy removal and an empty permissions object.

Relates #338932.

Relates microsoft/vscode-internalbacklog#9987.

*🤖 Authored with GitHub Copilot on behalf of @rwoll.*
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.

5 participants