test(delegate-task): add background-task test coverage

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-27 21:15:42 +09:00
parent e1b2fa9a14
commit 241fb70a4a
@@ -522,4 +522,48 @@ describeFn("executeBackgroundTask output/session metadata compatibility", () =>
expectFn(secondResult).toContain("session_id: ses_second")
expectFn(secondResult).not.toContain("interrupt")
})
testFn("strips legacy ZWSP-prefixed agent names from persisted background task launch input (GH-3259)", async () => {
//#given - persisted launch input from v3.14.0-v3.16.0 with ZWSP prefix on agent
const launchCalls: Array<{ agent: string }> = []
const manager = {
launch: async (input: { agent: string }) => {
launchCalls.push(input)
return {
id: "bg_legacy_zwsp",
sessionID: "ses_legacy_zwsp",
description: "Legacy ZWSP",
agent: "Hephaestus - Deep Agent",
status: "running",
}
},
getTask: () => ({ sessionID: "ses_legacy_zwsp" }),
}
//#when
await executeBackgroundTask(
{
description: "Legacy ZWSP",
prompt: "check",
run_in_background: true,
load_skills: [],
},
{
sessionID: "ses_parent",
callID: "call_legacy_zwsp",
metadata: async () => {},
abort: new AbortController().signal,
},
{ manager },
{ sessionID: "ses_parent", messageID: "msg_legacy_zwsp" },
"\u200B\u200BHephaestus - Deep Agent",
undefined,
undefined,
undefined,
)
//#then
expectFn(launchCalls).toHaveLength(1)
expectFn(launchCalls[0].agent).toBe("Hephaestus - Deep Agent")
})
})