Skip to content

Agent host: permission config update races SDK session initialization #342817

Description

Observed in Code - Insiders on Windows (build 341e0fa), October 20.

A configuration update while a Copilot SDK session is still being created tries to apply sandbox settings before _wrapper exists.

Agent host log:

2026-10-20 09:00:25.845 [error] TypeError: Cannot read properties of undefined (reading 'session')

Relevant stack frames (installation paths omitted):

at Object.getSession
at CopilotSessionSandbox._updateConfig
at async Object.apply
at async CopilotAgentSession._syncPermissionModeAfterConfigChange
[Copilot:90287a1b-ef33-40e1-b7c5-e5b759bfd1bf] Failed to apply permission config change

The startup ordering introduced in #341661 subscribes to configuration changes before awaiting _initializeSdkWrapper(). A root/chat configuration change during launch can hit this race.

Expected: do not call the SDK before it exists; apply the latest permission and sandbox settings before the first prompt. Four deterministic regression cases (root/chat changes on Windows/Linux) reproduce the exact exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

insiders-releasedPatch has been released in VS Code Insiders

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions