Skip to content

agentHost: don't route client tools of a moved chat to clients of its old session - #346718

Merged
Bhavya U (bhavyaus) merged 2 commits into
mainfrom
bhavyaus/moved-chat-client-owner
Nov 7, 2026
Merged

Bhavya U (bhavyaus) merged 2 commits into
mainfrom
bhavyaus/moved-chat-client-owner

Conversation

@bhavyaus

Copy link
Copy Markdown
Collaborator

Fixes #346456

When a running chat is moved to another session (for example with move_session), its runtime keeps picking client tool owners from the session it launched in. The destination session's active-client state doesn't know the moved chat yet, and unknown chats are treated as reachable by every client, so client tool calls in the moved chat were still assigned to a window that never subscribed to the destination session. That window only sees the request once it opens the moved chat, so the turn stalls on "Running Search tools on another client…".

For a moved chat (current owner differs from the launch owner):

  • only clients the destination has published membership for are eligible owners, and
  • candidates and their tool definitions are read from the destination's tool set.

Until a window joins the destination, tool search runs on the host (#346713) and other client tools fail immediately instead of hanging. Once a window opens the moved chat, client tools route to it as before. Chats that never moved are unchanged.

… old session

After a running chat moved to another session, the destination's active-client
state did not know the chat yet, and unknown chats are treated as reachable by
every client. Client tool calls in the moved chat were therefore still assigned
to a window that never subscribed to the destination session, so the call
waited until that window opened the moved chat.

For a moved chat, only admit clients the destination has published membership
for, and pick candidates from the destination's tool set. Until a window joins
the destination, tool search runs on the host and other client tools fail
immediately instead of hanging.

Fixes #346456

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 7, 2026 02:54
@bhavyaus
Bhavya U (bhavyaus) enabled auto-merge (squash) November 7, 2026 02:55

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.

🟡 Changes recommended

The moved-chat routing change lacks regression coverage for fallback and failure before destination membership is published, followed by routing exclusively to destination clients advertising the requested tool.

1 open issue
What changed in this PR

This PR addresses client-tool stalls after a live chat moves between Agent Host sessions by selecting tool owners from the destination rather than the launch session.

Changes:

  • Reads client candidates and tool definitions from the destination session’s registry.
  • Requires published destination membership before routing moved-chat tools, allowing host search fallback or immediate failure when no client qualifies.
  • Preserves routing behavior for chats that have not moved.
File Description
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Adds a dynamic tool-registry callback used during client-tool owner selection.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Resolves the current owner’s registry and enforces destination membership for moved chats.

Review effort: Balanced

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.

🟢 Approval recommended

No active review issues are reported for the moved-chat client-tool routing change.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@bhavyaus
Bhavya U (bhavyaus) merged commit c0673ca into main Nov 7, 2026
53 checks passed
@bhavyaus
Bhavya U (bhavyaus) deleted the bhavyaus/moved-chat-client-owner branch November 7, 2026 05:35
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 7, 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.

Agents Window: tool search stays stuck on another client after a live chat move

3 participants