mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:11:24 +00:00
fix: suppress SUBAGENT_SPAWN_ACCEPTED_NOTE for cron isolated sessions
The 'do not poll/sleep' note added to sessions_spawn tool results causes
cron isolated agents to immediately end their turn, since the note tells
them not to wait for subagent results. In cron isolated sessions, the
agent turn IS the entire run, so ending early means subagent results
are never collected.
Fix: detect cron sessions via includes(':cron:') in agentSessionKey
and suppress the note, allowing the agent to poll/wait naturally.
Note: PR #27330 used startsWith('cron:') which never matches because
the session key format is 'agent:main:cron:...' (starts with 'agent:').
Fixes #27308
Fixes #25069
This commit is contained in:
committed by
Ayaan Zaidi
parent
46eba86b45
commit
69590de276
@@ -524,13 +524,23 @@ export async function spawnSubagentDirect(
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we're in a cron isolated session - don't add "do not poll" note
|
||||
// because cron sessions end immediately after the agent produces a response,
|
||||
// so the agent needs to wait for subagent results to keep the turn alive.
|
||||
const isCronSession = ctx.agentSessionKey?.includes(":cron:");
|
||||
const note =
|
||||
spawnMode === "session"
|
||||
? SUBAGENT_SPAWN_SESSION_ACCEPTED_NOTE
|
||||
: isCronSession
|
||||
? undefined
|
||||
: SUBAGENT_SPAWN_ACCEPTED_NOTE;
|
||||
|
||||
return {
|
||||
status: "accepted",
|
||||
childSessionKey,
|
||||
runId: childRunId,
|
||||
mode: spawnMode,
|
||||
note:
|
||||
spawnMode === "session" ? SUBAGENT_SPAWN_SESSION_ACCEPTED_NOTE : SUBAGENT_SPAWN_ACCEPTED_NOTE,
|
||||
note,
|
||||
modelApplied: resolvedModel ? modelApplied : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user