fix(agent): align subagent lifecycle with openclaw

This commit is contained in:
yushen 2026-02-03 17:22:41 +08:00
parent 1cd778b845
commit 30f23459ce
2 changed files with 11 additions and 7 deletions

View file

@ -100,6 +100,10 @@ export function createSessionsSpawnTool(
model,
});
// Write the task to the child (non-blocking) before registering,
// so waitForIdle() observes the queued work.
childAgent.write(task);
// Register the run for lifecycle tracking
registerSubagentRun({
runId,
@ -111,9 +115,6 @@ export function createSessionsSpawnTool(
timeoutSeconds,
});
// Write the task to the child (non-blocking)
childAgent.write(task);
return {
content: [
{