From 241fb70a4af25e4751debebb892ce90995ae15ad Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 27 Apr 2026 21:15:42 +0900 Subject: [PATCH] test(delegate-task): add background-task test coverage Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .../delegate-task/background-task.test.ts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/tools/delegate-task/background-task.test.ts b/src/tools/delegate-task/background-task.test.ts index 3837dbb6e..ea4e159a3 100644 --- a/src/tools/delegate-task/background-task.test.ts +++ b/src/tools/delegate-task/background-task.test.ts @@ -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") + }) })