Repository navigation
Chat: onboarding spotlight tour for the Copilot harness chat input - #337814
Logan Ramos (lramos15) merged 20 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Eligibility can become stale across windows or while the tour is queued, causing it to appear for ineligible users.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds a two-step spotlight onboarding tour for the Chat view’s mode and model pickers.
Changes:
- Registers the configurable onboarding scenario and eligibility trigger.
- Exposes picker elements and editor-chat message counts.
- Adds trigger, targeting, and eligibility tests.
| File | Description |
|---|---|
workbench.common.main.ts |
Loads the tour contribution. |
chatInputTour.test.ts |
Tests trigger and eligibility behavior. |
editorChatUsage.ts |
Exposes the editor message count. |
constants.ts |
Defines onboarding configuration values. |
chatInputPart.ts |
Exposes rendered picker elements. |
chatInputTour.contribution.ts |
Implements and registers the tour. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
69689b9 to
2b2f4d9
Compare
6aa0f1e to
216a05a
Compare
There was a problem hiding this comment.
Nice work reusing the onboarding engine. The additionalElements extension to the spotlight is clean, opt-in, and well tested, and the tests and disposables follow our patterns.
Before merging, I'd like the lifecycle and keyboard/screen reader issues I left inline to be fixed, and I'd like to understand the experiment setup, because that decision accounts for a lot of the code here.
On size: this is ~1,180 lines (~600 production). I think 300–400 of those could go. You could use the engine's experiment support, move section switching into the picker, drop the single-entry experience table, and trim comments. About a fifth of the production lines are comments, and many of them restate the code or the PR description. I flagged a few inline, but the same applies elsewhere.
ee11884 to
5a3fb0a
Compare
Spotlights the mode picker (Agent/Ask/Plan) and model picker the first time a user who has never sent a chat message opens the Chat view. Gated by the new chat.onboarding.experience setting (none | spotlight), which is registered for ExP control. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… tour Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…kers Only show the chat onboarding tour for Copilot harness chats. The first two steps open the combined mode and permissions picker on its agent mode and permissions sections, and the spotlight highlights the open menu with its trigger through a new opt-in onboarding target popup. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the mode and permissions menu open when the user clicks the spotlight callout, then collapse the agent mode section and expand the permissions section once the collapse has been visible. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…copy Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ChatOnboardingEligibility decides whether chat onboarding may run: a visible Chat view showing a Copilot harness chat, for a user who has never sent an editor chat message. The chat.onboarding.experience setting selects which experience runs on top of it, so experiences can be swapped or added without changing eligibility. The spotlight tour now only owns its steps, targets, and menu behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Log experimentTrigger for config.chat.onboarding.experience when a user with a real ExP assignment first becomes eligible for chat onboarding. The condition is the same in every arm, so a triggered scorecard, including an A/A that assigns the same value to two arms, compares the same population. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Extend show(anchor) with an optional openPermissions flag instead of adding a separate open() method. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Revert the IActionWidgetService interface additions, the exported mode picker section ids, the picker setSectionExpanded method, and EditorChatUsage.getMessageCount. The tour now switches menu sections with focusItemById and the existing collapse and expand section commands, reads the section ids from getModePermissionsPickerOptions, and reads the message count from getTelemetry. The spotlight relies on allowTargetInteraction and its existing layering instead of new popup-specific conditions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Use the onboarding engine's experiment support (onb.chatInput.show / onb.chatInput.id) instead of the chat.onboarding.experience setting and a separate experimentTrigger. - Move section switching into AgentHostChatInputPicker.showSection, cancelled with the step's token passed to IOnboardingTarget.open. - Start the tour only while its chat is still eligible, end it when a modal editor opens, and have the engine drop automatic runs that are no longer eligible after waiting behind another presentation. - Leave Escape inside additional elements to them and announce the step to screen readers. - Use getModelPickerControl, narrow the Agent Host picker lookup, and drop disposed pickers. - Fold the contribution into the tour file, simplify eligibility tracking, and trim comments and tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
a8c847c to
e442df0
Compare
…re refetched Experiments in the GitHub Copilot ExP workspace are served by an endpoint that VS Code learns from the signed-in account's Copilot entitlements, after startup. Until then only the legacy endpoint is queried, so the flags of those experiments read as undefined and the experiment stayed inactive for the whole window. Keep reading the flags at startup, and read them again on every IAssignmentService.onDidRefetchAssignments while they are unresolved. tas-client fires it (through the assignment context) when a client's fetch replaces its assignments, including the first fetch after the account's endpoint is added. Once both flags resolve the arm is fixed for the window. A refetch during a read in flight reads again after that read settles. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
e442df0 to
f88b5f4
Compare
Logan Ramos (lramos15)
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround, this is a big improvement. I checked each of my earlier threads against the new code and they're all addressed. The trigger now follows eligibility, the modal case is handled, the picker owns section switching behind a narrow API, and the tour uses the engine's experiment support. Production code is down to about 490 added lines, and the comments are much leaner.
What's left is mostly edge cases: how the open menu behaves when a step is cancelled or the user navigates with the mouse. I also have a question about the experiment refetch change in the shared engine, since it affects the Agents window tours too. Details are inline.
I haven't run this locally.
| // Another picker's menu, such as the separate mode picker's, stays visible until it finishes closing. | ||
| this._actionWidgetService.hide(); | ||
| for (let attempt = 0; attempt < 20 && this._actionWidgetService.isVisible && !token.isCancellationRequested; attempt++) { | ||
| await timeout(50); | ||
| } | ||
| await this._showPicker(trigger, section === 'permissions'); | ||
| if (token.isCancellationRequested) { | ||
| this._hidePicker(); | ||
| } else if (this._pickerVisible && this.combinesPermissions) { |
There was a problem hiding this comment.
If the step is cancelled while we wait for the previous menu to close, for example when the user clicks Skip or Back right as step 2 opens, the loop exits but we still call _showPicker and then hide the menu right away. The menu flashes open, and onHide moves focus to the picker button. _showPicker also awaits item loading without checking the token. I'd return early if the token is cancelled before _showPicker, and check it again before the menu is shown. The current test only covers a token that's already cancelled up front.
There was a problem hiding this comment.
Fixed in 29a0689. showSection now returns early if the step is cancelled while it waits for the previous menu to close. _showPicker also takes the token and checks it right before it shows the menu, so the menu no longer flashes open and focus does not move. A new test cancels the step both while the items load and while another picker's menu is still closing.
| this._stepListeners.add(addDisposableGenericMouseDownListener(this._callout, event => { | ||
| const activeElement = getActiveElement(); | ||
| if (activeElement && additionalElements().some(element => element.contains(activeElement))) { | ||
| event.preventDefault(); | ||
| } | ||
| })); |
There was a problem hiding this comment.
Keeping focus in the menu across steps has a side effect when you leave the picker steps with the mouse. Going Back from step 2 to step 1, the overlay focuses Next, the menu closes on blur about 75 ms later, and the picker's onHide calls anchor.focus(). That puts focus on the mode button behind step 1's blocker, so Escape no longer reaches the tour and Tab moves through the workbench underneath. Ending the tour from step 2 or 3 with the mouse has the same problem: focus ends up on the picker button. Could the tour close the menu before it moves to a step that doesn't target the picker, and when the tour ends?
There was a problem hiding this comment.
Fixed in 29a0689. Onboarding targets can now return an optional close(). The spotlight calls it before it shows a step for a different element (for example, going Back from step 2 to step 1) and when the tour ends. Both calls happen before the overlay restores focus, so the picker's onHide can no longer leave focus on the mode button. The chat tour closes the menu through a new picker.hideMenu(). In the combined layout, steps 2 and 3 target the same element, so the menu stays open between them. I added this to the README and an engine test.
| const element = picker?.triggerElement; | ||
| return picker && element ? { | ||
| element, | ||
| open: token => picker.showSection(section, token ?? CancellationToken.None), |
There was a problem hiding this comment.
In the separate mode and permissions layout (chat.experimentalModePermissionsPicker: false), choosing an option in step 2 or 3 makes _renderChip replace the trigger. The spotlight loses its target, shows the step again and calls open again, so the menu pops back open right after the selection. It isn't the default layout, but it may be worth opening only once per step.
There was a problem hiding this comment.
Fixed in 29a0689. The chat tour now opens each picker at most once per step. The guard resets at the start of each step, and it only stays set if the menu actually opened, so a step whose first open was cancelled can still try again. I kept this in the tour instead of the engine because an existing engine test relies on the engine reopening a replaced picker for other tours.
| // joins the existing run instead of scheduling a second one. | ||
| const queued = this._queue.find(entry => entry.scenario.id === scenario.id); | ||
| if (queued) { | ||
| queued.automatic &&= automatic; |
There was a problem hiding this comment.
Small one: a manual runScenario only clears automatic while the entry is still in _queue. Once _doPump has moved it to _inflight and it's waiting for the presentation slot, a manual join keeps the captured automatic = true. The re-check below can then abort a run that was explicitly requested. Keeping the flag on a run record that both paths can update would fix it.
There was a problem hiding this comment.
Fixed in 29a0689. Queued and in-flight runs now share one run record. A manual runScenario clears automatic in either state, and the eligibility check reads the flag when the presentation slot opens. I added a test for a manual join while the run waits for the slot. It fails on the old code.
|
|
||
| private async _setSectionExpanded(headerId: string, expanded: boolean): Promise<void> { | ||
| this._actionWidgetService.focusItemById(headerId); | ||
| await this._commandService.executeCommand(expanded ? 'expandSectionCodeAction' : 'collapseSectionCodeAction'); |
There was a problem hiding this comment.
Nit: ActionWidgetService already has collapseSection() and expandSection(). Exposing them on IActionWidgetService would avoid running the keybinding commands by id, and the new ICommandService dependency.
There was a problem hiding this comment.
Done in 29a0689. collapseSection() and expandSection() are now on IActionWidgetService, and the picker no longer depends on ICommandService.
- Return early from showSection when the step is cancelled while the previous menu closes or items load, so the menu no longer flashes open. - Add an optional close() to onboarding targets. Spotlight tours call it before a step for another element and when the tour ends, before the overlay restores focus, so the picker no longer takes focus from the tour. - Open each chat tour picker only once per step, so a selection that replaces the separate picker's trigger does not reopen its menu. - Keep the automatic flag on a run record shared by the queue and the in-flight run, so an explicit runScenario always clears it. - Expose collapseSection/expandSection on IActionWidgetService and drop the ICommandService dependency from the picker. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Logan Ramos (@lramos15) thanks for the second pass. All five threads are addressed in 29a0689. About your question on the experiment refetch change in the shared engine: the engine reads the flags again only for scenarios whose flags have not resolved yet. Once both flags resolve, the scenario's state stays fixed for the rest of the session, so a refetch cannot move an Agents window tour into or out of treatment mid-session. The only change for those tours is this: if their flags were missing at startup, they now resolve when that endpoint's assignments arrive, instead of staying inactive until the next reload. |
…ng-spotlight-tour # Conflicts: # src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatInputPicker.test.ts
…ng-spotlight-tour
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Adds an onboarding spotlight tour of the editor Chat input for new users of Copilot harness chats. It reuses the onboarding engine and spotlight primitives from the Agents window tours (
workbench/contrib/onboarding).Behavior
The tour can run when all of these are true:
onb.chatInputonboarding experiment shows it, oronboarding.developerModepreviewschat.onboarding.chatInput.chat.defaultToCopilotHarnessexperiment makes that harness the default.It has three steps, each described in no more than two short sentences:
The tour runs at most once per user. It is hidden when AI features are disabled (
ChatContextKeys.enabled), does not start while a modal editor is open, and ends if one opens. Local harness chats never show it.Implementation
chatOnboardingEligibility.ts:ChatOnboardingEligibility.eligibleChatis the visible Chat view showing a Copilot harness chat, when the user has never sent an editor chat message (the existingEditorChatUsagecounter). It follows session switches and becomes ineligible once the user sends a message. It is separate from the tour UI.chatInputSpotlightTour.ts: the tour scenario, its target providers, and the workbench contribution.experiment: { behaviorFlag: 'onb.chatInput.show', assignmentContextIdFlag: 'onb.chatInput.id' }, so the engine gates it and attaches theonb-assignment context from the moment the tour would show, in every arm.runScenarioso that a modal editor opening over it ends the tour.AgentHostChatInputPicker: owns the section switching.showSection(section, token)opens the menu on a section, or, if the combined menu is already open, collapses the other section and expands this one after a pause.menuElementreturns the open menu.ChatInputPart.getAgentHostPickerreturns a narrow view of the mode or permissions picker and drops disposed pickers. The model step uses the existinggetModelPickerControl().IOnboardingTarget.additionalElements(opt-in) highlights other elements with the target, such as the menu the mode button opens outside itself. The highlight covers them all, clicking the callout keeps focus in them so a menu that closes on blur stays open, Escape inside them is left to them, and the step is announced to screen readers because focus can move into them.IOnboardingTarget.openreceives the step's cancellation token, so work started byopenstops when the step ends.whenand trigger still hold. Otherwise it is dropped without being marked shown. This applies to every tour.IAssignmentService.onDidRefetchAssignments, which tas-client fires when a fetch replaces its assignments. That includes the first fetch from the GitHub Copilot ExP endpoint, which VS Code only learns from the signed-in account's entitlements after startup; before that, flags from that workspace read asundefined. Once both flags resolve, the arm is fixed for the window. A refetch during a read in flight reads again after that read settles. No timers.Caveat on the "never chatted" signal
chat.editorUsage.messageshas only been recorded since #336792 (about Sept 18). Users who chatted before then look new until they send their next message.ExP experiment
Chat: Onboarding tour for new Copilot harness users in the GitHub Copilot ExP workspace (
githubdevdiv~vscodecopilotchat), assigned bydevdeviceid. It moved from the legacyvscodeexpwsworkspace, where the old feature is now archived. Both experiments are created but not started. Start them after a Stable build with this change ships.onb.chatInput.show)onb-chat-input-aa-a(control,false) /onb-chat-input-aa-b(false)onb-chat-input-ab-none(control,false) /onb-chat-input-ab-spotlight(true)onb.chatInput.idto its own variant id. The engine requires theonb-prefix and keeps the assignment context out of telemetry until the user reaches the tour, so no separate trigger event is needed. Scorecards compare theonb-chat-input-*assignment contexts.extensionname IN ("vscode-core", "github.copilot-chat"); vscode_core_appversion >= 1.142.0; vscode_core_targetpopulation IN ("public"); vscode_core_windowkind IN ("editor"). Raisevscode_core_appversionif this ships later than 1.142.Validation
chatInputSpotlightTour.test.ts: readiness, targets, the experiment, combined and separate permission pickers, the step token reaching the picker, losing eligibility, and ending on a modal editor.chatOnboardingEligibility.test.ts: harness, visibility, session switches, the new-user check and bypass, and sending a message.agentHostChatInputPicker.test.ts:showSectionopening a section, moving between sections, ignoring a cancelled request, and handing off between separate pickers.onboardingService.test.ts: a queued automatic run that is no longer eligible is dropped without being marked shown, unresolved experiment flags are read again when assignments are refetched and then kept, and a refetch during a read in flight is not missed.spotlightOverlay.test.ts: highlighting additional elements, keeping focus in them, and leaving Escape and Tab inside them to them.typecheck-client, eslint, andbuild/hygiene.tspass.f88b5f41a02): the firstonb.chatInput.showread at 1.92s is unassigned, the GitHub endpoint answers at 2.35s, the refetch readstrue/onb-chat-input-ab-spotlightat 2.36s, and the tour runs without the user opening Chat.scenarioShownreports the active experiment and its assignment context.false/onb-chat-input-ab-none, no tour shows, and telemetry carriesonb-chat-input-ab-nonefrom the would-show moment.scenarioOutcomereportsabortedon step 3.Recording
Copilot harness with developer mode on
ee118845f05, recorded at 60fps.chat-onboarding-tour-proof.mp4