Skip to content

Bug: Heartbeat 'session' target not working for non-main agents #21910

@enesyesilayx-coder

Description

@enesyesilayx-coder

Bug Report: Heartbeat session Target Not Working for Non-Main Agents

OpenClaw Version: 2026.2.19-2 (45d9b20)
Platform: macOS 26.2 (arm64)
Date: 2026-02-20

Summary

When configuring heartbeat.session to target a Discord channel for non-main agents, heartbeats do not fire. The same configuration works correctly for the main agent.

Configuration

{
  "agents": {
    "list": [
      {
        "id": "main",
        "name": "Kuki",
        "workspace": "/Users/yesilay/.openclaw/workspace",
        "heartbeat": {
          "every": "30m",
          "session": "discord:channel:1473606310695010463"
        }
      },
      {
        "id": "avci",
        "name": "Avcı",
        "workspace": "/Users/yesilay/.openclaw/workspace/agents/avci",
        "heartbeat": {
          "every": "1h",
          "session": "discord:channel:1473606349039599723"
        }
      },
      {
        "id": "arin",
        "name": "Arin",
        "workspace": "/Users/yesilay/.openclaw/workspace/agents/arin",
        "heartbeat": {
          "every": "10m",
          "session": "discord:channel:1473606609610739857"
        }
      }
    ]
  }
}

Expected Behavior

All agents should fire heartbeats to their configured Discord channels at the specified intervals.

Actual Behavior

  • Main agent (Kuki): ✅ Heartbeats fire correctly to Discord channel every 30 minutes
  • Non-main agents (Avcı, Leo, Yoda, Nova, Arin): ❌ Heartbeats do NOT fire to Discord channels
  • Last heartbeat timestamps show:
    • Kuki: Active (just now)
    • Arin: Last active 1+ hour ago (10-minute interval missed 6+ times)
    • Others: Similar pattern

Session Store Verification

Sessions exist in each agent's store file:

$ cat ~/.openclaw/agents/avci/sessions/sessions.json | jq 'keys'
["agent:avci:discord:channel:1473606349039599723"]

$ cat ~/.openclaw/agents/arin/sessions/sessions.json | jq 'keys'
["agent:arin:discord:channel:1473606609610739857"]

Log Evidence

Gateway logs show heartbeats being "started" but no evidence of them actually running for non-main agents after the initial startup:

2026-02-20T13:58:35.657Z [heartbeat] started
2026-02-20T13:58:36.776Z [discord] [arin] starting provider (@Arin)

No subsequent heartbeat runs logged for arin after 13:58 (current time is ~17:00+).

Analysis

From code inspection of health--JybOkd4.js:

  1. resolveHeartbeatSession() resolves the session key correctly:

    • discord:channel:XXXagent:{agentId}:discord:channel:XXX
  2. Session lookup: store[canonical] requires the session to exist in the store

    • Sessions DO exist (verified above)
  3. The heartbeat runner may be:

    • Silently skipping non-main agents
    • Failing to resolve the agent's store path correctly
    • Only processing the default/main agent in the heartbeat loop

Workaround

Using cron jobs to fire heartbeat prompts directly to Discord channels works:

openclaw cron add --name "avci-heartbeat-discord" \
  --schedule "0 * * * *" \
  --targetId "1473606349039599723" \
  --message "Read HEARTBEAT.md if it exists..."

Steps to Reproduce

  1. Configure multiple agents with heartbeat.session targeting Discord channels
  2. Restart gateway: openclaw gateway restart
  3. Wait for heartbeat intervals to pass
  4. Check openclaw system heartbeat last — only main agent appears
  5. Check agent sessions' updatedAt timestamps — non-main agents not updating

Environment

  • OS: macOS 26.2 (Sequel) arm64
  • Node: v25.4.0
  • Gateway: local, ws://127.0.0.1:18789
  • Discord: Multiple bot accounts (one per agent), all properly authenticated

Additional Context

This is a hub-and-spoke multi-agent setup with 6 agents:

  • main (Kuki) - orchestrator
  • avci - YouTube analytics
  • leo - Finance
  • yoda - Code
  • nova - Research
  • arin - System monitoring

All agents share the same Discord guild but have dedicated channels and bot tokens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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