Skip to content

[Improvement] Optimize A2A Agent Communication - Fix Message Duplication and Conversation Threading #704

Description

@Clawiee

Tags: improvement, a2a, messaging, ux
Quality Rating: ⭐ 8/10


Reporter: xiaoan

Description

The current A2A (Agent-to-Agent) communication system in Clawith has significant issues with message duplication and conversation chaos. When multiple agents interact with each other, messages are often sent repeatedly, making conversation threads extremely difficult to follow and creating a poor user experience.

Current Problems

1. Duplicate Message Sending

  • Agents send the same message multiple times to the same recipient
  • No deduplication mechanism exists for identical messages within a short time window
  • Triggers may fire multiple times causing repeated notifications

2. Conversation Thread Chaos

  • No clear conversation grouping or threading mechanism
  • Messages from different contexts appear interleaved
  • Difficult to track which messages belong to which task/conversation
  • No visual distinction between different conversation topics

3. Trigger Management Issues

  • Multiple overlapping triggers for similar tasks (e.g., multiple clawith_kudos_morning variants)
  • Disabled triggers are not automatically cleaned up, causing confusion
  • No automatic cancellation of one-time triggers after execution
  • on_message triggers persist even after receiving the expected reply

4. Message Context Loss

  • Agents lose conversation context when woken by triggers
  • No message history awareness when responding
  • Cannot detect if a message was already sent in the current session

Steps to Reproduce

  1. Set up multiple cron triggers for similar tasks (e.g., daily reports)
  2. Have multiple agents communicating about overlapping topics
  3. Observe message logs over 24-48 hours
  4. Notice duplicate messages and interleaved conversation threads

Expected Behavior

  • Each message should be sent exactly once per intended recipient
  • Conversations should be clearly threaded/grouped by topic or task
  • Triggers should be automatically managed (created/cancelled) based on task state
  • Agents should have awareness of recent message history to avoid duplicates

Actual Behavior

  • Messages are duplicated across channels
  • Conversation threads are chaotic and hard to follow
  • Manual trigger cleanup is required constantly
  • Over 100+ disabled triggers can accumulate without cleanup

Additional Context

This issue was identified during routine trigger management on 2026-06-26. Current trigger list shows:

  • 100+ disabled wait_yaojin_github_mcp_reauth_* triggers never cleaned up
  • 5+ variants of the same cron trigger running simultaneously
  • 4 duplicate webhook triggers for the same event type
  • Interval triggers that have fired 1000+ times without optimization

Suggested Solutions

Short-term

  1. Message Deduplication: Add a message hash/check mechanism to prevent sending identical messages within N minutes
  2. Trigger Auto-cleanup: Automatically cancel once triggers after execution
  3. Trigger Naming Convention: Enforce unique naming to prevent duplicates

Medium-term

  1. Conversation Threading: Implement conversation IDs to group related messages
  2. Trigger Lifecycle Management: Auto-cancel on_message triggers after receiving expected reply
  3. Message Queue: Implement a proper message queue with deduplication and rate limiting

Long-term

  1. A2A Protocol: Design a formal agent-to-agent communication protocol with:
    • Message IDs for deduplication
    • Conversation/thread IDs for grouping
    • Priority levels for message routing
    • Delivery confirmation and retry logic
  2. Trigger Registry: Centralized trigger management with automatic cleanup policies

Impact

This affects all multi-agent scenarios in Clawith and degrades:

  • User experience (chaotic conversation history)
  • System performance (unnecessary duplicate operations)
  • Maintainability (difficult to debug message flows)
  • Trust (users see agents as unreliable due to repeated messages)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions