ChatApprovedAccountOrganizations causes toolset bootstrap deadlock
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Type: Bug
When an enterprise policy requires GitHub account sign-in before enabling AI tools, there's a period of time during Copilot extension activation (while auth verification is pending) where agent mode is temporarily disabled. Tool sets that get built during this window end up missing tools.
## Steps to reproduce
1. Set the `ChatApprovedAccountOrganizations` registry policy so GitHub sign-in to a given organization is required before AI tools are enabled
2. Launch VS Code and sign in to a github account associated with an approved organization
3. Open a New Window and wait for the account approval to take effect in the new window
4. In the chat panel, select "Agent" in the agent picker, then click "Configure Tools" and observe the available tools within the "read" toolset dropdown
## Actual results:
3 tools are available under the "read" toolset dropdown: `getTaskOutput`, `terminalLastCommand`, and `terminalSelection`
## Expected results:
Expecting a full list of read tools to be visible under the `read` toolset in the tool picker, including `getNotebookSummary`, `problems`, `readFile`, `readNotebookCellOutput`, and `viewImage`.
NOTE: Disabling and re-enabling the Copilot extension resolves the issue in the current workspace, but the issue resurfaces when a new window is opened (or when running `Developer: Reload Window`).
## Suspected cause
Possibly a race/ordering issue between toolset registration and the transient disabled agent mode state during policy verification on a new window load. Toolset membership appears to be computed once at registration time and isn't recomputed after the auth-gated state resolves.
The 3 tools that are available in the `read` toolset are added directly to `readToolSet` at construction time by core workbench code, while the missing tools are contributed by the Copilot extension and currently gated by the enterprise policy.
## Proposed fix
In `src/vs/workbench/contrib/chat/common/tools/languageModelToolsService.ts`, change `getToolByName()` to iterate `_tools` directly.
```diff
getToolByName(name: string): IToolData | undefined {
- for (const tool of this.getAllToolsIncludingDisabled()) {
- if (tool.toolReferenceName === name) {
- return tool;
+ for (const { data } of this._tools.values()) {
+ if (data.toolReferenceName === name) {
+ return data;
}
}
return undefined;
}
```
---
VS Code version: Code 1.133.0 (a5b500951314efd502d07465bd138dfbd714a960, 2026-08-11T22:14:08Z)
OS version: Windows_NT x64 10.0.26200
Modes:
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-14700 (28 x 2112)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0xa780 [Intel(R) UHD Graphics 770], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.7079 *ACTIVE*
GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8875
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|31.65GB (10.90GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
Extensions: none
Contributor guide
Assessment
This issue has not been assessed yet.