Skip to content

Commit 886956b

Browse files
committed
fix(acp): forward custom models and index the ACP driver in settings search
A custom model the agent does not advertise is forwarded to session/set_config_option like the Cursor path does, so the runtime's option validation reports it instead of silently running on the agent default. The Providers settings row now matches acp/agent client protocol.
1 parent 5b5269e commit 886956b

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

‎apps/server/src/provider/Layers/CursorAdapter.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,18 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
277277
attachments: [],
278278
modelSelection: createModelSelection(ProviderInstanceId.make("acp_test"), "composer-2"),
279279
});
280+
// A custom model the agent does not advertise is forwarded and rejected by
281+
// the runtime's option validation rather than silently ignored.
282+
const rejected = yield* adapter
283+
.sendTurn({
284+
threadId,
285+
input: "custom model",
286+
attachments: [],
287+
modelSelection: createModelSelection(ProviderInstanceId.make("acp_test"), "my-custom"),
288+
})
289+
.pipe(Effect.flip);
290+
assert.equal(rejected._tag, "ProviderAdapterRequestError");
291+
assert.match(rejected.message, /expected one of/);
280292
yield* adapter.stopSession(threadId);
281293

282294
const requests = yield* Effect.promise(() => readJsonLines(requestLogPath));

‎apps/server/src/provider/Layers/CursorAdapter.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,15 @@ function applyRequestedSessionConfiguration<E>(input: {
315315
appliedModel = ACP_AGENT_DEFAULT_MODEL_SLUG;
316316
} else {
317317
const modelConfig = findModelConfigOption(yield* input.runtime.getConfigOptions);
318-
const advertisedModel = modelConfig
319-
? resolveSessionConfigOptionValue(modelConfig, requestedModel)
320-
: undefined;
321-
if (modelConfig && advertisedModel !== undefined) {
318+
if (modelConfig) {
319+
// Custom models that the agent does not advertise pass through so the
320+
// runtime's option validation reports them instead of silently
321+
// running the turn on the agent default.
322322
yield* input.runtime
323-
.setConfigOption(modelConfig.id, advertisedModel)
323+
.setConfigOption(
324+
modelConfig.id,
325+
resolveSessionConfigOptionValue(modelConfig, requestedModel) ?? requestedModel,
326+
)
324327
.pipe(Effect.mapError(mapConfigError));
325328
appliedModel = requestedModel;
326329
}

‎apps/web/src/components/settings/settingsSearch.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export const SETTINGS_SEARCH_ITEMS = [
296296
title: "Providers",
297297
to: "/settings/providers",
298298
searchTerms: [
299-
"agents cli codex claude cursor grok opencode instances authentication api key models configuration binary path config directory endpoint arguments environment variables display name accent color custom favorite hidden auto compact",
299+
"agents cli codex claude cursor grok opencode acp agent client protocol instances authentication api key models configuration binary path config directory endpoint arguments environment variables display name accent color custom favorite hidden auto compact",
300300
],
301301
},
302302
{

0 commit comments

Comments
 (0)