Skip to content

sessions: gate titlebar new-session button behind experiment + add telemetry#322689

Merged
sandy081 merged 6 commits into
mainfrom
agents/session-icon-title-bar-update-d09dc4cd
Jun 24, 2026
Merged

sessions: gate titlebar new-session button behind experiment + add telemetry#322689
sandy081 merged 6 commits into
mainfrom
agents/session-icon-title-bar-update-d09dc4cd

Conversation

@sandy081

Copy link
Copy Markdown
Member

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

  • Experiment gating — the titlebar New Session button now only shows for the agentSessionsTitleBarNewSession ExP treatment group. NewSessionActionViewItemContribution resolves the treatment (and re-resolves on onDidRefetchAssignments) and reflects it into the new SessionsTitleBarNewSessionEnabledContext context key, which the Menus.TitleBarLeftLayout menu when clause 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.
  • Per-surface telemetry — the vscodeAgents.interaction event now records the originating surface (titleBar vs sidebar) for the new-session action, so we can count how often the button is clicked specifically from the titlebar.

How it addresses the feedback

like the idea and I'd love that we build our exp. Could we please do this via an experiment and see how metrics move?

Done via the agentSessionsTitleBarNewSession treatment — the button is off by default and only enabled for the experiment's treatment group.

Also it would be nice to know how many times user click this button from title bar

Done — the interaction telemetry now distinguishes titleBar vs sidebar as the source.

Validation

  • npm run typecheck-client
  • npm run valid-layers-check
  • eslint on changed files ✅
  • hygiene ✅

Copilot AI review requested due to automatic review settings June 24, 2026 09:23
@sandy081 sandy081 marked this pull request as draft June 24, 2026 09:25
…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>
@sandy081 sandy081 force-pushed the agents/session-icon-title-bar-update-d09dc4cd branch from fe7bdfa to 16216a6 Compare June 24, 2026 09:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 agentSessionsTitleBarNewSession experiment by reflecting treatment state into a new SessionsTitleBarNewSessionEnabledContext context key.
  • Move the sidebar header New Session affordance to a shared NewSessionActionViewItem so the sidebar header and titlebar render the same compact “New” pill.
  • Extend vscodeAgents.interaction telemetry source values to include titleBar and sidebar.
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 via focus()/setFocusable() on the view item (see ActionViewItem), 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 (override focus/blur/setFocusable like ActionViewItem does) or render directly on the container element (similar to OpenInVSCodeTitleBarWidget) 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 SessionsInteractionSource now includes sidebar (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

sandy081 and others added 5 commits June 24, 2026 12:04
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>
@sandy081 sandy081 marked this pull request as ready for review June 24, 2026 10:40
@sandy081 sandy081 enabled auto-merge (squash) June 24, 2026 10:40
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@benibenj

Matched files:

  • src/vs/sessions/browser/parts/media/titlebarpart.css

@sandy081 sandy081 self-assigned this Jun 24, 2026
@sandy081 sandy081 added this to the 1.127.0 milestone Jun 24, 2026
@sandy081 sandy081 merged commit 693c4e1 into main Jun 24, 2026
28 checks passed
@sandy081 sandy081 deleted the agents/session-icon-title-bar-update-d09dc4cd branch June 24, 2026 11: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.

3 participants