sessions: gate titlebar new-session button behind experiment + add telemetry#322689
Merged
Conversation
…ace telemetry
Gate the titlebar new-session button on the 'agentSessionsTitleBarNewSession'
ExP treatment via the SessionsTitleBarNewSessionEnabledContext context key, so
the affordance only shows for the treatment group and we can measure its impact
on new-session metrics. Also tag the new-session interaction telemetry with the
originating surface ('titleBar' vs 'sidebar') to count clicks from the titlebar.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fe7bdfa to
16216a6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR follows up on Agents window UX feedback by gating the titlebar New Session affordance behind an ExP treatment and by extending interaction telemetry to attribute new session clicks to a specific UI surface (titlebar vs sidebar).
Changes:
- Gate the titlebar New Session button behind the
agentSessionsTitleBarNewSessionexperiment by reflecting treatment state into a newSessionsTitleBarNewSessionEnabledContextcontext key. - Move the sidebar header New Session affordance to a shared
NewSessionActionViewItemso the sidebar header and titlebar render the same compact “New” pill. - Extend
vscodeAgents.interactiontelemetry source values to includetitleBarandsidebar.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/LAYOUT.md | Updates layout docs to mention the (experiment-gated) titlebar New Session affordance. |
| src/vs/sessions/contrib/sessions/browser/views/sessionsView.ts | Removes the hand-rendered header New Session button and relies on a menu-driven toolbar. |
| src/vs/sessions/contrib/sessions/browser/sessions.contribution.ts | Registers the new NewSessionActionViewItemContribution. |
| src/vs/sessions/contrib/sessions/browser/newSessionActionViewItem.ts | Adds shared action view item rendering + experiment-driven context key update. |
| src/vs/sessions/contrib/sessions/browser/media/sessionsViewPane.css | Removes inline styling for the old header button (now shared). |
| src/vs/sessions/contrib/sessions/browser/media/newSessionActionViewItem.css | Introduces shared styling for the compact “New” pill across surfaces. |
| src/vs/sessions/contrib/chat/browser/chat.contribution.ts | Contributes the new-session action to sidebar header + titlebar menus with when gating. |
| src/vs/sessions/common/sessionsTelemetry.ts | Expands interaction source values to include titleBar and sidebar. |
| src/vs/sessions/common/contextkeys.ts | Adds SessionsTitleBarNewSessionEnabledContext context key for the experiment gate. |
Copilot's findings
Comments suppressed due to low confidence (2)
src/vs/sessions/contrib/sessions/browser/newSessionActionViewItem.ts:66
- This view item renders a focusable
Button() inside an ActionBar item. ActionBar manages focus/tab stops viafocus()/setFocusable()on the view item (seeActionViewItem), so having an additional tabbable element can create confusing keyboard/tab order and make activation paths inconsistent (e.g. arrow-key toolbar activation goes through ActionBar’s trigger path, bypassing the button’s handler/telemetry and its aria-label). Consider delegating focusability to the inner button (overridefocus/blur/setFocusablelikeActionViewItemdoes) or render directly on the container element (similar toOpenInVSCodeTitleBarWidget) so there is exactly one focus target.
const newSessionButton = this._register(new Button(this.element, {
...defaultButtonStyles,
buttonSecondaryBackground: asCssVariable(agentsNewSessionButtonBackground),
buttonSecondaryForeground: asCssVariable(agentsNewSessionButtonForeground),
src/vs/sessions/common/sessionsTelemetry.ts:36
- The JSDoc still says this logs a "titlebar" interaction, but
SessionsInteractionSourcenow includessidebar(and other surfaces). Please update the doc comment so telemetry consumers don’t misinterpret the event.
/**
* Log a titlebar button interaction in the Agents window.
*/
export function logSessionsInteraction(telemetryService: ITelemetryService, button: SessionsInteractionButton, source?: SessionsInteractionSource): void {
telemetryService.publicLog2<SessionsInteractionEvent, SessionsInteractionClassification>('vscodeAgents.interaction', source ? { button, source } : { button });
- Files reviewed: 5/5 changed files
- Comments generated: 0
Let the left titlebar toolbar provide the gap between its actions via a 4px gap on the actions-container, instead of a per-item margin class on the new-session view item. Keeps spacing consistent across all left toolbar actions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…onstructor flag Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Show the affordance regardless of the experiment when running out of sources (IEnvironmentService.isBuilt === false) to ease development. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @benibenjMatched files:
|
benibenj
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #322614 addressing reviewer feedback to ship the titlebar New Session button as an A/B experiment and measure click-through.
What changed
agentSessionsTitleBarNewSessionExP treatment group.NewSessionActionViewItemContributionresolves the treatment (and re-resolves ononDidRefetchAssignments) and reflects it into the newSessionsTitleBarNewSessionEnabledContextcontext key, which theMenus.TitleBarLeftLayoutmenuwhenclause checks. The control group keeps the prior behaviour (no titlebar button), so we can see how the affordance moves new-session metrics before a wider rollout.vscodeAgents.interactionevent now records the originating surface (titleBarvssidebar) for the new-session action, so we can count how often the button is clicked specifically from the titlebar.How it addresses the feedback
Done via the
agentSessionsTitleBarNewSessiontreatment — the button is off by default and only enabled for the experiment's treatment group.Done — the interaction telemetry now distinguishes
titleBarvssidebaras the source.Validation
npm run typecheck-client✅npm run valid-layers-check✅