From fb1b4ac29ec822cf53c41a62d1df43fcece4badd Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Fri, 13 Nov 2026 22:31:03 +0000 Subject: [PATCH] fix(chat): show the picked Cursor model's own Fast, not the running one's A Fast value Cursor reported belongs to the model it ran, so a model pick drops it on the client and the host reads it only for that model. The config-folder test no longer depends on the runner's XDG_CONFIG_HOME. --- .../acp/session/acp-structured-cursor.test.ts | 7 +++++- .../structured-agent-session-options-read.ts | 5 +++- ...ructured-agent-session-option-view.test.ts | 25 +++++++++++++++++++ .../structured-agent-session-options.ts | 5 ++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/main/acp/session/acp-structured-cursor.test.ts b/src/main/acp/session/acp-structured-cursor.test.ts index 60a16f7a378..1297d4d364e 100644 --- a/src/main/acp/session/acp-structured-cursor.test.ts +++ b/src/main/acp/session/acp-structured-cursor.test.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import { afterEach, expect, it } from 'vitest' +import { afterEach, expect, it, onTestFinished, vi } from 'vitest' import { closeProviderTimelineRigs, SESSION @@ -317,6 +317,11 @@ it("drops Cursor's new-file markers from an edit's diff", () => { }) it("pins Cursor's own config folder, following XDG_CONFIG_HOME as Cursor does", async () => { + vi.stubEnv('XDG_CONFIG_HOME', undefined) + vi.stubEnv('CURSOR_CONFIG_DIR', undefined) + onTestFinished(() => { + vi.unstubAllEnvs() + }) const stateDirectory = '/state' expect( await CURSOR.account.resolve({ launchEnv: { HOME: '/home/ada' }, stateDirectory }) diff --git a/src/main/native-chat/agent-session-wire/options/structured-agent-session-options-read.ts b/src/main/native-chat/agent-session-wire/options/structured-agent-session-options-read.ts index f7a3d28ec54..41720ff8471 100644 --- a/src/main/native-chat/agent-session-wire/options/structured-agent-session-options-read.ts +++ b/src/main/native-chat/agent-session-wire/options/structured-agent-session-options-read.ts @@ -167,7 +167,10 @@ export async function readStructuredAgentSessionOptions( ...options.current, ...(model !== undefined ? { model } : {}), effort: saved.effort ?? options.current.effort, - fastMode: selected.current.fastMode ?? options.current.fastMode, + // A running model's Fast says nothing about another selected model, which keeps its own default. + fastMode: + selected.current.fastMode ?? + (model === options.current.model ? options.current.fastMode : undefined), // The saved tier as the shared speed rule runs it under the saved model. ...(context.deps.agents.definition(agent)?.restingOptions.acceptsKey('interactionMode') ? { diff --git a/src/shared/agent-session/options/structured-agent-session-option-view.test.ts b/src/shared/agent-session/options/structured-agent-session-option-view.test.ts index fb1ab4caf7e..97e569eead4 100644 --- a/src/shared/agent-session/options/structured-agent-session-option-view.test.ts +++ b/src/shared/agent-session/options/structured-agent-session-option-view.test.ts @@ -189,6 +189,31 @@ describe('a Claude chat on the model id an older host lists by alias', () => { }) describe('what a send carries', () => { + it("shows the picked Cursor model's own Fast, not the running model's", () => { + const seed = structuredAgentSessionSeedCatalog('cursor') + const row = (id: string, defaultFastMode: boolean) => ({ + id, + label: id, + isDefault: false, + efforts: [], + supportsFastMode: true, + defaultFastMode + }) + const running = applyStructuredAgentSessionOptions( + createStructuredAgentSessionOptionState('cursor', seed), + seed, + { + models: [row('composer-2.5', true), row('claude-opus-4-8', false)], + fastModeSupport: { supported: true }, + current: { model: 'composer-2.5', fastMode: true, confirmed: ['model', 'fastMode'] } + } + ) + const picked = commitStructuredAgentSessionOption(running, 'model', 'claude-opus-4-8') + expect( + structuredAgentSessionOptionSnapshot(picked).find((option) => option.id === 'fastMode')?.kind + ).toMatchObject({ type: 'boolean', currentValue: false }) + }) + it("shows and keeps a Cursor model's own Fast default until the person picks Fast", () => { const seed = structuredAgentSessionSeedCatalog('cursor') const composer = { diff --git a/src/shared/agent-session/options/structured-agent-session-options.ts b/src/shared/agent-session/options/structured-agent-session-options.ts index 999b8593d61..c44423da29e 100644 --- a/src/shared/agent-session/options/structured-agent-session-options.ts +++ b/src/shared/agent-session/options/structured-agent-session-options.ts @@ -263,6 +263,11 @@ export function commitStructuredAgentSessionOption( } // Keep other picks after a model change; the host reconciles independent values. state.record.values[id] = { value: decoded, source: 'dispatched' } + // A reported Fast was the old model's; the new one runs its own default until picked. + const staleFast = id === 'model' && state.record.values.fastMode?.source === 'reported' + if (staleFast && !unpickedFastModeIsOff(state.record.agent)) { + delete state.record.values.fastMode + } return { ...state, acceptedInputSources: