From 444b7ce991d2aa2eff97d009a7dce1043a0fcaad Mon Sep 17 00:00:00 2001 From: Kenny Date: Tue, 13 Jan 2026 13:41:41 -0500 Subject: [PATCH] fix(sisyphus-task): guard client.session.get and update sync mode tests - Add guard clause to check if client.session.get exists before calling - Update 4 sync mode tests to properly mock session.get - Fixes test failures from PR #731 directory inheritance feature --- src/tools/sisyphus-task/tools.test.ts | 4 ++++ src/tools/sisyphus-task/tools.ts | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tools/sisyphus-task/tools.test.ts b/src/tools/sisyphus-task/tools.test.ts index cd45bf2d7..58dfe66d8 100644 --- a/src/tools/sisyphus-task/tools.test.ts +++ b/src/tools/sisyphus-task/tools.test.ts @@ -452,6 +452,7 @@ describe("sisyphus-task", () => { const mockClient = { session: { + get: async () => ({ data: { directory: "/project" } }), create: async () => ({ data: { id: "ses_sync_error_test" } }), prompt: async () => { throw new Error("JSON Parse error: Unexpected EOF") @@ -504,6 +505,7 @@ describe("sisyphus-task", () => { const mockClient = { session: { + get: async () => ({ data: { directory: "/project" } }), create: async () => ({ data: { id: "ses_sync_success" } }), prompt: async () => ({ data: {} }), messages: async () => ({ @@ -560,6 +562,7 @@ describe("sisyphus-task", () => { const mockClient = { session: { + get: async () => ({ data: { directory: "/project" } }), create: async () => ({ data: { id: "ses_agent_notfound" } }), prompt: async () => { throw new Error("Cannot read property 'name' of undefined agent.name") @@ -610,6 +613,7 @@ describe("sisyphus-task", () => { const mockManager = { launch: async () => ({}) } const mockClient = { session: { + get: async () => ({ data: { directory: "/project" } }), create: async () => ({ data: { id: "ses_sync_model" } }), prompt: async (input: any) => { promptBody = input.body diff --git a/src/tools/sisyphus-task/tools.ts b/src/tools/sisyphus-task/tools.ts index af6b157f9..6127cf526 100644 --- a/src/tools/sisyphus-task/tools.ts +++ b/src/tools/sisyphus-task/tools.ts @@ -407,9 +407,9 @@ System notifies on completion. Use \`background_output\` with task_id="${task.id let syncSessionID: string | undefined try { - const parentSession = await client.session.get({ - path: { id: ctx.sessionID }, - }).catch(() => null) + const parentSession = client.session.get + ? await client.session.get({ path: { id: ctx.sessionID } }).catch(() => null) + : null const parentDirectory = parentSession?.data?.directory ?? directory const createResult = await client.session.create({