fix(agent): reject send tool when targeting the same conversation

Pass replyTarget through the full pipeline (ChatRequest → gateway
identity → agent headers → MCP session) so the send tool can detect
when the destination matches the current conversation and return an
error guiding the agent to reply directly instead.
This commit is contained in:
Acbox
2026-03-11 16:59:42 +08:00
parent a2e5c4f893
commit 30653fbdbf
8 changed files with 40 additions and 2 deletions
+2
View File
@@ -161,6 +161,7 @@ type gatewayIdentity struct {
ChannelIdentityID string `json:"channelIdentityId"`
DisplayName string `json:"displayName"`
CurrentPlatform string `json:"currentPlatform,omitempty"`
ReplyTarget string `json:"replyTarget,omitempty"`
ConversationType string `json:"conversationType,omitempty"`
SessionToken string `json:"sessionToken,omitempty"` //nolint:gosec // intentional: session token forwarded to agent gateway for channel reply routing
}
@@ -470,6 +471,7 @@ func (r *Resolver) resolve(ctx context.Context, req conversation.ChatRequest) (r
ChannelIdentityID: strings.TrimSpace(req.SourceChannelIdentityID),
DisplayName: displayName,
CurrentPlatform: req.CurrentChannel,
ReplyTarget: strings.TrimSpace(req.ReplyTarget),
ConversationType: strings.TrimSpace(req.ConversationType),
SessionToken: req.ChatToken,
},