From f0b0c9595fa68e45ff2d922b2b2bba98bd75ef46 Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Sun, 8 Nov 2026 19:15:51 +0000 Subject: [PATCH] fix(ai-vault): recompute chat-resume eligibility when host agent facts change --- .../session-actions/use-ai-vault-panel-session-resume.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/use-ai-vault-panel-session-resume.ts b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/use-ai-vault-panel-session-resume.ts index ecb9f89476c..43615fd58f8 100644 --- a/src/renderer/src/components/right-sidebar/ai-vault/session-actions/use-ai-vault-panel-session-resume.ts +++ b/src/renderer/src/components/right-sidebar/ai-vault/session-actions/use-ai-vault-panel-session-resume.ts @@ -4,6 +4,7 @@ import type { Repo } from '../../../../../../shared/repo-types' import type { Worktree } from '../../../../../../shared/worktree/types' import { useAppStore } from '@/store/index' import { selectAgentLaunchRouteView } from '@/lib/agent-session/launch/routing/agent-launch-route-input' +import { useChatProgramFactsVersion } from '@/lib/host-chat-program-acquisition' import { resolveAiVaultHistorySessionResumeState, resolveAiVaultSessionResumeActions, @@ -64,15 +65,18 @@ export function useAiVaultPanelSessionResume(args: { [getSessionRowResumeArgs] ) // Chat resume must preserve the session’s workspace: Claude finds transcripts through launch-cwd-derived paths. - // Eligibility also reads host capabilities and agent lists from the store; this view changes with them. + // Eligibility reads launch-route store state plus host agent lists and capabilities kept outside the + // store; these two change with them, so memoized rows recompute it. const launchRoute = useAppStore(selectAgentLaunchRouteView) + const chatProgramFactsVersion = useChatProgramFactsVersion() const getSessionResumeInChat = useCallback( (session: AiVaultSession): AiVaultResumeInChatEligibility => resolveAiVaultHistoryRowResume({ ...getSessionRowResumeArgs(session), settings: launchRoute.settings }).resumeInChat, - [getSessionRowResumeArgs, launchRoute] + // eslint-disable-next-line react-hooks/exhaustive-deps -- the version is the invalidation signal + [getSessionRowResumeArgs, launchRoute, chatProgramFactsVersion] ) return { getSessionWorktreeInfo,