Files
openclaw/src/agents/subagent-spawn-accepted-note.ts
brokemac79 a67753cc25 fix(agents): clarify subagent spawn wait guidance (#79051)
Summary:
- Replace the subagent spawn accepted-note yield guidance with push-based completion-event guidance.
- Cover the prompt with regression assertions that keep sessions_yield out of the note.
- Keep current rebased lint/type test helpers green.

Verification:
- pnpm lint
- pnpm check:test-types
- env -u OPENCLAW_TESTBOX -u OPENCLAW_TESTBOX_ID pnpm check:changed

Co-authored-by: brokemac79 <martin_cleary@yahoo.co.uk>
2026-05-10 17:11:32 +01:00

17 lines
1.0 KiB
TypeScript

import { isCronSessionKey } from "../routing/session-key.js";
export const SUBAGENT_SPAWN_ACCEPTED_NOTE =
"Auto-announce is push-based. After spawning children, do NOT call sessions_list, sessions_history, exec sleep, or any polling tool. Track expected child session keys. Continue any independent work. If your final answer depends on child output, wait for runtime completion events to arrive as user messages and only answer after completion events for ALL required children arrive. If a child completion event arrives AFTER your final answer, reply ONLY with NO_REPLY.";
export const SUBAGENT_SPAWN_SESSION_ACCEPTED_NOTE =
"thread-bound session stays active after this task; continue in-thread for follow-ups.";
export function resolveSubagentSpawnAcceptedNote(params: {
spawnMode: "run" | "session";
agentSessionKey?: string;
}): string | undefined {
if (params.spawnMode === "session") {
return SUBAGENT_SPAWN_SESSION_ACCEPTED_NOTE;
}
return isCronSessionKey(params.agentSessionKey) ? undefined : SUBAGENT_SPAWN_ACCEPTED_NOTE;
}