openclaw - 💡(How to fix) Fix sessions_send A2A flow ping-pong causes duplicate messages in persistent sessions [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62872Fetched 2026-04-09 08:01:26
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Root Cause

The sessions_send tool triggers a three-stage A2A flow:

Fix Action

Fix / Workaround

Current Workarounds

RAW_BUFFERClick to expand / collapse

sessions_send A2A flow ping-pong causes duplicate messages in persistent sessions

Problem Description

When using sessions_send for inter-agent communication in persistent sessions, the Agent-to-Agent (A2A) flow includes a ping-pong mechanism that causes duplicate messages to appear in both sessions.

Root Cause Analysis

The sessions_send tool triggers a three-stage A2A flow:

Stage 1: Normal Ping-Pong Reply

  • Message sent from Session A to Session B
  • Session B replies inline → This works correctly ✅

Stage 2: Announce Step (Automatic Trigger)

  • OpenClaw automatically injects an "Agent-to-agent announce step." message into Session B
  • Session B sees this message and generates a reply
  • This reply gets marked with sourceTool: "sessions_send"
  • Because of the sourceTool marker, this reply gets routed back to Session A ❌

Stage 3: Delivery

  • The announce reply is also delivered to Session B's external channels ✅

Why This Causes Duplicates

  1. Normal communication: Session A → Session B → Session A (1 cycle, expected)
  2. A2A flow artifacts: Session A → Session B → [announce step] → Session B → [reply marked as sessions_send] → Session A (creates 3 duplicate messages)

The ping-pong mechanism (default maxPingPongTurns = 5) alternates between sessions, injecting messages that persist and get delivered as new user messages.

Evidence from Session Analysis

  • Duplicate messages appear with sourceTool: "sessions_send"
  • Messages originate from runAgentStep calls during ping-pong phase
  • Issue occurs specifically with persistent sessions (not subagents)
  • Luke's AGENTS.md lacks ANNOUNCE_SKIP but the ping-pong is framework-level behavior

Current Workarounds

None effective - the ping-pong cannot be disabled through sessions_send parameters as maxPingPongTurns is an internal default.

Expected Behavior

When sessions_send is used for persistent-to-persistent communication, only the direct message and its inline reply should appear. No additional framework-generated messages should be injected.

Proposed Solutions

Short-term: Expose ping-pong control

Add maxPingPongTurns parameter to sessions_send API to disable ping-pong when needed.

Long-term: Context-aware A2A flow

Distinguish between subagent notifications (where ping-pong makes sense) and persistent session communication (where it doesn't).

Impact

  • High: Causes confusion in inter-agent communication
  • Medium: Pollutes session history with framework artifacts
  • Low: Performance impact from unnecessary message routing

Environment

  • OpenClaw version: Current (confirmed in session 33fd5149-ad5a-4f99-a10e-2feb7671b325)
  • Session type: Persistent sessions
  • Reproducible: Yes, consistent behavior

extent analysis

TL;DR

Disable the ping-pong mechanism in the sessions_send API to prevent duplicate messages in persistent sessions.

Guidance

  • Identify the maxPingPongTurns parameter as the potential cause of the issue and consider exposing it in the sessions_send API to allow for disabling the ping-pong mechanism.
  • Verify that the duplicate messages are indeed caused by the ping-pong mechanism by checking for the sourceTool: "sessions_send" marker in the message headers.
  • Consider implementing a context-aware A2A flow that distinguishes between subagent notifications and persistent session communication to prevent unnecessary framework-generated messages.
  • Test the proposed solution in a controlled environment to ensure it resolves the issue without introducing new problems.

Example

No code snippet is provided as the issue does not include specific code examples, but the solution may involve modifying the sessions_send API to accept a maxPingPongTurns parameter, e.g., sessions_send(maxPingPongTurns=0).

Notes

The proposed solution assumes that exposing the maxPingPongTurns parameter will allow for disabling the ping-pong mechanism, but this may require further testing and validation. Additionally, the long-term solution of implementing a context-aware A2A flow may require significant changes to the underlying framework.

Recommendation

Apply a workaround by exposing the maxPingPongTurns parameter in the sessions_send API, as this is a shorter-term solution that can potentially resolve the issue without requiring significant changes to the framework.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING