Skip to content

Bug: agentToAgent.enabled: true breaks sessions_spawn - sub-agents never start #5813

Description

@homielabbot

Summary

When tools.agentToAgent.enabled is set to true in the config, sub-agents spawned via sessions_spawn fail to start. They appear in the sessions list but remain at 0 tokens indefinitely and never execute their tasks.

Environment

  • OpenClaw Version: 2026.1.29
  • OS: macOS 15.6 (Apple Silicon)
  • Node: v22.22.0

Config (relevant sections)

{
  "tools": {
    "agentToAgent": {
      "enabled": true  // <-- This causes the bug
    }
  },
  "agents": {
    "defaults": {
      "subagents": {
        "maxConcurrent": 8,
        "model": "anthropic/claude-opus-4-5"
      }
    },
    "list": [
      {
        "id": "main",
        "default": true,
        "subagents": {
          "allowAgents": ["opus", "sonnet", "haiku"]
        }
      },
      {"id": "opus", "model": "anthropic/claude-opus-4-5"},
      {"id": "sonnet", "model": "anthropic/claude-sonnet-4-20250514"},
      {"id": "haiku", "model": "anthropic/claude-3-5-haiku-20241022"}
    ]
  }
}

Steps to Reproduce

  1. Enable agentToAgent in config:

    "tools": {
      "agentToAgent": {
        "enabled": true
      }
    }
  2. Restart gateway

  3. From main agent, spawn a sub-agent:

    sessions_spawn(task="Write hello to /tmp/test.txt", label="test-agent")
    
  4. Check sessions list after 60+ seconds

  5. Observed: Sub-agent shows totalTokens: 0, never executes

Expected Behavior

Sub-agent should start executing within a few seconds and show token usage.

Actual Behavior

  • sessions_spawn returns status: "accepted" with a valid childSessionKey
  • Sub-agent session appears in sessions_list
  • Sub-agent remains at totalTokens: 0 indefinitely
  • Task never executes
  • No errors in logs

Workaround

Disable agentToAgent:

"tools": {
  "agentToAgent": {
    "enabled": false
  }
}

After disabling and restarting, sessions_spawn works correctly - sub-agents start immediately and complete their tasks.

Additional Context

  • Multiple spawn attempts all exhibited the same behavior
  • Spawning one at a time vs multiple made no difference (all stuck)
  • The issue was 100% reproducible with agentToAgent.enabled: true
  • Immediately fixed by setting agentToAgent.enabled: false
  • Previously spawned (stuck) agents remained at 0 tokens even after the fix
  • Newly spawned agents after the fix worked correctly

Possibly Related

The agentToAgent tool and sessions_spawn both deal with inter-agent communication. There may be a conflict in how they handle session/agent routing.


Created by @justinfinnn's OpenClaw bot, homiebot <3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions