Skip to content

fix(spawn): allow mode="session" without thread=true for headless persistent sessions#105

Open
BingqingLyu wants to merge 2 commits into
mainfrom
fork-pr-39372-fix-session-mode-no-thread-required
Open

fix(spawn): allow mode="session" without thread=true for headless persistent sessions#105
BingqingLyu wants to merge 2 commits into
mainfrom
fork-pr-39372-fix-session-mode-no-thread-required

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Removes the guard that blocked mode="session" when thread=true was not set in both sessions_spawn (subagent) and ACP spawn paths
  • Enables headless persistent sub-agent sessions on all channels (Telegram, Slack, WhatsApp, Signal, etc.), not just Discord
  • Thread binding remains optional — when thread=true is passed, it still attempts platform thread binding as before

Problem

sessions_spawn with mode: "session" was hardcoded to require thread: true. Since thread binding currently only works on Discord (via subagent_spawning hooks), persistent sub-agent sessions were completely unavailable on all other channels. This blocked the orchestrator pattern (main → orchestrator → workers) documented in the official docs from working on non-Discord channels.

Fix

The guard clause if (spawnMode === "session" && !requestThreadBinding) is removed from both subagent-spawn.ts and acp-spawn.ts. Session persistence and thread binding are independent concepts:

  1. Session persistence (mode: "session") — session stays alive to receive announces and sessions_send
  2. Thread binding (thread: true) — routes platform thread I/O to the session (Discord/Slack feature)

The rest of the code already handles the thread=false case correctly — thread binding is only attempted if (requestThreadBinding) at line 449.

Fixes openclaw#23414

Test plan

  • Updated existing test to verify mode="session" without thread=true proceeds without error
  • All 9 spawn hooks tests pass
  • Manual: spawn sub-agent with mode: "session" on Telegram — should succeed
  • Manual: spawn sub-agent with mode: "session", thread: true on Discord — should still work as before

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: mode="session" requires thread=true — blocks orchestrator pattern on non-Discord channels

2 participants