diff --git a/src/tools/delegate-task/background-continuation.ts b/src/tools/delegate-task/background-continuation.ts index b090170ee..92b162ead 100644 --- a/src/tools/delegate-task/background-continuation.ts +++ b/src/tools/delegate-task/background-continuation.ts @@ -40,7 +40,7 @@ export async function executeBackgroundContinuation( const resolvedModel = resolveMetadataModel(task.model, parentContext.model) const bgContMeta = { - title: `Continue: ${args.description}`, + title: args.description, metadata: { prompt: args.prompt, agent: task.agent, diff --git a/src/tools/delegate-task/metadata-task-id-consistency.test.ts b/src/tools/delegate-task/metadata-task-id-consistency.test.ts index 69f3f5508..23ce7d64a 100644 --- a/src/tools/delegate-task/metadata-task-id-consistency.test.ts +++ b/src/tools/delegate-task/metadata-task-id-consistency.test.ts @@ -429,6 +429,57 @@ describe("taskId and backgroundTaskId metadata consistency", () => { }) }) + describe("#given stock task title metadata contract", () => { + test("#when background continuation publishes metadata #then title equals description without resume prefix", async () => { + const { executeBackgroundContinuation } = require("./background-continuation") + const ctx = makeMockCtx() + const args: DelegateTaskArgs = { + description: "continue work", prompt: "keep going", + load_skills: [], run_in_background: true, task_id: "ses_resume_title", + } + + await executeBackgroundContinuation(args, ctx, { + manager: { + resume: async () => ({ + id: "bg_resume_title", description: "continue work", agent: "explore", + status: "running", sessionId: "ses_resume_title", model: MODEL, + }), + }, + } as any, parentContext) + + const meta = ctx.captured.find((item: any) => item.metadata?.sessionId) + expect(meta).toBeDefined() + expect(meta.title).toBe("continue work") + }) + + test("#when sync continuation publishes metadata #then title equals description without resume prefix", async () => { + const { executeSyncContinuation } = require("./sync-continuation") + const ctx = makeMockCtx() + const args: DelegateTaskArgs = { + description: "continue sync", prompt: "keep going", + load_skills: [], run_in_background: false, task_id: "ses_sync_title", + } + + await executeSyncContinuation(args, ctx, { + client: { + session: { + messages: async () => ({ + data: [{ info: { agent: "explore", model: MODEL } }], + }), + prompt: async () => ({}), + }, + }, + } as any, parentContext, { + pollSyncSession: async () => null, + fetchSyncResult: async () => ({ ok: true as const, textContent: "done" }), + }) + + const meta = ctx.captured.find((item: any) => item.metadata?.sessionId) + expect(meta).toBeDefined() + expect(meta.title).toBe("continue sync") + }) + }) + describe("#given background_output runs", () => { test("#when publishing metadata #then backgroundTaskId is task.id not task_id", async () => { const { createBackgroundOutput } = require("../background-task/create-background-output") diff --git a/src/tools/delegate-task/oracle-gap-closure.test.ts b/src/tools/delegate-task/oracle-gap-closure.test.ts index 57d67965a..c6bbc01ff 100644 --- a/src/tools/delegate-task/oracle-gap-closure.test.ts +++ b/src/tools/delegate-task/oracle-gap-closure.test.ts @@ -171,7 +171,7 @@ describe("delegate-task Oracle gap closure", () => { //#then const published = ctx.captured.find((item) => item.metadata?.sessionId === "ses_bg_title") - expect(published?.title).toBe("Continue: new desc") + expect(published?.title).toBe("new desc") }) test("#given sync continuation receives system content #when prompt is sent #then system content reaches prompt body", async () => { diff --git a/src/tools/delegate-task/sync-continuation.ts b/src/tools/delegate-task/sync-continuation.ts index d2dd3b678..37b22db9e 100644 --- a/src/tools/delegate-task/sync-continuation.ts +++ b/src/tools/delegate-task/sync-continuation.ts @@ -131,7 +131,7 @@ export async function executeSyncContinuation( : resumeModel const syncContMeta = { - title: `Continue: ${args.description}`, + title: args.description, metadata: { prompt: args.prompt, ...(resumeAgent !== undefined ? { agent: resumeAgent } : {}),