OpenClaw Persistent Sub-Agent Sessions Broken: mode="session" + thread=true Circular Dependency
If your orchestrator agent can't spawn persistent sub-agent sessions โ the spawning call
hangs, returns an error, or the sub-agent never initializes โ you've likely hit issue
#67400. Combining mode="session" and thread=true creates a
circular dependency that prevents the session from being created. Here's the workaround.
What's Broken
In OpenClaw's sessions_spawn tool, using both mode="session"
(persistent session) and thread=true (bind to a channel thread) together
triggers a circular dependency in the session resolution logic. The session can't
initialize because each parameter depends on the other being resolved first.
Symptoms:
- Sub-agent spawn call hangs or times out
- Error in logs: session initialization failure or circular dependency reference
- The sub-agent appears briefly then disappears without completing initialization
- Orchestrator agent receives no session key back from the spawn call
Who's Affected
This primarily hits users building multi-agent Discord or Slack setups where the orchestrator spawns specialized sub-agents as persistent, thread-bound sessions. It's a common pattern for teams running agent orgs that report back in dedicated threads โ exactly the architecture OpenClaw's ACP harness is designed for.
Workaround #1 โ Use mode="run" Instead of mode="session"
If the sub-agent doesn't need to maintain persistent state across multiple calls,
switch to mode="run":
// Broken
sessions_spawn({
task: "...",
mode: "session",
thread: true,
runtime: "acp"
})
// Workaround
sessions_spawn({
task: "...",
mode: "run", // one-shot instead of persistent
thread: true,
runtime: "acp"
})
Trade-off: mode="run" sessions don't persist history. If your sub-agent
needs to remember context across calls, this workaround loses that.
Workaround #2 โ Create the Thread First, Then Spawn Without thread=true
Pre-create the thread manually, then spawn the sub-agent targeting that thread's
channel ID โ without passing thread=true:
// Step 1: Create thread via message tool
message({
action: "thread-create",
channel: "discord",
channelId: "YOUR_CHANNEL_ID",
threadName: "Agent Task Thread"
})
// Returns: threadId
// Step 2: Spawn sub-agent targeting the thread channel directly
sessions_spawn({
task: "...",
mode: "session",
runtime: "acp",
// pass channel context in task description instead of thread=true
})
This splits the two concerns โ thread creation and session persistence โ into separate steps, avoiding the circular dependency.
Workaround #3 โ Pin to 4.12 for Critical Multi-Agent Setups
If persistent thread-bound sub-agent sessions are core to your setup and neither workaround above works for your use case:
npm install -g openclaw@2026.4.12
openclaw gateway restart
4.12 predates the regression that introduced this circular dependency.
Status
Issue #67400 is open and marked as a regression. It's on the radar for the 4.15 stable release. Watch the issue for updates โ this is a common enough pattern that it should get prioritized.
TL;DR
mode="session"+thread=true= circular dependency = sub-agent spawn fails- Workaround A: use
mode="run"if persistence isn't required - Workaround B: pre-create the thread, then spawn without
thread=true - Workaround C: pin to 4.12 for critical setups
- Tracking: GitHub issue #67400
Building a multi-agent OpenClaw setup?
ClawReady has configured multi-agent architectures across dozens of setups โ we know the current bugs and stable patterns. Skip the debugging and get it right the first time.
Book a Free Call โ