Gate chat.copilotMemory.enabled by editor preview policy#4903
Gate chat.copilotMemory.enabled by editor preview policy#4903
Conversation
|
The isEditorPreviewFeaturesEnabled() check is now repeated in 5 places. Extract a shared helper in agentMemoryService.ts The 4 call sites (MemoryContextPrompt, MemoryInstructionsPrompt, MemoryTool, ToolsContribution) can then inject IAuthenticationService and call this helper instead of inlining the config check. AgentMemoryService.isCAPIMemorySyncConfigEnabled can delegate to it too. This way if the gating logic changes, there's only one place to update. |
There was a problem hiding this comment.
Pull request overview
This PR ensures the chat.copilotMemory.enabled enablement check is additionally gated by the organization “editor preview features” policy (derived from the Copilot token), so Copilot Memory is treated as disabled when preview features are not allowed.
Changes:
- Added a shared
isCopilotMemoryConfigEnabled(...)helper that gates the config bycopilotToken.isEditorPreviewFeaturesEnabled(). - Updated Copilot Memory call sites (tools + prompts + memory tool logic) to use the shared helper instead of reading the experiment-based config directly.
- Updated
ToolsContributionwiring (including test simulation instantiation) to injectIAuthenticationServicewhere needed.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/base/extHostContext/simulationExtHostToolsService.ts | Updates test harness instantiation of ToolsContribution to match the new constructor dependencies. |
| src/extension/tools/vscode-node/tools.ts | Uses the new helper when deciding whether to include local repo-scoped memories in the “show memories” command. |
| src/extension/tools/node/memoryTool.tsx | Uses the new helper to decide whether to expose local repo memory behavior vs CAPI-backed memory. |
| src/extension/tools/node/memoryContextPrompt.tsx | Gates prompt inclusion/fetching of repo memories using the helper (policy-aware enablement). |
| src/extension/tools/common/agentMemoryService.ts | Introduces isCopilotMemoryConfigEnabled(...) and routes AgentMemoryService enablement checks through it. |
The copilotMemory.enabled setting is now gated by the preview policy, so it will be disabled when GH editor previews are disabled by organization policy. Changes: - AgentMemoryService.isCAPIMemorySyncConfigEnabled() now checks isEditorPreviewFeaturesEnabled() before checking the config - MemoryContextPrompt and MemoryInstructionsPrompt now inject IAuthenticationService and check preview policy - MemoryTool now checks preview policy before deciding CAPI enablement - ToolsContribution now checks preview policy for memory collection Agent-Logs-Url: https://github.com/microsoft/vscode-copilot-chat/sessions/21c74110-34ab-48e4-a1ea-27fc4165a7b8 Co-authored-by: digitarald <8599+digitarald@users.noreply.github.com>
Address code review feedback: When copilotToken is undefined (authentication hasn't completed), default to false instead of true for isPreviewFeaturesEnabled to be more conservative about enabling preview features. Agent-Logs-Url: https://github.com/microsoft/vscode-copilot-chat/sessions/21c74110-34ab-48e4-a1ea-27fc4165a7b8 Co-authored-by: digitarald <8599+digitarald@users.noreply.github.com>
… preview policy checks Agent-Logs-Url: https://github.com/microsoft/vscode-copilot-chat/sessions/41b654f5-7d7a-4ff1-b4d0-c4de9c36b645 Co-authored-by: bhavyaus <25044782+bhavyaus@users.noreply.github.com>
4f8113a to
8eed1e8
Compare
isCopilotMemoryConfigEnabledhelper toagentMemoryService.tsAgentMemoryService.isCAPIMemorySyncConfigEnabledto delegate to helperMemoryContextPrompt.render()to use helperMemoryInstructionsPrompt.render()to use helperMemoryToolto use helperToolsContributionto use helperOriginal prompt
Created from VS Code.