From 271d200ab324764117c38c38f9735c638ac31fe9 Mon Sep 17 00:00:00 2001 From: Pandu dwi Putra Date: Sun, 25 Oct 2026 13:30:54 +0700 Subject: [PATCH 1/3] fix(acp): treat other models' effort menus as unknown so new chats can seed an effort An ACP agent without per-model effort metadata (OMP) only reports the running session's thought_level menu. Every other model was recorded with efforts: [], which admission reads as 'offers no effort', so a new chat seeded with that model plus an effort was refused with optionRejected. Mark those rows effortsKnown: false instead. --- src/main/acp/acp-structured-options.test.ts | 3 ++- src/main/acp/acp-structured-options.ts | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/acp/acp-structured-options.test.ts b/src/main/acp/acp-structured-options.test.ts index 2f54e1e7f506..85fc318cd6ec 100644 --- a/src/main/acp/acp-structured-options.test.ts +++ b/src/main/acp/acp-structured-options.test.ts @@ -35,7 +35,8 @@ describe('ACP session options', () => { const { models, current } = options.read() // Current values supply an effort menu, never a catalog default. expect(models).toEqual([ - { id: 'model-a', label: 'Model A', isDefault: false, efforts: [] }, + // The session's effort menu belongs to model-b; model-a's menu is unknown, not empty. + { id: 'model-a', label: 'Model A', isDefault: false, efforts: [], effortsKnown: false }, { id: 'model-b', label: 'Model B', diff --git a/src/main/acp/acp-structured-options.ts b/src/main/acp/acp-structured-options.ts index c33219483a1b..0ff53ae10e11 100644 --- a/src/main/acp/acp-structured-options.ts +++ b/src/main/acp/acp-structured-options.ts @@ -158,7 +158,13 @@ export class AcpStructuredOptions { const models: AgentSessionModelOption[] = listed.map((model) => { const info = this.models?.availableModels.find((entry) => entry.modelId === model.id) const advertised = info ? this.dialect.modelEfforts?.(info) : undefined - const sessionMenu = { efforts: model.id === currentModel ? sessionEfforts : [] } + // A session effort menu says nothing about another model's menu: unknown, not none. + const sessionMenu = + model.id === currentModel + ? { efforts: sessionEfforts } + : advertised || !effortOption + ? { efforts: [] } + : { efforts: [], effortsKnown: false as const } return { ...model, isDefault: false, From e4c4e05f40b9a5cfb31f06203781d86b2d45c4ee Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 25 Oct 2026 15:03:25 -0700 Subject: [PATCH 2/3] fix(native-chat): a borrowed effort menu makes a catalog row's efforts known again A newer listing that marks a model's efforts unknown borrows the older listing's menu; keep that row strict instead of admitting any effort. --- .../agent-model-catalog-entry.test.ts | 13 +++++++++++++ .../agent-model-catalog-entry.ts | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts b/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts index c1553272f9d6..1589421caabd 100644 --- a/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts +++ b/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts @@ -39,3 +39,16 @@ describe('the effort menu of a model whose configured effort one listing lacks', expect(merged).not.toHaveProperty('defaultEffort') }) }) + +it('treats a model’s efforts as known once the other listing supplies its menu', () => { + const probe = listing('probe', 1, menu('off', 'high')) + const chat: AgentModelCatalogListing = { + ...listing('live-session', 2, []), + models: [ + { id: 'openai/gpt-6', label: 'GPT-6', isDefault: false, efforts: [], effortsKnown: false } + ] + } + const merged = model(probe, chat) + expect(merged?.efforts).toEqual(menu('off', 'high')) + expect(merged).not.toHaveProperty('effortsKnown') +}) diff --git a/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.ts b/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.ts index ee66c39ee5a7..44ef3c0f7110 100644 --- a/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.ts +++ b/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.ts @@ -152,9 +152,11 @@ function mergedModels( const defaultEffort = [configuredEffort, listed?.defaultEffort, reported?.defaultEffort].find( (effort) => effort !== undefined && efforts.some((choice) => choice.value === effort) ) - const { defaultEffort: _own, ...rest } = model + const { defaultEffort: _own, effortsKnown, ...rest } = model return { ...rest, + // A menu borrowed from the other listing makes the efforts known again. + ...(effortsKnown === false && efforts.length === 0 ? { effortsKnown } : {}), // Without discovery/configuration, live flags are the only available default evidence. isDefault: configured ? model.id === configured.modelId From 0c36f61e5265e5344a47b78f815a400b250d4390 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 25 Oct 2026 15:21:01 -0700 Subject: [PATCH 3/3] fix(acp): only OMP marks unlisted models' efforts unknown; keep explicit empty menus OpenCode builds its effort menu from the current model and refuses an effort the selected model lacks, so its other models keep explicit empty menus. Opt in with clampsUnlistedEffort on dialects that clamp (OMP). A newer unknown row no longer overrides an older listing's explicit []. --- src/main/acp/acp-dialects/acp-dialect.ts | 2 ++ src/main/acp/acp-dialects/omp-dialect.ts | 2 ++ src/main/acp/acp-structured-options.test.ts | 20 ++++++++++-- src/main/acp/acp-structured-options.ts | 13 +++++--- .../agent-model-catalog-entry.test.ts | 32 ++++++++++++------- .../agent-model-catalog-entry.ts | 9 ++++-- 6 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/main/acp/acp-dialects/acp-dialect.ts b/src/main/acp/acp-dialects/acp-dialect.ts index 08b1f2723536..1e7786cae451 100644 --- a/src/main/acp/acp-dialects/acp-dialect.ts +++ b/src/main/acp/acp-dialects/acp-dialect.ts @@ -100,6 +100,8 @@ export type AcpDialect = { notification?(method: string, params: unknown, at: number): AcpDialectNotification | undefined contextWindow?(models: unknown): number | undefined modelEfforts?(model: ModelInfo): { efforts: AgentSessionOptionChoice[]; defaultEffort?: string } + /** The agent clamps an effort another model lacks, so unlisted models' menus are unknown, not empty. */ + clampsUnlistedEffort?: true /** Claimed permission requests are never auto-approved. */ request?(method: string, params: unknown): AcpRequestPresentation | undefined settleRequest?(method: string, params: unknown): AcpRequestSettlement | undefined diff --git a/src/main/acp/acp-dialects/omp-dialect.ts b/src/main/acp/acp-dialects/omp-dialect.ts index 7af2b20e536b..99ea622010cd 100644 --- a/src/main/acp/acp-dialects/omp-dialect.ts +++ b/src/main/acp/acp-dialects/omp-dialect.ts @@ -113,6 +113,8 @@ function errorDetails(error: AcpAgentError): string | undefined { } export const OMP_ACP_DIALECT: AcpDialect = { + // OMP resolves any thinking level against the selected model (model-controls.ts setThinkingLevel). + clampsUnlistedEffort: true, normalizeToolUpdate, compactionReply, authenticationRequired: (error) => { diff --git a/src/main/acp/acp-structured-options.test.ts b/src/main/acp/acp-structured-options.test.ts index 85fc318cd6ec..22c011a96dbc 100644 --- a/src/main/acp/acp-structured-options.test.ts +++ b/src/main/acp/acp-structured-options.test.ts @@ -2,6 +2,8 @@ import { readFileSync } from 'node:fs' import { describe, expect, it } from 'vitest' import { AcpStructuredOptions } from './acp-structured-options' import { GROK_ACP_DIALECT } from './acp-dialects/grok-dialect' +import { OMP_ACP_DIALECT } from './acp-dialects/omp-dialect' +import { OPENCODE_ACP_DIALECT } from './acp-dialects/opencode-dialect' const configOptions = [ { @@ -30,13 +32,13 @@ const configOptions = [ describe('ACP session options', () => { it('keeps the session’s picks out of the catalog facts', () => { - const options = new AcpStructuredOptions() + // OpenCode refuses an effort the selected model lacks, so another model's empty menu stays strict. + const options = new AcpStructuredOptions(OPENCODE_ACP_DIALECT) options.adoptSession({ configOptions }) const { models, current } = options.read() // Current values supply an effort menu, never a catalog default. expect(models).toEqual([ - // The session's effort menu belongs to model-b; model-a's menu is unknown, not empty. - { id: 'model-a', label: 'Model A', isDefault: false, efforts: [], effortsKnown: false }, + { id: 'model-a', label: 'Model A', isDefault: false, efforts: [] }, { id: 'model-b', label: 'Model B', @@ -50,6 +52,18 @@ describe('ACP session options', () => { expect(current).toEqual({ model: 'model-b', effort: 'high', confirmed: ['model', 'effort'] }) }) + it('leaves another model’s menu unknown for an agent that clamps unlisted efforts', () => { + const options = new AcpStructuredOptions(OMP_ACP_DIALECT) + options.adoptSession({ configOptions }) + expect(options.read().models[0]).toEqual({ + id: 'model-a', + label: 'Model A', + isDefault: false, + efforts: [], + effortsKnown: false + }) + }) + it('reads each model’s own menu where the agent advertises one', () => { const options = new AcpStructuredOptions(GROK_ACP_DIALECT) options.adoptSession({ diff --git a/src/main/acp/acp-structured-options.ts b/src/main/acp/acp-structured-options.ts index 0ff53ae10e11..f262044e99de 100644 --- a/src/main/acp/acp-structured-options.ts +++ b/src/main/acp/acp-structured-options.ts @@ -51,7 +51,10 @@ function isSelect(option: SessionConfigOption): option is SelectOption { export class AcpStructuredOptions { constructor( - private readonly dialect: Pick = {} + private readonly dialect: Pick< + AcpDialect, + 'modelEfforts' | 'clampsUnlistedEffort' | 'withheldCommands' + > = {} ) {} private configOptions: SessionConfigOption[] = [] @@ -158,13 +161,13 @@ export class AcpStructuredOptions { const models: AgentSessionModelOption[] = listed.map((model) => { const info = this.models?.availableModels.find((entry) => entry.modelId === model.id) const advertised = info ? this.dialect.modelEfforts?.(info) : undefined - // A session effort menu says nothing about another model's menu: unknown, not none. + // A clamping agent's session menu says nothing about another model's menu: unknown, not none. const sessionMenu = model.id === currentModel ? { efforts: sessionEfforts } - : advertised || !effortOption - ? { efforts: [] } - : { efforts: [], effortsKnown: false as const } + : this.dialect.clampsUnlistedEffort && effortOption && !advertised + ? { efforts: [], effortsKnown: false as const } + : { efforts: [] } return { ...model, isDefault: false, diff --git a/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts b/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts index 1589421caabd..d194ae277416 100644 --- a/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts +++ b/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.test.ts @@ -40,15 +40,25 @@ describe('the effort menu of a model whose configured effort one listing lacks', }) }) -it('treats a model’s efforts as known once the other listing supplies its menu', () => { - const probe = listing('probe', 1, menu('off', 'high')) - const chat: AgentModelCatalogListing = { - ...listing('live-session', 2, []), - models: [ - { id: 'openai/gpt-6', label: 'GPT-6', isDefault: false, efforts: [], effortsKnown: false } - ] - } - const merged = model(probe, chat) - expect(merged?.efforts).toEqual(menu('off', 'high')) - expect(merged).not.toHaveProperty('effortsKnown') +const unknownChat = (at: number): AgentModelCatalogListing => ({ + ...listing('live-session', at, []), + models: [ + { id: 'openai/gpt-6', label: 'GPT-6', isDefault: false, efforts: [], effortsKnown: false } + ] +}) + +describe('a model whose newer chat listing does not know its efforts', () => { + it('takes the menu the older listing supplies', () => { + const merged = model(listing('probe', 1, menu('off', 'high')), unknownChat(2)) + expect(merged?.efforts).toEqual(menu('off', 'high')) + expect(merged).not.toHaveProperty('effortsKnown') + }) + + it('keeps an older listing’s explicit empty menu', () => { + expect(model(listing('probe', 1, []), unknownChat(2))).not.toHaveProperty('effortsKnown') + }) + + it('stays unknown when no listing knows its menu', () => { + expect(model(unknownChat(1), unknownChat(2))).toMatchObject({ effortsKnown: false }) + }) }) diff --git a/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.ts b/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.ts index 44ef3c0f7110..eac0b909ff64 100644 --- a/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.ts +++ b/src/main/native-chat/agent-model-catalog/agent-model-catalog-entry.ts @@ -139,7 +139,8 @@ function mergedModels( return (newer?.models ?? []).map((model) => { const listed = discovered?.models.find((entry) => entry.id === model.id) const reported = live?.models.find((entry) => entry.id === model.id) - const olderEfforts = older?.models.find((entry) => entry.id === model.id)?.efforts ?? [] + const olderModel = older?.models.find((entry) => entry.id === model.id) + const olderEfforts = olderModel?.efforts ?? [] const runsConfigured = configured?.modelId === model.id || configured?.sameModelIds?.includes(model.id) === true const configuredEffort = runsConfigured ? configured?.effort : undefined @@ -155,8 +156,10 @@ function mergedModels( const { defaultEffort: _own, effortsKnown, ...rest } = model return { ...rest, - // A menu borrowed from the other listing makes the efforts known again. - ...(effortsKnown === false && efforts.length === 0 ? { effortsKnown } : {}), + // Efforts stay unknown only when neither listing knows this model's menu. + ...(effortsKnown === false && (!olderModel || olderModel.effortsKnown === false) + ? { effortsKnown } + : {}), // Without discovery/configuration, live flags are the only available default evidence. isDefault: configured ? model.id === configured.modelId