You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sessions: let remote message recipients reply to the exact sender - #350508
When a chat receives a message through send_remote_message, it had no way to reply to the exact chat that sent it. get_current_session and get_session_context did not show a sender, and session: "origin" only addresses the chat that created the session. Messages already carry the sender in their delegation metadata (vscode.chat.delegation), so this change exposes it without changing the host protocol.
Changes
send_remote_message accepts session: "sender". It replies to the chat whose message started the calling chat's current turn. The address is read from that turn's message, so a later message from another chat cannot redirect the reply. A sender on the same host is mapped to its host-qualified session. If the current turn was not started by another chat, the call fails with an error.
get_session_context reports from: { chat, replyWith } for each agent-sent turn.chat is an exact reference to the sending chat, including nested chats. replyWith names the tool that accepts it: send_message for a sender on the same host, send_remote_message otherwise. Because the sender is reported per turn, a later turn can still reply to an earlier sender, as in the A → B → C → B → A chain.
readAgentMessageSender only reads agent- or tool-authored messages, and reuses the address validation that origin already uses. It does not use prompt text or other _meta fields.
The sender reference is only an address. Replies still go through the existing resolution, approval and workspace-trust checks, and origin behaves as before.
Updated the model-facing tool descriptions and the Remote delegation section of src/vs/sessions/SESSIONS.md.
send_remote_message accepts session "sender", resolved from the delegation metadata of the message that started the calling chat's current turn. get_session_context reports each agent-sent turn's sender as `from` with the tool that replies to it. Both reuse the existing delegation metadata and origin validation; approval, trust and origin semantics are unchanged.
Fixes#349566
Co-authored-by: Copilot <[email protected]>
Extends Agent Host messaging in the Agents Window so recipients can reply to the exact sending chat, rather than only the session’s creator, without changing the host protocol.
Changes:
Adds session: "sender" resolution using the message that started the current turn.
Exposes per-turn from.chat and replyWith fields through get_session_context.
Adds reply-chain and sender-validation tests, and updates tool guidance and documentation.
File
Description
src/vs/sessions/SESSIONS.md
Documents turn-bound sender replies and existing permission checks.
Sender references now carry the complete recorded chat resource in an open link, so replies reach the recorded chat even when short chat ids collide and session URIs have an authority, query or fragment. Host-qualified senders are recognized by scheme alone. send_message accepts an exact match to the recorded default chat before searching a possibly stale listing.
Co-authored-by: Copilot <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Reply routing still fails for cloud-task sender aliases, recorded default chats with stale catalog entries, and nested-chat calls rendered in a parent, requiring targeted fixes and round-trip tests.
Messages from connected Cloud tasks record a cloud-sandbox-task:/… sender, but this classifies that frontend alias as same-host. As a result, get_session_context recommends send_message with an unresolvable native session, and session: "sender" looks up the alias on the recipient's host and fails. Recognize CLOUD_SANDBOX_TASK_SCHEME as a window-qualified sender address without relaxing creator-origin validation, and add a cloud-task reply round-trip test.
Use the originating chat for nested remote replies
When a nested chat's tool call is rendered in its parent, SendRemoteMessageTool passes the rendering chat to the router, so this reads the parent's turn. session: "sender" then fails for a user-started parent turn or replies to the parent's sender instead of the nested chat's sender. Use the dispatcher's originatingChatResource for source selection in both preparation and invocation, retain the rendering context for approval, and cover a parent-rendered child call.
getSessionChatResource now accepts an exact match to the recorded default chat, so remote resolution and admission reach a sender whose default chat was recreated while its catalog entry is stale. A missing peer chat still fails without falling back. Update the Copilot prompt snapshots for the get_session_context description.
Co-authored-by: Copilot <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Registered Cloud-task senders are misclassified as same-host, breaking session: "sender" resolution and causing get_session_context to recommend the wrong reply tool.
A Cloud task records its window alias as the sending session, so it is now a window-qualified sender that send_remote_message resolves, rather than a same-host session. The creator-origin validator is unchanged. send_remote_message now takes its calling chat from the dispatcher's originating chat, so a nested chat's call rendered in its parent records and replies to the nested chat's sender.
Co-authored-by: Copilot <[email protected]>
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
agent-hostIssues for the agent-host implementation (not the protocol)agents-windowremote-session-toolsIssues related to Agents Window tools for managing sessions on remote Agent Hosts
2 participants
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.
Fixes #349566
When a chat receives a message through
send_remote_message, it had no way to reply to the exact chat that sent it.get_current_sessionandget_session_contextdid not show a sender, andsession: "origin"only addresses the chat that created the session. Messages already carry the sender in their delegation metadata (vscode.chat.delegation), so this change exposes it without changing the host protocol.Changes
send_remote_messageacceptssession: "sender". It replies to the chat whose message started the calling chat's current turn. The address is read from that turn's message, so a later message from another chat cannot redirect the reply. A sender on the same host is mapped to its host-qualified session. If the current turn was not started by another chat, the call fails with an error.get_session_contextreportsfrom: { chat, replyWith }for each agent-sent turn.chatis an exact reference to the sending chat, including nested chats.replyWithnames the tool that accepts it:send_messagefor a sender on the same host,send_remote_messageotherwise. Because the sender is reported per turn, a later turn can still reply to an earlier sender, as in the A → B → C → B → A chain.readAgentMessageSenderonly reads agent- or tool-authored messages, and reuses the address validation thatoriginalready uses. It does not use prompt text or other_metafields.originbehaves as before.src/vs/sessions/SESSIONS.md.