Repository navigation
sessions: add agent tools to read and organize the Sessions list - #343512
Merged
Benjamin Christopher Simmonds (benibenj) merged 3 commits intoOct 22, 2026
Merged
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
Conversation
Adds readSessionsList and organizeSessionsList client tools so agents in the Agents window can see the Sessions list as a tree with its view options, and create, nest, rename, reorder, collapse, and delete custom groups, move sessions between placements, and change grouping, sorting, and filters. Changes go through the same placement rules and undo affordances as drag and drop. The tools form the vscodeSessionsList client tool set, are deferred behind tool search on agent hosts, and are gated by the experiment-controlled sessions.list.agentTools.enabled setting (on by default). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Benjamin Christopher Simmonds (benibenj)
enabled auto-merge (squash)
October 22, 2026 14:26
Dirk Bäumer (dbaeumer)
previously approved these changes
Oct 22, 2026
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
getEdgeAnchor` picks “top/bottom” anchors by sorting candidates using the current sort key. That… · New The PR description says these tools “exist only in the Agents/Sessions window”, but the toolwhen… · New Callingview.sessionsControl.update()after every operation can become expensive for large… · New TheresetFiltersdescription says it resets “every filter and display option”, but the underlying… · New
What changed in this PR
Adds agent-facing client tools to programmatically read and batch-organize the Sessions list, aligning agent operations with existing UI drag/drop rules and undo behavior.
Changes:
- Introduces
readSessionsListandorganizeSessionsListtools plus avscodeSessionsListclient tool set. - Adds programmatic APIs to
SessionsList/SessionsViewfor snapshotting and list reorganization. - Adds new browser tests covering the tools and their availability behavior.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/browser/tools/toolSetsContribution.test.ts | Adds a test asserting Sessions-list tool set exposure is limited to the Sessions window. |
| src/vs/workbench/contrib/chat/browser/tools/clientToolSetsContribution.ts | Registers the new vscode-sessions-list dynamic tool set. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsViewMenu.test.ts | Updates tests to match the refactored reset-filters action wiring. |
| src/vs/sessions/contrib/sessions/test/browser/sessionsListTools.test.ts | Adds coverage for reading and organizing the Sessions list via tools. |
| src/vs/sessions/contrib/sessions/browser/views/sessionsView.ts | Exposes view state getters and promotes reset/show-archived/capping into public methods. |
| src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts | Adds tree snapshot + programmatic move/group/header APIs, reusing DnD placement logic. |
| src/vs/sessions/contrib/sessions/browser/sessionsListTools.ts | Implements readSessionsList and organizeSessionsList tools and their schemas. |
| src/vs/sessions/contrib/sessions/browser/sessions.contribution.ts | Registers tool contribution and adds the new experiment-controlled setting. |
| src/vs/sessions/common/sessionConfig.ts | Declares the sessions.list.agentTools.enabled setting key constant. |
| src/vs/sessions/SESSIONS_LIST.md | Documents the new agent tools and programmatic writer path. |
Review effort: Lite
…ession-management
Derive top/bottom anchors from the composed list, gate the tools to the Agents window, recompose a hidden list only before operations that read it, and describe exactly what resetFilters resets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Anthony Kim (anthonykim1)
approved these changes
Oct 22, 2026
Benjamin Christopher Simmonds (benibenj)
merged commit Oct 22, 2026
b81f5c0
into
main
59 checks passed
Benjamin Christopher Simmonds (benibenj)
deleted the
agents/client-tools-session-management
branch
October 22, 2026 15:33
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.


Adds two client tools so agents in the Agents window can do everything a user can do by hand in the Sessions list.
Tools
readSessionsList(read-only) reports the view options (grouping, sorting, archived visibility, section capping, compact, External section, every filter with its included state) and the list as a tree of sections, nested custom groups, and sessions. Headers use stable ids (pinned,archived,recent/older,workspace:…,repository:…,environment:…,group:<id>). Rows and sections that capping hides are listed withhidden: true, and the invoking session is markedcurrent: true. Each header lists up to 25 sessions unlessheaderIdasks for one header in full.organizeSessionsListapplies a batch ofoperationsin order and stops at the first failure:setView: grouping, sorting, filters, reset filters, show archived, sessions per section, compact, External sectioncreateGroup(optionally nested, with initial sessions, and akeythat later operations of the same call can reference),renameGroup,deleteGroupmoveSessions: topinned,archived,ungrouped, a group, or a section, positionedbefore/aftera session or at thetop/bottommoveHeader: nest groups and workspace/repository/environment sections, or reorder them among their siblings or at the top levelsetCollapsedDesign notes
SessionsListmethods that reuse the drag-and-drop placement logic (getSessionDropEffect,moveSessions, and the header-drop path, now shared asapplyHeaderDrop). Agent changes therefore follow the same placement precedence, comparison-group restrictions, date-section rules, and Undo notices as the UI.SessionsViewexposes its grouping, sorting, and compact state, and setters that keep the filter menu's checked state in sync.vscodeSessionsListclient tool set, so they reach agent hosts as client tools. There they are deferred behind tool search (defer: 'auto').sessions.list.agentTools.enabled(on by default), both through the tools'whenclause and at invocation.SESSIONS_LIST.mddocuments the new programmatic writer of list-owned state.Testing
./scripts/test.sh --run src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts --run src/vs/sessions/contrib/sessions/test/browser/sessionsViewPane.test.ts --run src/vs/sessions/contrib/sessions/test/browser/sessionsViewMenu.test.ts --run src/vs/sessions/contrib/sessions/test/browser/sessionsListTools.test.ts --run src/vs/workbench/contrib/chat/test/browser/tools/toolSetsContribution.test.ts --run src/vs/sessions/contrib/sessions/test/browser/sessions.contribution.test.ts: passed. The newsessionsListTools.test.tscovers reading the tree, batched nested group creation with keys, session reordering, view changes, stopping on failure, and the disabled setting.npm run typecheck-client: no errors in changed files. The local run reported unrelated errors in agent-host test files because the local Copilot SDK dependency is stale.npm run eslinton the changed files: passednpm run valid-layers-check: passedTo try it: in the Agents window, ask an agent to e.g. "group my sessions by topic into nested groups and sort by last updated".