Skip to content

Commit ad839a7

Browse files
committed
fix(acp): reject unavailable models before configuration
1 parent 599674f commit ad839a7

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,11 +790,14 @@ describe("AcpRegistryAdapterV2", () => {
790790
"updated-config",
791791
"removed-config",
792792
"configuration-update",
793+
"unavailable-before-configuration",
793794
] as const)(
794795
"rejects an unavailable explicit model in a %s catalog before inference",
795796
(catalog) => {
796797
const duringTurn = catalog === "updated-config" || catalog === "removed-config";
797798
const duringConfiguration = catalog === "configuration-update";
799+
const changesOptions =
800+
duringConfiguration || catalog === "unavailable-before-configuration";
798801
const model = duringTurn || duringConfiguration ? "hermes" : "missing";
799802
const restrictedOption = {
800803
...modelOption("model", "other"),
@@ -818,12 +821,12 @@ describe("AcpRegistryAdapterV2", () => {
818821
...modelOption("model", "hermes"),
819822
options: [{ value: "hermes", name: "Hermes" }],
820823
},
821-
...(duringConfiguration ? [permissionModeOption("ask")] : []),
824+
...(changesOptions ? [permissionModeOption("ask")] : []),
822825
],
823826
},
824827
storedModel: model,
825828
...(duringTurn ? { turnModels: [model, model] } : {}),
826-
...(duringConfiguration ? { storedModePick: "auto" } : {}),
829+
...(changesOptions ? { storedModePick: "auto" } : {}),
827830
rejectedModel: model,
828831
pickFrames: duringTurn
829832
? prompt(configOptionUpdate(catalog === "removed-config" ? [] : [restrictedOption]))

‎packages/provider-acp/src/server/adapter.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6702,6 +6702,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
67026702
runtimePolicy: ProviderAdapter.ProviderAdapterV2RuntimePolicy,
67036703
) {
67046704
yield* Ref.set(activeSelection, null);
6705+
yield* validateModelSelection(modelSelection);
67056706
const requestedModel = flavor.resolveModelId?.(modelSelection) ?? modelSelection.model;
67066707
// Invalid params is the agent refusing the value, and the runtime
67076708
// raises the same code when the session's model option does not offer

0 commit comments

Comments
 (0)