Skip to content

chat: require Agent Host for managed sandbox and permission rules - #340529

Merged
Ross Wollman (rwoll) merged 7 commits into
mainfrom
rwoll/managed-permission-rules-require-agent-host
Oct 8, 2026
Merged

Ross Wollman (rwoll) merged 7 commits into
mainfrom
rwoll/managed-permission-rules-require-agent-host

Conversation

@rwoll

@rwoll Ross Wollman (rwoll) commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Local, Claude, and Codex harnesses cannot enforce certain Enterprise Managed Settings (e.g. non-empty
permissions.ask, permissions.allow, or permissions.deny lists, or sandbox.enabled: true)
while Copilot Agent Host can.

When an organization has incompatible settings enabled, we need to deal with older chats
that were started in an unsupported harness:

  1. Local:

    1. A banner at the top reads:

      This chat is read-only because your organization requires the new Copilot experience. Move to Copilot

    2. If the user clicks the migration button in the banner, VS Code automatically:

      1. Imports their chat to a Copilot Agent Host Session.
      2. Opens and focuses the new chat with the transcript and unsent draft/attachments. Nothing is sent automatically.
      3. Archives the old Local session after the new chat opens successfully. Reopening the archived original
        shows the normal read-only banner while the policy requirement remains, without another migration button.
        We do not migrate the model choice or permission settings. Instead, the new chat uses its normal defaults
        under current organization policy, and the user can change them in the pickers where permitted.
  2. Claude and Codex: completely disabled and filtered out from the sidebar/Sessions list. Based on offline
    discussion we've chosen to preserve this existing behavior. Making their transcripts available without
    re-enabling execution needs separate read-only support that is out of scope here. It's not 100% ideal,
    but is a tradeoff.

  3. Inline Chat: still available since it's a widely used feature and only uses limited tools.

  4. Terminal Chat: disabled.

Demos

Migration banner:

Screenshot 2026-10-08 at 10 54 28 AM

Post-Migration: new and archived chat:

Screenshot 2026-10-08 at 10 54 56 AM

End to End Video:

ems-demo-migration.mov

Editor inline chat's limited read/edit flow remains available as an explicit exception. This gate does not enforce runtime permission rules on inline edits; Local-backed terminal chat remains subject to the requirement.

Resolves #338932.
Resolves https://github.com/microsoft/vscode-internalbacklog/issues/9987.

Manual Testing

  1. Launch VS Code (without any Enterprise Managed Settings), and start a few chats with Local and any enabled Claude/Codex
    harnesses. The following settings restore the Local choice (though they won't work if enterprise policy forcibly disables it):

    {
       "chat.editor.localAgent.enabled": true,
       "chat.editor.preferCopilotHarness": false,
       "chat.defaultToCopilotHarness": false
    }
  2. Apply an Enterprise Managed Policy with at least something like:

    {
       "permissions": { "ask": ["Shell"] }
    }
  3. Run Developer: Sync Account Policy and confirm the effective policy in Developer: Policy Diagnostics.
    Local chats should show the migration banner; Claude/Codex sessions remain hidden while disabled.
    Before starting the destination chat, run Developer: Restart Local Agent Host so its runtime picks up the changed policy.

  4. Click Move to Copilot. Confirm the transcript and draft arrive without sending, the original is archived,
    and the new conversation stays in history when switching back to the original before sending.

The migration and navigation flow was manually verified. After the CI/review fixes:

  • npm run build-fast -- --client-only: passed.
  • npm run define-class-fields-check: passed.
  • Targeted npm run eslint -- ... and staged-file node build/hygiene.ts: passed.
  • ChatService, ChatWidget, constants, and editor regression suites passed; the final editor rerun passed 24 tests.
  • ./node_modules/.bin/component-explorer render --project ./test/componentFixtures/component-explorer.json --fixture-id-regex '^editor/inlineChatZoneWidget/InlineChatZoneWidget(Terminated)?/(Light|Dark)$': all four fixtures rendered without errors. No baseline hashes or PNGs were committed.

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

Ross Wollman (rwoll) and others added 4 commits October 7, 2026 23:53
Keep existing Local conversations read-only under enforced policy. Offer a transcript-preserving move to Copilot without sending, and archive the source only after the destination opens successfully.

Validated policy routing and recovery with targeted tests, client build, type-check, and lint. Local PR and TPI drafts are intentionally excluded.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Distinguish migration from new-chat recovery and panel from editor. Count coalesced attempts once and record success only after opening and source archival. Record bounded outcomes without policy payloads, chat contents, identifiers, or raw errors.

Validation: 95 targeted tests passed, 4 pending; client build, type-check, and targeted lint passed.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Keep migration preparation in the recovery action and reuse the existing top read-only banner. Preserve ordinary archived Local behavior when policy is removed and avoid waiting for policy when restoring populated history.

Release imported sessions from temporary-draft ownership after successful opening so navigating away before sending does not delete them. Keep policy checks before MCP startup and agent invocation, with lifecycle and race regression coverage.

Validation: client build, type-check, targeted lint, recovery/service/widget/editor tests, and 122 migration/lifecycle tests passed. User verified the flow end to end.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Bring the draft branch current while preserving the reviewed recovery and telemetry checkpoints.

🤖 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 17:06
@github-actions

This comment was marked as outdated.

This comment was marked as resolved.

Ross Wollman (rwoll) and others added 3 commits October 8, 2026 10:43
Bind the chat editor to the resolved session's agent after policy redirects or provider fallback. Keep the agreed editor-inline read/edit exception without exempting panel or terminal Local sessions.

Fix CI by initializing the managed policy observable in the constructor and completing the inline-chat fixture mock. No screenshot baselines changed. Split/copy routing and other migration edge cases remain deferred.

Validation: initialization-order check, targeted lint and hygiene passed; focused policy/widget suites passed; final editor suite 24 passing. Both inline fixture variants render in Light and Dark without errors.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Apply the repository TypeScript formatter to the recovery tests. Hygiene passes across all 31 changed TypeScript files in the PR; no behavior or screenshot baselines changed.

🤖 Authored with GitHub Copilot on behalf of @rwoll.

Co-authored-by: Copilot <[email protected]>
Reviewed-head: 37cecde
Pull-request: #340529
Approved-by: rwoll via PR Sign-Off
Requested-by: Copilot
@rwoll
Ross Wollman (rwoll) marked this pull request as ready for review October 8, 2026 17:56

@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.

Reviewed the full diff and relevant repository context at 5778ffe. No additional actionable P1/P2 defects found beyond the explicitly accepted/deferred limitations already discussed in the review threads. Static review only; no validation run or checkout changes.

@rwoll
Ross Wollman (rwoll) enabled auto-merge (squash) October 8, 2026 18:23
@rwoll
Ross Wollman (rwoll) merged commit 00ef6f1 into main Oct 8, 2026
35 checks passed
@rwoll
Ross Wollman (rwoll) deleted the rwoll/managed-permission-rules-require-agent-host branch October 8, 2026 18:39
@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 8, 2026
Followup to #340529 based on
user feedback.

When an organization requires Agent Host for managed sandboxing or
permission
rules, opening an existing Local chat now automatically moves it to
Copilot
instead of requiring the user to click **Move to Copilot**.

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.

Existing Local chat session remains usable after managed Agent Host sandbox policy applies

4 participants