Repository navigation
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
- On a sandbox-capable host, configure the applicable Copilot managed settings with:
{ "sandbox": { "enabled": true, "allowBypass": true } } - Open the Agents window and start a Copilot Agent Host session.
- 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.
- Close/restart the window or agent host so the next interaction resumes the persisted session rather than reusing the live SDK session.
- 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
- Complete steps 1-3 above, leaving a persisted session with a confirmed OFF state.
- Close the window/agent host.
- Change the applicable managed settings to:
{ "sandbox": { "enabled": true, "allowBypass": false } } - Restart and resume the same session.
- 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
- Fix implementation and regression coverage: Fix sandbox state reconciliation when resuming Copilot sessions #343654.
- Related sandbox preference/state report: Sandbox gets enabled in new chats even though I didn't have it configured that way #343371.
- Agents: explain policy-required sandboxing when it is unavailable #344815 separately improves the warning when mandatory sandboxing is unavailable; it does not implement resume reconciliation.
Activity
vs-code-engineering commentedon Oct 29, 2026
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!