fix(spawn): allow mode="session" without thread=true for headless persistent sessions#105
Open
BingqingLyu wants to merge 2 commits into
Open
fix(spawn): allow mode="session" without thread=true for headless persistent sessions#105BingqingLyu wants to merge 2 commits into
BingqingLyu wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mode="session"whenthread=truewas not set in bothsessions_spawn(subagent) and ACP spawn pathsthread=trueis passed, it still attempts platform thread binding as beforeProblem
sessions_spawnwithmode: "session"was hardcoded to requirethread: true. Since thread binding currently only works on Discord (viasubagent_spawninghooks), 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 bothsubagent-spawn.tsandacp-spawn.ts. Session persistence and thread binding are independent concepts:mode: "session") — session stays alive to receive announces andsessions_sendthread: true) — routes platform thread I/O to the session (Discord/Slack feature)The rest of the code already handles the
thread=falsecase correctly — thread binding is only attemptedif (requestThreadBinding)at line 449.Fixes openclaw#23414
Test plan
mode="session"withoutthread=trueproceeds without errormode: "session"on Telegram — should succeedmode: "session", thread: trueon Discord — should still work as before🤖 Generated with Claude Code