-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
A2A sessions_send: target agent can call sessions_send back, causing duplicate messages #39476
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Summary
When Agent A calls
sessions_sendto Agent B, Agent B can usesessions_sendto call back to Agent A with its response. This causes duplicate messages in the requester's channel:sessions_sendtool returnsprimaryReply→ Agent A posts itsessions_sendback to Agent A → Agent A posts it again (different wording, same content)Additionally, the ping-pong mechanism re-injects the
primaryReplyinto the requester's session, which can also trigger a second post.Steps to Reproduce
sessions_send(agentId: "agentB", message: "...")requesterSessionKeyin its A2A context and decides to callsessions_sendback to Agent A with a detailed reportsessions_sendmessageExpected Behavior
The target agent should not be able to call
sessions_sendback to the requester during A2A processing. The A2A flow already handles result delivery via the tool return value.Proposed Fix
Two options (not mutually exclusive):
Option A: Disable
sessions_sendfor target during A2A processing (recommended)When
runSessionsSendA2AFlowinvokesrunAgentStepon the target, temporarily remove or disable thesessions_sendtool from the target's available tools. This is a code-level guard that's 100% reliable.Option B: Don't expose
requesterSessionKeyin A2A contextIn
buildAgentToAgentMessageContext, stop includingparams.requesterSessionKey. The target agent doesn't need to know the requester's session key — it just needs to respond normally in its own session. Removing the key eliminates the most direct path for reverse calls (though the agent could still useagentId).Current Workaround
We added two dist patches:
roundOneReplyexists and requester is on a non-webchat channel — prevents ping-pong duplicationbuildAgentToAgentMessageContextadding "Do NOT use sessions_send to reply" — ~90% effective at preventing reverse callsEnvironment
Related Issues