diff --git a/frontend/src/lib/components/copilot/chat/global/core.ts b/frontend/src/lib/components/copilot/chat/global/core.ts index f3c8306429..4c6ab519a5 100644 --- a/frontend/src/lib/components/copilot/chat/global/core.ts +++ b/frontend/src/lib/components/copilot/chat/global/core.ts @@ -4815,8 +4815,8 @@ function addressedDisplayPath( triggerKind?: TriggerKind ): string { // From the open editor, which holds the freshest name and answers without a request. A - // draft no editor holds falls back to the path the call named; the write's own result - // names it properly once the value has been read. + // draft no editor holds falls back to the path the call named; the result the write + // returns names it from the draft itself. const live = liveGlobalDraftDisplayPath(workspace, type, target.storagePath, triggerKind) return live === target.storagePath ? target.path : live } diff --git a/frontend/src/lib/components/copilot/chat/global/userDraftAdapter.ts b/frontend/src/lib/components/copilot/chat/global/userDraftAdapter.ts index 445f576feb..798dc2af1b 100644 --- a/frontend/src/lib/components/copilot/chat/global/userDraftAdapter.ts +++ b/frontend/src/lib/components/copilot/chat/global/userDraftAdapter.ts @@ -335,9 +335,9 @@ const NAMEABLE_DRAFT_KINDS: ReadonlySet = new Set( Object.keys(deployedExists) as UserDraftItemKind[] ) -/** What a path resolved to: where the draft is stored, and its value when reaching it - * already fetched one, so a read does not ask for the same draft twice. */ -type ResolvedDraft = { storagePath: string; value?: unknown } +/** What a path resolved to: where the draft is stored. Deliberately not the value read on + * the way there — see `readGlobalDraftValue` for why a caller must fetch its own. */ +type ResolvedDraft = { storagePath: string } /** * Where the draft a path names is stored. A new item is stored at a generated @@ -362,7 +362,7 @@ async function resolveDraft( // chat is handed storage paths. if (UserDraft.get(itemKind, path, { workspace }) !== undefined) return { storagePath: path } const own = await fetchBackendDraftValue(workspace, itemKind, path) - if (own !== undefined) return { storagePath: path, value: own } + if (own !== undefined) return { storagePath: path } return { storagePath: await storagePathForChosenName(workspace, itemKind, path, opts) } }