Skip to content

Copilot session resume does not reconcile saved sandbox state with runtime and managed policy #344903

Closed

Description

  • Copilot Chat Extension Version: Not recorded; concerns Copilot Agent Host sessions.
  • VS Code Version: A build before the fix in Fix sandbox state reconciliation when resuming Copilot sessions #343654.
  • OS Version: Not recorded; use a host that supports sandboxing for the steps below.
  • Feature (e.g. agent/edit/ask mode): Resuming Copilot Agent Host sessions, including in the Agents window.
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): No model-specific requirement identified.
  • Logs: Not attached. These are code-derived reproduction steps, not a newly recorded live reproduction.

Description

Resuming a Copilot session needs to reconcile the saved sandbox selection, previously confirmed sandbox state, and the current managed policy with the newly opened runtime. A saved OFF selection is not by itself authorization to bypass a managed sandbox requirement.

Before the fix, resume does not explicitly restore a confirmed, policy-permitted opt-out through the runtime's sandbox session command. A conflicting saved OFF selection can also remain inconsistent with the effective sandbox state, and resume finalization can continue after a managed sandbox configuration rejection instead of failing clearly.

Steps to Reproduce:

Scenario 1: Resume a confirmed opt-out while managed policy permits bypass

  1. On a sandbox-capable host, configure the applicable Copilot managed settings with:
    { "sandbox": { "enabled": true, "allowBypass": true } }
  2. Open the Agents window and start a Copilot Agent Host session.
  3. Use the session's sandbox control to turn sandboxing OFF. Wait until the runtime accepts the change so the saved selection is OFF and the confirmed applied state is false.
  4. Close/restart the window or agent host so the next interaction resumes the persisted session rather than reusing the live SDK session.
  5. Reopen that same session and send another prompt. Compare the sandbox control, confirmed state, and runtime behavior after resume.

Expected: The confirmed opt-out is restored through the runtime session command because current policy permits bypass. The affected chat remains OFF, with UI and runtime state in agreement.

Problem addressed: Resume did not explicitly replay that confirmed opt-out through the session command, so the saved OFF state was not reliably restored to the runtime.

Scenario 2: Resume after policy changes to require sandboxing without bypass

  1. Complete steps 1-3 above, leaving a persisted session with a confirmed OFF state.
  2. Close the window/agent host.
  3. Change the applicable managed settings to:
    { "sandbox": { "enabled": true, "allowBypass": false } }
  4. Restart and resume the same session.
  5. Check the effective sandbox state and the affected chat's saved selection.

Expected: Current policy wins: sandboxing is ON and bypass is disabled, regardless of the previous OFF metadata. After successful application, reconcile a conflicting saved OFF selection for the affected chat without overwriting newer user selections or unrelated sibling-chat selections. If sandbox configuration is rejected during resume, surface the failure and disconnect the unattached SDK session rather than completing resume with inconsistent state.

Problem addressed: A successful resume-time sandbox update must also reconcile stale saved state, and a rejected update must not be treated as successful resume finalization. This report does not claim that saved OFF metadata can bypass runtime enforcement.

Additional regression cases

  • Missing confirmed OFF metadata must not authorize bypass, even when bypass is allowed by policy.
  • A new pending user selection must take precedence over previously confirmed state.
  • Rejection of the runtime sandbox session command must fail resume rather than attach a partially configured session.

Related

Activity

  1. vs-code-engineering commented on Oct 29, 2026

    @vs-code-engineering
    Contributor

    Thanks for creating this issue! It looks like you may be using an old version of VS Code; the latest stable release is 1.144.0. Please try upgrading to the latest version and checking whether this issue remains.

    Happy Coding!

  2. added
    unreleased
    on Oct 29, 2026
  3. added this to the 1.145.0 milestone on Oct 29, 2026
  4. added
    insiders-released
    and removed
    unreleased
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

insiders-released

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions