mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
Merge pull request #58241 from tianma-if/codex/fix-desktop-project-session-cwd
fix(desktop): preserve project cwd for new sessions
This commit is contained in:
commit
095b9eed38
2 changed files with 23 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
|
|||
import { getSessionMessages, type SessionInfo } from '@/hermes'
|
||||
import { createClientSessionState } from '@/lib/chat-runtime'
|
||||
import { $activeGatewayProfile, $newChatProfile } from '@/store/profile'
|
||||
import { $projectScope, $projectTree, ALL_PROJECTS } from '@/store/projects'
|
||||
import {
|
||||
$activeSessionId,
|
||||
$currentCwd,
|
||||
|
|
@ -113,6 +114,8 @@ describe('createBackendSessionForSend profile routing', () => {
|
|||
cleanup()
|
||||
$newChatProfile.set(null)
|
||||
$activeGatewayProfile.set('default')
|
||||
$projectScope.set(ALL_PROJECTS)
|
||||
$projectTree.set([])
|
||||
$currentCwd.set('')
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
|
@ -161,6 +164,24 @@ describe('createBackendSessionForSend profile routing', () => {
|
|||
|
||||
expect(params).toMatchObject({ cwd: '/remote/worktree' })
|
||||
})
|
||||
|
||||
it('falls back to the entered project cwd when the current cwd is blank', async () => {
|
||||
const params = await createWith(() => {
|
||||
$projectTree.set([
|
||||
{
|
||||
id: 'p_app',
|
||||
label: 'App',
|
||||
path: '/repo/app',
|
||||
repos: [{ groups: [], id: '/repo/app', label: 'app', path: '/repo/app', sessionCount: 0 }],
|
||||
sessionCount: 0
|
||||
}
|
||||
])
|
||||
$projectScope.set('p_app')
|
||||
$currentCwd.set('')
|
||||
})
|
||||
|
||||
expect(params).toMatchObject({ cwd: '/repo/app' })
|
||||
})
|
||||
})
|
||||
|
||||
// ── Resume failure recovery (the "stuck loading session window" bug) ──────────
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ import {
|
|||
setSessionStartedAt,
|
||||
setSessionsTotal,
|
||||
setTurnStartedAt,
|
||||
setYoloActive,
|
||||
workspaceCwdForNewSession
|
||||
setYoloActive
|
||||
} from '@/store/session'
|
||||
import { broadcastSessionsChanged } from '@/store/session-sync'
|
||||
import { isWatchWindow } from '@/store/windows'
|
||||
|
|
@ -163,7 +162,7 @@ export function useSessionActions({
|
|||
// a backend resolves its own launch profile to None (_profile_home).
|
||||
const newChatProfile = $newChatProfile.get() ?? normalizeProfileKey($activeGatewayProfile.get())
|
||||
await ensureGatewayProfile(newChatProfile)
|
||||
const cwd = $currentCwd.get().trim() || workspaceCwdForNewSession()
|
||||
const cwd = $currentCwd.get().trim() || resolveNewSessionCwd()
|
||||
// The composer's model/effort/fast is sticky UI state ($currentModel,
|
||||
// $currentProvider, $currentReasoningEffort, $currentFastMode). Ship it
|
||||
// with every session.create so the new chat opens on whatever the picker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue