Skip to content

Agents: allow nesting a session whose default chat ran subagents - #343216

Merged
Sandeep Somavarapu (sandy081) merged 1 commit into
mainfrom
agents/nest-session-with-subagents
Oct 21, 2026
Merged

Sandeep Somavarapu (sandy081) merged 1 commit into
mainfrom
agents/nest-session-with-subagents

Conversation

@sandy081

Copy link
Copy Markdown
Member

Addresses the unaddressed Copilot review comment on #342546.

canMoveSessionUnder required chats.length === 1, but a session's chat list also holds the subagent (tool-origin) chats its default chat started. So a session that had run a subagent was not offered as a nest drop in the Agents window, and moveSessionUnder refused it locally. The host already allows this: it moves the default chat's whole subtree and leaves tool chats out of the single-chat check. The client now counts only non-tool chats.

Test: the existing nest-eligibility test now includes a session with a default chat plus a subagent chat. It is eligible once the host can move sessions. With the old code, the test fails.

Validation

  • ./scripts/test.sh --run …/localAgentHostSessionsProvider.test.ts --run …/sessionsList.test.ts: 815 passing, 0 failing
  • Mutation check (old condition restored): the new case fails
  • npm run eslint on the changed files: clean; hygiene (pre-commit): passed

canMoveSessionUnder counted subagent (tool-origin) chats, so a session with only its default chat plus that chat's subagents was not offered as a nest drop and moveSessionUnder refused it locally. The host already moves the default chat's subtree and excludes tool chats from the single-chat check, so count only non-tool chats.

Addresses the review comment on #342546.

Co-authored-by: Copilot <[email protected]>
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.144.0 milestone Oct 21, 2026
Copilot AI balanced review requested due to automatic review settings October 21, 2026 13:04

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

1 open issue
What changed in this PR

Adjusts session nest-drop eligibility so sessions remain nestable even when their default chat spawned subagent/tool chats, matching host behavior.

Changes:

  • Update canMoveSessionUnder to ignore tool-origin chats when determining “single-chat” sessions.
  • Extend the existing nest-eligibility test to cover a session with a default chat plus a subagent/tool chat.
File Description
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​localAgentHostSessionsProvider.test.ts Adds a test case to ensure sessions with subagent/tool chats are still eligible for nesting.
src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​baseAgentHostSessionsProvider.ts Changes eligibility logic to count only non-tool chats as “chats” for nesting.

Review effort: Lite

// Subagent chats don't count: the host moves them with the default chat that started them.
return !!cached && !!connection && supportsAgentHostSessionMove(connection.initializeResult.get())
&& !cached.isArchived.get() && cached.chats.get().length === 1;
&& !cached.isArchived.get() && cached.chats.get().filter(chat => chat.origin?.kind !== ChatOriginKind.Tool).length === 1;
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