diff --git a/packages/ui/src/components/chat/ChatInput.tsx b/packages/ui/src/components/chat/ChatInput.tsx index a3de3395..65634b05 100644 --- a/packages/ui/src/components/chat/ChatInput.tsx +++ b/packages/ui/src/components/chat/ChatInput.tsx @@ -18,7 +18,7 @@ import { import type { AttachedFile } from '@/stores/types/sessionTypes'; import * as sessionActions from '@/sync/session-actions'; import { buildLinkedIssue } from '@/lib/linkedIssues'; -import { useSession, useUserMessageHistory } from "@/sync/sync-context"; +import { useUserMessageHistory } from "@/sync/sync-context"; import { getInlineCommentDraftKey, useInlineCommentDraftStore, type InlineCommentDraft, type InlineCommentDraftTarget } from '@/stores/useInlineCommentDraftStore'; import { useSnippetsStore } from '@/stores/useSnippetsStore'; import { renderMagicPrompt } from '@/lib/magicPrompts'; @@ -342,11 +342,7 @@ const ChatInputComponent: React.FC = ({ // A session promoted out of `/btw` keeps the boundary instructions in its // transcript — there is no way to delete a message part — so it has to say // they no longer apply. - const currentSessionRecord = useSession( - currentSessionId, - currentSessionDirectoryForSync ?? currentDirectory ?? undefined, - ); - const isPromotedBtwSession = wasPromotedBtwSession(currentSessionRecord); + const isPromotedBtwSession = wasPromotedBtwSession(btwPanel.parentSession); const activeRuntimeKey = getRuntimeKey(); const chatDraftIdentity = React.useMemo( () => createChatDraftIdentity( diff --git a/packages/ui/src/components/chat/btw/useBtwPanelState.ts b/packages/ui/src/components/chat/btw/useBtwPanelState.ts index 6d36f060..9807e70e 100644 --- a/packages/ui/src/components/chat/btw/useBtwPanelState.ts +++ b/packages/ui/src/components/chat/btw/useBtwPanelState.ts @@ -5,6 +5,8 @@ import { getBtwBoundaryMessageID, getBtwSessionID } from '@/lib/sessionBtwMetada import { useBtwStore } from '@/stores/useBtwStore'; export type BtwPanelState = { + /** The session the composer is in — the one `/btw` would fork. */ + parentSession: Session | null; /** The active fork for this parent, or null when no panel should exist. */ btwSessionId: string | null; btwSession: Session | null; @@ -40,6 +42,7 @@ export function useBtwPanelState( const destroying = Boolean(uiState?.destroying); const btwSessionId = btwSession && !destroying ? linkedBtwSessionId : null; return { + parentSession: parentSession ?? null, btwSessionId, btwSession: btwSessionId ? btwSession : null, // SAFETY: the SDK Session type omits the server's `directory` field; this