openclaw - ✅(Solved) Fix [Bug]: subagents.allowAgents not enforced on sessions_spawn — agents can spawn any agentId regardless of allowlist [1 pull requests, 1 comments, 2 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#72827Fetched 2026-04-28 06:31:50
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1cross-referenced ×1

subagents.allowAgents in openclaw.json is not validated by the gateway on sessions_spawn calls. An agent can spawn any agentId — including ones not in its allowlist — and the gateway tracks the spawn without rejecting it.

Error Message

Gateway rejects sessions_spawn with a policy error when the requested agentId is not in the caller's subagents.allowAgents list.

Root Cause

subagents.allowAgents in openclaw.json is not validated by the gateway on sessions_spawn calls. An agent can spawn any agentId — including ones not in its allowlist — and the gateway tracks the spawn without rejecting it.

Fix Action

Fixed

PR fix notes

PR #72838: fix(agents): enforce explicit subagent allowlist self-spawns

Description (problem / solution / changelog)

Summary

  • enforce subagents.allowAgents whenever sessions_spawn receives an explicit agentId, including explicit same-agent spawns
  • keep implicit same-agent spawns working without requiring the requester to list itself
  • add regression coverage for explicit self-spawn denial

Fixes #72827.

Tests

  • pnpm test src/agents/subagent-spawn.test.ts
  • pnpm check:changed

Notes

  • Local commands warn that this shell is on Node v20.19.2 while the repo wants Node >=22.14.0; the targeted test and changed gate still passed.

Changed files

  • src/agents/subagent-spawn.test.ts (modified, +39/-0)
  • src/agents/subagent-spawn.ts (modified, +1/-1)

Code Example

// task-manager agent entry in openclaw.json
"subagents": {
  "allowAgents": ["planner", "coder", "checker", "websearch", "memory-manager"]
}
RAW_BUFFERClick to expand / collapse

Summary

subagents.allowAgents in openclaw.json is not validated by the gateway on sessions_spawn calls. An agent can spawn any agentId — including ones not in its allowlist — and the gateway tracks the spawn without rejecting it.

Reproduction

Config:

// task-manager agent entry in openclaw.json
"subagents": {
  "allowAgents": ["planner", "coder", "checker", "websearch", "memory-manager"]
}

task-manager is not in its own allowAgents list. Despite this, a running task-manager session successfully called sessions_spawn(agentId: "task-manager") and spawned a second task-manager. The gateway assigned a spawnedBy field pointing to the caller — confirming the spawn went through the gateway and was not a bypass.

Expected

Gateway rejects sessions_spawn with a policy error when the requested agentId is not in the caller's subagents.allowAgents list.

Actual

Spawn succeeds. allowAgents is stored in config but not checked at spawn time.

Impact

  • Topology constraints are advisory only — any agent can spawn any other agent
  • Depth management can be undermined (e.g. task-manager spawning task-manager pushes pipeline to depth 3, hitting maxSpawnDepth and forcing fallback to Agent tool which loses parallelism and session tracking)
  • allowAgents config gives false confidence that spawn policy is enforced

Environment

OpenClaw gateway, observed on v4.24+. spawnedBy field in sessions_list output confirms gateway awareness of the spawn.

extent analysis

TL;DR

The gateway should validate the subagents.allowAgents configuration in openclaw.json to prevent unauthorized agent spawns.

Guidance

  • Review the openclaw.json configuration to ensure that each agent's allowAgents list is correctly populated and validated.
  • Verify that the gateway is properly checking the allowAgents list during sessions_spawn calls by testing with different agent IDs.
  • Consider adding additional logging or monitoring to detect and alert on unauthorized spawn attempts.
  • Check the OpenClaw gateway documentation for any updates or patches related to agent spawn policy enforcement.

Example

No code snippet is provided as the issue is related to configuration and policy enforcement rather than code implementation.

Notes

The issue appears to be specific to OpenClaw gateway version 4.24+, and the solution may involve updating the gateway configuration or applying a patch.

Recommendation

Apply a workaround by manually validating the allowAgents list for each agent and ensuring that the gateway is properly configured to enforce spawn policies, as a permanent fix may require an update to the OpenClaw gateway.

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

openclaw - ✅(Solved) Fix [Bug]: subagents.allowAgents not enforced on sessions_spawn — agents can spawn any agentId regardless of allowlist [1 pull requests, 1 comments, 2 participants]