Skip to content

[Bug]: Gateway announcement delivery loop - infinite retries of completed subagent announcements #18264

@jmfraga

Description

@jmfraga

Summary

Gateway repeatedly delivers the same subagent completion announcement 100+ times over hours, despite the announcement having already been delivered successfully. The loop continues even after the source cron job is disabled/deleted, and only stops when gateway is restarted.

Steps to reproduce

  1. Create cron with sessionTarget: "isolated", payload.kind: "agentTurn", delivery: { mode: "announce" }
  2. Cron spawns subagent (e.g., Atlas) via sessions_spawn
  3. Subagent completes successfully
  4. Observe gateway logs: same announcement delivered repeatedly every ~60s

Expected behavior

  1. Subagent completes task
  2. Gateway delivers "subagent completed" announcement to parent agent once
  3. Parent agent processes announcement
  4. Delivery marked as complete
  5. Announcement expires/is cleaned up

Actual behavior

  1. Subagent completes task
  2. Gateway delivers "subagent completed" announcement to parent agent
  3. Parent agent processes announcement successfully
  4. Gateway delivers the SAME announcement again after ~60s
  5. Loop continues indefinitely (100+ deliveries over 3+ hours)
  6. Disabling/deleting source cron does NOT stop the loop
  7. Only gateway restart stops the loop

OpenClaw version

2026.2.14

Operating system

raspberry pi5

Install method

npm global

Logs, screenshots, and evidence

**Session transcript:** `agent:iris-assistant:cron:0b6f1aa8-2ffb-49e9-8d5c-89018bfad3b1` (session ae9b626a)

**Timeline:**
- 07:05:03 - Iris spawns Atlas
- 07:05:27 - Iris completes task, sends WhatsApp message ✅
- 07:05:31 - **First duplicate announcement**
- 07:05:31-10:32 - **100+ duplicate announcements** (same content, ~60s interval)
- 10:32:00 - Gateway restart stops loop

Impact and severity

Impact

  • Gateway resources consumed by infinite announcement retry
  • Log spam (1000+ lines for single incident)
  • Cron appears "stuck" to users/monitoring
  • Requires manual gateway restart to resolve

Root Cause Hypothesis

Gateway announcement delivery system lacks:

  1. Idempotency check - no tracking of which announcements have been delivered
  2. Delivery confirmation - no acknowledgment when parent agent processes announcement
  3. Expiration logic - announcements never expire, even when stale

Proposed Fix

Add to Gateway announcement delivery:

// Before delivering announcement
if (await wasAlreadyDelivered(announcement.id)) {
  await expireAnnouncement(announcement.id);
  return; // Skip delivery
}

// After successful delivery
await markAnnouncementAsDelivered(announcement.id);

// Periodic cleanup
await expireStuckAnnouncements({ olderThan: '5m' });


### Additional information

Workaround

Avoid delivery: { mode: "announce" } in crons that spawn subagents until this is fixed. Use sessions_send from parent agent instead (manual delivery).

Related Issues

 Possibly related to cron jobs message delivery issues
 May explain other "stuck cron" reports in community

Additional Context

 Parent agent (Iris) correctly handled all 100+ duplicates by filtering with NO_REPLY
 The subagent task itself completed successfully
 This is NOT a bug in the parent agent or subagent - they work correctly
 Bug is purely in Gateway's announcement queueing/delivery mechanism

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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