Skip to content

feat: add A/B test for default new session mode#306532

Merged
pierceboggan merged 3 commits intomicrosoft:mainfrom
andysharman:feature/default-new-session-mode-experiment
Apr 2, 2026
Merged

feat: add A/B test for default new session mode#306532
pierceboggan merged 3 commits intomicrosoft:mainfrom
andysharman:feature/default-new-session-mode-experiment

Conversation

@andysharman
Copy link
Copy Markdown
Contributor

Replace the temporary chat.defaultMode experiment with a proper configuration setting chat.newSession.defaultMode whose default is driven by TAS treatment chatDefaultNewSessionMode.

  • Add DefaultNewSessionMode to ChatConfiguration enum
  • Register setting dynamically via ChatAgentSettingContribution following the registerMaxRequestsSetting pattern
  • Rewrite _setEmptyModelState to sync read the config setting with case-insensitive custom mode name matching
  • Remove unused validateChatMode, isChatMode, and getDefaultModeExperimentStorageKey
  • Remove IWorkbenchAssignmentService from ChatInputPart (moved to ChatAgentSettingContribution)

Copilot AI review requested due to automatic review settings March 30, 2026 23:28
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

Adds a first-class setting (chat.newSession.defaultMode) whose default value is driven by a TAS treatment, and wires ChatInputPart to use this setting instead of the previous one-off experiment logic.

Changes:

  • Add ChatConfiguration.DefaultNewSessionMode and register chat.newSession.defaultMode dynamically via ChatAgentSettingContribution using a TAS treatment.
  • Update ChatInputPart._setEmptyModelState to apply the configured default mode (including case-insensitive matching for custom mode names).
  • Remove the old experiment plumbing in ChatInputPart and delete unused chat-mode validation helpers.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/vs/workbench/contrib/chat/common/constants.ts Adds new configuration key and removes unused chat mode validation helpers.
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Switches default-mode selection from experiment-based to configuration-based and removes assignment service dependency.
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Dynamically registers the new setting with a TAS-driven default.

@andysharman andysharman force-pushed the feature/default-new-session-mode-experiment branch 2 times, most recently from 5502c6d to 4882d82 Compare March 31, 2026 00:51
@andysharman andysharman requested a review from Copilot March 31, 2026 00:53
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +1615 to +1630
private registerDefaultModeSetting(): void {
this.experimentService.getTreatment<string>('chatDefaultNewSessionMode').then(value => {
const node: IConfigurationNode = {
id: 'chatSidebar',
title: nls.localize('interactiveSessionConfigurationTitle', "Chat"),
type: 'object',
properties: {
[ChatConfiguration.DefaultNewSessionMode]: {
type: 'string',
description: nls.localize('chat.newSession.defaultMode', "The default mode for new chat sessions. When empty, the chat view's default mode is used."),
default: typeof value === 'string' ? value : '',
}
}
};
configurationRegistry.updateConfigurations({ add: [node], remove: [] });
});
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

ChatAgentSettingContribution is registered for WorkbenchPhase.AfterRestored, and registerDefaultModeSetting() waits on an async TAS treatment before registering the chat.newSession.defaultMode schema/default. If a chat widget/session is restored or created before this runs, _setEmptyModelState() may read undefined and miss applying the experiment-driven default for that first session. Consider registering this contribution earlier (e.g. WorkbenchPhase.BlockRestore) or ensuring the setting is registered synchronously with a default, then updating it when the treatment arrives.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i think you can take this one if you want - i believe you can register the contribution in chat.contributions

@andysharman andysharman marked this pull request as ready for review March 31, 2026 17:43
Replace the temporary chat.defaultMode experiment with a proper
configuration setting chat.newSession.defaultMode whose default
is driven by TAS treatment chatDefaultNewSessionMode.

- Add DefaultNewSessionMode to ChatConfiguration enum
- Register setting dynamically via ChatAgentSettingContribution
  following the registerMaxRequestsSetting pattern
- Rewrite _setEmptyModelState to sync read the config setting
  with case-insensitive custom mode name matching
- Remove unused validateChatMode, isChatMode, and
  getDefaultModeExperimentStorageKey
- Remove IWorkbenchAssignmentService from ChatInputPart
  (moved to ChatAgentSettingContribution)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@andysharman andysharman force-pushed the feature/default-new-session-mode-experiment branch from 4882d82 to 74fcb3b Compare March 31, 2026 20:00
@cwebster-99 cwebster-99 requested a review from justschen March 31, 2026 20:30
justschen
justschen previously approved these changes Mar 31, 2026
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +761 to +765
[ChatConfiguration.DefaultNewSessionMode]: {
type: 'string',
description: nls.localize('chat.newSession.defaultMode', "The default mode for new chat sessions. When empty, the chat view's default mode is used."),
default: '',
},
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

chat.newSession.defaultMode is registered in the static registerConfiguration block and then re-registered again via configurationRegistry.updateConfigurations() inside registerDefaultModeSetting(). While the later registration will override the schema, it also adds another configuration contributor and makes the registration path harder to reason about. Prefer registering the property schema once, and use configuration defaults overrides (e.g. configurationRegistry.registerDefaultConfigurations/deregisterDefaultConfigurations) or a tracked lastNode+remove pattern to update only the default value from TAS.

Copilot uses AI. Check for mistakes.
roblourens
roblourens previously approved these changes Apr 1, 2026
…-session-mode-experiment

# Conflicts:
#	src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts
@andysharman andysharman dismissed stale reviews from roblourens and justschen via 669bdb0 April 2, 2026 16:01
@andysharman andysharman force-pushed the feature/default-new-session-mode-experiment branch from 113062d to 669bdb0 Compare April 2, 2026 16:01
@pierceboggan pierceboggan self-requested a review April 2, 2026 17:14
@pierceboggan pierceboggan enabled auto-merge April 2, 2026 17:14
@pierceboggan pierceboggan merged commit a188021 into microsoft:main Apr 2, 2026
19 checks passed
@vs-code-engineering vs-code-engineering bot added this to the 1.115.0 milestone Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants