Skip to content

Commit c3f0a6c

Browse files
AKolendamaria-rcks
andauthored
fix(provider-acp-registry): reopening a Kimi thread no longer collapses its model picker to Default (#25786)
Co-authored-by: maria-rcks <[email protected]>
1 parent b5ced43 commit c3f0a6c

2 files changed

Lines changed: 50 additions & 1 deletion

File tree

‎packages/provider-acp-registry/src/server/driver.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,37 @@ describe("acpRegistrySnapshotReadiness", () => {
175175
nativeSessions: { canList: true, canLoad: true, canResume: true },
176176
models: [{ slug: "live-model", isDefault: true }],
177177
});
178+
179+
expect(
180+
applyAcpRegistryLiveConfiguration(
181+
provider,
182+
{ models: [], currentModelId: null, configOptions: [] },
183+
[],
184+
).models,
185+
).toEqual(provider.models);
186+
187+
const liveOptions = [
188+
{
189+
id: "effort",
190+
label: "Effort",
191+
type: "select" as const,
192+
options: [{ id: "high", label: "High" }],
193+
currentValue: "high",
194+
},
195+
];
196+
expect(
197+
applyAcpRegistryLiveConfiguration(
198+
provider,
199+
{ models: [], currentModelId: null, configOptions: liveOptions },
200+
[],
201+
).models,
202+
).toMatchObject([
203+
{
204+
slug: "probe-model",
205+
isDefault: true,
206+
capabilities: { optionDescriptors: [{ id: "effort", currentValue: "high" }] },
207+
},
208+
]);
178209
});
179210

180211
it("projects discovery without claiming authentication when no login methods are advertised", () => {

‎packages/provider-acp-registry/src/server/driver.ts‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,28 @@ export function applyAcpRegistryLiveConfiguration(
258258
customModels: ReadonlyArray<string>,
259259
): ServerProvider {
260260
const { message: _staleProbeMessage, ...snapshot } = provider;
261+
// session/load may omit models (Kimi returns `{}`); keep the probed list
262+
// and apply any live option descriptors to it.
263+
const probedModels = provider.models.filter((model) => !model.isCustom);
264+
const discovery =
265+
configuration.models.length > 0
266+
? configuration
267+
: {
268+
...configuration,
269+
models: probedModels.map((model) => ({
270+
id: model.slug,
271+
name: model.name,
272+
description: null,
273+
})),
274+
currentModelId: probedModels.find((model) => model.isDefault)?.slug ?? null,
275+
};
261276
return {
262277
...snapshot,
263278
status: provider.enabled ? "ready" : provider.status,
264-
models: modelsFromDiscovery(configuration, customModels),
279+
models:
280+
configuration.models.length === 0 && configuration.configOptions.length === 0
281+
? provider.models
282+
: modelsFromDiscovery(discovery, customModels),
265283
};
266284
}
267285

0 commit comments

Comments
 (0)