Skip to content

sessions: add agent tools to read and organize the Sessions list - #343512

Merged
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
mainfrom
agents/client-tools-session-management
Oct 22, 2026
Merged

Benjamin Christopher Simmonds (benibenj) merged 3 commits into
mainfrom
agents/client-tools-session-management

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

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 with hidden: true, and the invoking session is marked current: true. Each header lists up to 25 sessions unless headerId asks for one header in full.
  • organizeSessionsList applies a batch of operations in order and stops at the first failure:
    • setView: grouping, sorting, filters, reset filters, show archived, sessions per section, compact, External section
    • createGroup (optionally nested, with initial sessions, and a key that later operations of the same call can reference), renameGroup, deleteGroup
    • moveSessions: to pinned, archived, ungrouped, a group, or a section, positioned before/after a session or at the top/bottom
    • moveHeader: nest groups and workspace/repository/environment sections, or reorder them among their siblings or at the top level
    • setCollapsed

Design notes

  • Changes go through new SessionsList methods that reuse the drag-and-drop placement logic (getSessionDropEffect, moveSessions, and the header-drop path, now shared as applyHeaderDrop). Agent changes therefore follow the same placement precedence, comparison-group restrictions, date-section rules, and Undo notices as the UI. SessionsView exposes its grouping, sorting, and compact state, and setters that keep the filter menu's checked state in sync.
  • The tools form the Agents-window-only vscodeSessionsList client tool set, so they reach agent hosts as client tools. There they are deferred behind tool search (defer: 'auto').
  • They are gated by the new experiment-controlled setting sessions.list.agentTools.enabled (on by default), both through the tools' when clause and at invocation.
  • SESSIONS_LIST.md documents 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 new sessionsListTools.test.ts covers 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 eslint on the changed files: passed
  • npm run valid-layers-check: passed

To 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".

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>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 14:26

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.

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
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 readSessionsList and organizeSessionsList tools plus a vscodeSessionsList client tool set.
  • Adds programmatic APIs to SessionsList/SessionsView for 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

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>
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: a70aac7d Current: 96b49938

Changed (1)

sessions/artifactDetails/CommentsInformation/Light
Before After
before after

@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit b81f5c0 into main Oct 22, 2026
59 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the agents/client-tools-session-management branch October 22, 2026 15:33
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 22, 2026
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.

4 participants