GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(acp-registry): keep provisional model-specific options off retain… · pingdotgg/t3code@dc8adf1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/provider-acp-registry/src/server
    • driver.test.ts
    • driver.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: packages/provider-acp-registry/src/server/driver.test.ts
+89-12Lines changed: 89 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,41 @@ describe("acpRegistrySnapshotReadiness", () => {
771771
"auto",
772772
);
773773

774+
const entitledEffort = {
775+
id: "effort",
776+
label: "Effort",
777+
type: "select" as const,
778+
currentValue: "high",
779+
options: [
780+
{ id: "low", label: "Low" },
781+
{ id: "high", label: "High" },
782+
],
783+
};
784+
const placeholderEffort = {
785+
id: "effort",
786+
label: "Effort",
787+
type: "select" as const,
788+
currentValue: "on",
789+
options: [
790+
{ id: "off", label: "Off" },
791+
{ id: "on", label: "On" },
792+
],
793+
};
794+
const sharedMode = {
795+
id: "mode",
796+
label: "Mode",
797+
type: "select" as const,
798+
currentValue: "code",
799+
options: [{ id: "code", label: "Code" }],
800+
};
801+
774802
const entitled = applyAcpRegistryLiveConfiguration(
775803
provider,
776804
{
777805
models: [{ id: "gmodel", name: "GPT-Pro", description: null }],
778806
currentModelId: "gmodel",
779-
configOptions: [],
807+
configOptions: [entitledEffort],
808+
modelOptionIds: ["effort"],
780809
modelsFromModelSelect: true,
781810
},
782811
[],
@@ -789,7 +818,8 @@ describe("acpRegistrySnapshotReadiness", () => {
789818
{
790819
models: [{ id: "placeholder", name: "Placeholder", description: null }],
791820
currentModelId: "placeholder",
792-
configOptions: [],
821+
configOptions: [placeholderEffort, sharedMode],
822+
modelOptionIds: ["effort"],
793823
modelsFromModelSelect: false,
794824
},
795825
[],
@@ -798,6 +828,24 @@ describe("acpRegistrySnapshotReadiness", () => {
798828
);
799829
expect(afterProvisional.models.map((m) => m.slug)).toEqual(["gmodel"]);
800830
expect(afterProvisional.models.find((m) => m.slug === "gmodel")?.isDefault).toBe(true);
831+
expect(
832+
afterProvisional.models.find((m) => m.slug === "gmodel")?.capabilities?.optionDescriptors,
833+
).toEqual([sharedMode, entitledEffort]);
834+
835+
const afterProvisionalModelOnly = applyAcpRegistryLiveConfiguration(
836+
entitled,
837+
{
838+
models: [{ id: "placeholder", name: "Placeholder", description: null }],
839+
currentModelId: "placeholder",
840+
configOptions: [placeholderEffort],
841+
modelOptionIds: ["effort"],
842+
modelsFromModelSelect: false,
843+
},
844+
[],
845+
entitled.models,
846+
{ preserveSingleModelCatalog: true },
847+
);
848+
expect(afterProvisionalModelOnly.models).toBe(entitled.models);
801849

802850
const replacedExplicit = applyAcpRegistryLiveConfiguration(
803851
entitled,
@@ -1710,7 +1758,19 @@ it.layer(driverLayer)("AcpRegistryDriver periodic refresh", (it) => {
17101758
yield* coordinator.publishLiveConfiguration(identity.instanceId, {
17111759
models: [{ id: "entitled-model", name: "Entitled", description: null }],
17121760
currentModelId: "entitled-model",
1713-
configOptions: [],
1761+
configOptions: [
1762+
{
1763+
id: "effort",
1764+
label: "Effort",
1765+
type: "select",
1766+
currentValue: "high",
1767+
options: [
1768+
{ id: "low", label: "Low" },
1769+
{ id: "high", label: "High" },
1770+
],
1771+
},
1772+
],
1773+
modelOptionIds: ["effort"],
17141774
modelsFromModelSelect: true,
17151775
});
17161776
yield* Fiber.join(liveApplied);
@@ -1730,13 +1790,13 @@ it.layer(driverLayer)("AcpRegistryDriver periodic refresh", (it) => {
17301790
).toEqual(Option.some("entitled-model"));
17311791

17321792
// A subsequent provisional single-model live update must not replace the explicit singleton
1733-
// catalog or downgrade its provenance.
1793+
// catalog, overwrite its model-specific options, or downgrade its provenance.
17341794
const provisionalProcessed = yield* instance.snapshot.streamChanges.pipe(
17351795
Stream.filter(
17361796
(snapshot) =>
17371797
snapshot.models
17381798
.find((model) => model.slug === "entitled-model")
1739-
?.capabilities?.optionDescriptors?.some((option) => option.id === "effort") === true,
1799+
?.capabilities?.optionDescriptors?.some((option) => option.id === "mode") === true,
17401800
),
17411801
Stream.runHead,
17421802
Effect.forkScoped({ startImmediately: true }),
@@ -1745,24 +1805,41 @@ it.layer(driverLayer)("AcpRegistryDriver periodic refresh", (it) => {
17451805
models: [{ id: "live-placeholder", name: "Live Placeholder", description: null }],
17461806
currentModelId: "live-placeholder",
17471807
configOptions: [
1808+
{
1809+
id: "mode",
1810+
label: "Mode",
1811+
type: "select",
1812+
currentValue: "code",
1813+
options: [{ id: "code", label: "Code" }],
1814+
},
17481815
{
17491816
id: "effort",
17501817
label: "Effort",
17511818
type: "select",
1752-
currentValue: "high",
1819+
currentValue: "on",
17531820
options: [
1754-
{ id: "low", label: "Low" },
1755-
{ id: "high", label: "High" },
1821+
{ id: "off", label: "Off" },
1822+
{ id: "on", label: "On" },
17561823
],
17571824
},
17581825
],
1826+
modelOptionIds: ["effort"],
17591827
modelsFromModelSelect: false,
17601828
});
1829+
const retainedAfterProvisional = Option.getOrThrow(yield* Fiber.join(provisionalProcessed));
1830+
expect(retainedAfterProvisional.models.map((model) => model.slug)).toEqual([
1831+
"entitled-model",
1832+
]);
17611833
expect(
1762-
Option.getOrThrow(yield* Fiber.join(provisionalProcessed)).models.map(
1763-
(model) => model.slug,
1764-
),
1765-
).toEqual(["entitled-model"]);
1834+
retainedAfterProvisional.models
1835+
.find((model) => model.slug === "entitled-model")
1836+
?.capabilities?.optionDescriptors?.find((option) => option.id === "effort"),
1837+
).toMatchObject({
1838+
options: [
1839+
{ id: "low", label: "Low" },
1840+
{ id: "high", label: "High" },
1841+
],
1842+
});
17661843

17671844
yield* fileSystem.writeFileString(modelsPath, JSON.stringify({ provisional: "placeholder" }));
17681845
yield* TestClock.adjust("16 minutes");
Collapse file

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

Copy file name to clipboardExpand all lines: packages/provider-acp-registry/src/server/driver.ts
+34-12Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,26 @@ export function applyAcpRegistryLiveConfiguration(
455455
const useLiveCatalog =
456456
configuration.models.length > 1 ||
457457
(configuration.models.length === 1 && !liveCatalogIsProvisional);
458-
const selectedProbedModelId =
458+
const liveCurrentModelInProbed =
459459
configuration.currentModelId !== null &&
460-
probedModels.some((model) => model.slug === configuration.currentModelId)
461-
? configuration.currentModelId
462-
: (probedModels.find((model) => model.isDefault)?.slug ?? null);
460+
probedModels.some((model) => model.slug === configuration.currentModelId);
461+
const selectedProbedModelId = liveCurrentModelInProbed
462+
? configuration.currentModelId
463+
: (probedModels.find((model) => model.isDefault)?.slug ?? null);
464+
// When retaining the probed catalog for a live session running an absent
465+
// model (e.g. a cold-start placeholder), keep only shared options and leave
466+
// each retained model's own learned options untouched.
467+
const dropUnmatchedModelOptions =
468+
!useLiveCatalog && configuration.currentModelId !== null && !liveCurrentModelInProbed;
469+
const unmatchedModelOptionIds = dropUnmatchedModelOptions
470+
? new Set(configuration.modelOptionIds ?? [])
471+
: EMPTY_SLUG_SET;
472+
const effectiveConfigOptions =
473+
unmatchedModelOptionIds.size === 0
474+
? configuration.configOptions
475+
: configuration.configOptions.filter(
476+
(descriptor) => !unmatchedModelOptionIds.has(descriptor.id),
477+
);
463478
const discovery = useLiveCatalog
464479
? configuration
465480
: {
@@ -469,19 +484,26 @@ export function applyAcpRegistryLiveConfiguration(
469484
name: model.name,
470485
description: null,
471486
})),
472-
currentModelId: selectedProbedModelId,
487+
currentModelId: dropUnmatchedModelOptions
488+
? configuration.currentModelId
489+
: selectedProbedModelId,
490+
configOptions: effectiveConfigOptions,
473491
};
492+
const nextModels =
493+
!useLiveCatalog && effectiveConfigOptions.length === 0
494+
? withAcpRegistryDefaultModel(provider.models, selectedProbedModelId)
495+
: modelsFromDiscovery(
496+
discovery,
497+
customModels,
498+
previousModels.filter((model) => !model.isCustom),
499+
);
474500
return {
475501
...snapshot,
476502
status: provider.enabled ? "ready" : provider.status,
477503
models:
478-
!useLiveCatalog && configuration.configOptions.length === 0
479-
? withAcpRegistryDefaultModel(provider.models, selectedProbedModelId)
480-
: modelsFromDiscovery(
481-
discovery,
482-
customModels,
483-
previousModels.filter((model) => !model.isCustom),
484-
),
504+
dropUnmatchedModelOptions && effectiveConfigOptions.length > 0
505+
? withAcpRegistryDefaultModel(nextModels, selectedProbedModelId)
506+
: nextModels,
485507
};
486508
}
487509

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.