From 19bae1b9e0d32f9ba05830e44ba8c1cdbdb246c8 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sun, 28 Jun 2026 14:44:28 -0500 Subject: [PATCH] test(desktop): assert new backend sessions carry workspace cwd Pin the desktop-to-gateway cwd handoff: createBackendSessionForSend must pass the current workspace cwd into session.create so the backend registers the session cwd before the agent/tools run. --- .../src/app/session/hooks/use-session-actions.test.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx b/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx index f165504ad5e..8b806d5bdae 100644 --- a/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx +++ b/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx @@ -112,6 +112,7 @@ describe('createBackendSessionForSend profile routing', () => { cleanup() $newChatProfile.set(null) $activeGatewayProfile.set('default') + $currentCwd.set('') vi.restoreAllMocks() }) @@ -145,6 +146,14 @@ describe('createBackendSessionForSend profile routing', () => { expect(params).toMatchObject({ profile: 'default' }) }) + + it('passes the current workspace cwd into session.create', async () => { + const params = await createWith(() => { + $currentCwd.set('/remote/worktree') + }) + + expect(params).toMatchObject({ cwd: '/remote/worktree' }) + }) }) // ── Resume failure recovery (the "stuck loading session window" bug) ────────── @@ -344,6 +353,7 @@ describe('resumeSession failure recovery', () => { const runtimeIdByStoredSessionIdRef = { current: new Map([['stored-1', 'runtime-stale']]) } satisfies MutableRefObject> + const sessionStateByRuntimeIdRef = { current: new Map([ [