mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-24 13:11:06 +00:00
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>
66 lines
2.2 KiB
TypeScript
66 lines
2.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
resolveSubagentSpawnAcceptedNote,
|
|
SUBAGENT_SPAWN_ACCEPTED_NOTE,
|
|
SUBAGENT_SPAWN_SESSION_ACCEPTED_NOTE,
|
|
} from "./subagent-spawn-accepted-note.js";
|
|
|
|
describe("sessions_spawn: cron isolated session note suppression", () => {
|
|
it("suppresses ACCEPTED_NOTE for cron isolated sessions (mode=run)", () => {
|
|
expect(
|
|
resolveSubagentSpawnAcceptedNote({
|
|
spawnMode: "run",
|
|
agentSessionKey: "agent:main:cron:dd871818:run:cf959c9f",
|
|
}),
|
|
).toBeUndefined();
|
|
});
|
|
|
|
it("preserves ACCEPTED_NOTE for regular sessions (mode=run)", () => {
|
|
expect(
|
|
resolveSubagentSpawnAcceptedNote({
|
|
spawnMode: "run",
|
|
agentSessionKey: "agent:main:telegram:63448508",
|
|
}),
|
|
).toBe(SUBAGENT_SPAWN_ACCEPTED_NOTE);
|
|
});
|
|
|
|
it("keeps regular run guidance push-based without recommending sessions_yield", () => {
|
|
expect(SUBAGENT_SPAWN_ACCEPTED_NOTE).toContain("Auto-announce is push-based");
|
|
expect(SUBAGENT_SPAWN_ACCEPTED_NOTE).toContain("Continue any independent work");
|
|
expect(SUBAGENT_SPAWN_ACCEPTED_NOTE).toContain(
|
|
"wait for runtime completion events to arrive as user messages",
|
|
);
|
|
expect(SUBAGENT_SPAWN_ACCEPTED_NOTE).toContain(
|
|
"only answer after completion events for ALL required children arrive",
|
|
);
|
|
expect(SUBAGENT_SPAWN_ACCEPTED_NOTE).not.toContain("sessions_yield");
|
|
});
|
|
|
|
it("preserves ACCEPTED_NOTE for non-canonical cron-like keys", () => {
|
|
expect(
|
|
resolveSubagentSpawnAcceptedNote({
|
|
spawnMode: "run",
|
|
agentSessionKey: "agent:main:slack:cron:job:run:uuid",
|
|
}),
|
|
).toBe(SUBAGENT_SPAWN_ACCEPTED_NOTE);
|
|
});
|
|
|
|
it("preserves ACCEPTED_NOTE when agentSessionKey is undefined", () => {
|
|
expect(
|
|
resolveSubagentSpawnAcceptedNote({
|
|
spawnMode: "run",
|
|
agentSessionKey: undefined,
|
|
}),
|
|
).toBe(SUBAGENT_SPAWN_ACCEPTED_NOTE);
|
|
});
|
|
|
|
it("uses the session note for cron session-mode spawns", () => {
|
|
expect(
|
|
resolveSubagentSpawnAcceptedNote({
|
|
spawnMode: "session",
|
|
agentSessionKey: "agent:main:cron:dd871818:run:cf959c9f",
|
|
}),
|
|
).toBe(SUBAGENT_SPAWN_SESSION_ACCEPTED_NOTE);
|
|
});
|
|
});
|