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.
This commit is contained in:
Brooklyn Nicholson 2026-06-28 14:44:28 -05:00
parent 8d8c7111d9
commit 19bae1b9e0

View file

@ -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<Map<string, string>>
const sessionStateByRuntimeIdRef = {
current: new Map([
[