Skip to content

Gate chat.copilotMemory.enabled by editor preview policy#4903

Open
Copilot wants to merge 3 commits intomainfrom
copilot/update-preview-policy-for-chat-setting
Open

Gate chat.copilotMemory.enabled by editor preview policy#4903
Copilot wants to merge 3 commits intomainfrom
copilot/update-preview-policy-for-chat-setting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

  • Extract isCopilotMemoryConfigEnabled helper to agentMemoryService.ts
  • Update AgentMemoryService.isCAPIMemorySyncConfigEnabled to delegate to helper
  • Update MemoryContextPrompt.render() to use helper
  • Update MemoryInstructionsPrompt.render() to use helper
  • Update MemoryTool to use helper
  • Update ToolsContribution to use helper
Original prompt

The chat.copilotMemory.enabled setting should be handled by the preview policy, to be disabled when GH editor previews are disabled for the user.

The user has attached the following file paths as relevant context:

  • .github/copilot-instructions.md
  • .github/copilot-instructions.md
  • AGENTS.md

Created from VS Code.

Copilot AI changed the title [WIP] Update preview policy to manage copilotMemory setting Gate chat.copilotMemory.enabled by editor preview policy Apr 1, 2026
Copilot AI requested a review from digitarald April 1, 2026 13:19
@bhavyaus
Copy link
Copy Markdown
Contributor

bhavyaus commented Apr 1, 2026

@copilot

The isEditorPreviewFeaturesEnabled() check is now repeated in 5 places. Extract a shared helper in agentMemoryService.ts

export function isCopilotMemoryConfigEnabled(
    authenticationService: IAuthenticationService,
    configurationService: IConfigurationService,
    experimentationService: IExperimentationService
): boolean {
    if (!authenticationService.copilotToken?.isEditorPreviewFeaturesEnabled()) {
        return false;
    }
    return configurationService.getExperimentBasedConfig(ConfigKey.CopilotMemoryEnabled, experimentationService);
}

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.

Copilot AI requested a review from bhavyaus April 1, 2026 18:32
@bhavyaus bhavyaus marked this pull request as ready for review April 1, 2026 18:36
Copilot AI review requested due to automatic review settings April 1, 2026 18:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 by copilotToken.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 ToolsContribution wiring (including test simulation instantiation) to inject IAuthenticationService where 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.

Copilot AI and others added 3 commits April 1, 2026 11:52
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>
@bhavyaus bhavyaus force-pushed the copilot/update-preview-policy-for-chat-setting branch from 4f8113a to 8eed1e8 Compare April 1, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants