Skip to content

Commit e8a6da7

Browse files
committed
fix(server): ACP agents that need no sign-in drop models they stopped advertising
The registry only replaced an ACP Registry agent's model list when the probe reported authenticated. Discovery probes always report auth as unknown, so agents with no sign-in never qualified and their stale models, plus the default placeholder, came back from the status cache on every refresh. Use the probe's nativeSessions, which only a completed discovery probe reports, as the signal instead of auth status. Readiness-only and failed probe snapshots keep the previous list.
1 parent 511d20c commit e8a6da7

2 files changed

Lines changed: 54 additions & 5 deletions

File tree

‎apps/server/src/provider/ProviderRegistry.test.ts‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ it.layer(
840840
},
841841
{ slug: "default", name: "Default", isCustom: false, capabilities: null },
842842
],
843+
nativeSessions: { canList: false, canLoad: false, canResume: false },
843844
slashCommands: [],
844845
skills: [],
845846
} as const satisfies ServerProvider;
@@ -855,6 +856,37 @@ it.layer(
855856
);
856857
});
857858

859+
it("drops stale ACP Registry models when an agent without sign-in completes discovery", () => {
860+
const previousProvider = {
861+
instanceId: ProviderInstanceId.make("acpRegistry_kimi"),
862+
driver: ProviderDriverKind.make("acpRegistry"),
863+
status: "ready",
864+
enabled: true,
865+
installed: true,
866+
auth: { status: "unknown", canLogout: false },
867+
checkedAt: "2026-08-13T00:00:00.000Z",
868+
version: "1.2.0",
869+
models: [
870+
{ slug: "kimi-old", name: "Kimi Old", isCustom: false, capabilities: null },
871+
{ slug: "default", name: "Default", isCustom: false, capabilities: null },
872+
],
873+
nativeSessions: { canList: true, canLoad: true, canResume: false },
874+
slashCommands: [],
875+
skills: [],
876+
} as const satisfies ServerProvider;
877+
// Agents that advertise no auth methods stay "unknown" after every probe.
878+
const probedProvider = {
879+
...previousProvider,
880+
checkedAt: "2026-08-13T00:01:00.000Z",
881+
models: [{ slug: "kimi-new", name: "Kimi New", isCustom: false, capabilities: null }],
882+
} satisfies ServerProvider;
883+
884+
assert.deepStrictEqual(
885+
ProviderRegistry.mergeProviderSnapshot(previousProvider, probedProvider).models,
886+
[...probedProvider.models],
887+
);
888+
});
889+
858890
it("retains ACP Registry models while discovery has not completed", () => {
859891
const previousProvider = {
860892
instanceId: ProviderInstanceId.make("acpRegistry_codex"),
@@ -873,11 +905,19 @@ it.layer(
873905
...previousProvider,
874906
checkedAt: "2026-08-13T00:01:00.000Z",
875907
auth: { status: "unknown" },
908+
message: "Checking ACP authentication, models, and commands in the background...",
876909
models: [{ slug: "default", name: "Default", isCustom: false, capabilities: null }],
877910
} satisfies ServerProvider;
911+
// A saved sign-in confirmation marks the readiness snapshot authenticated
912+
// before discovery has run.
913+
const confirmedCheckingProvider = {
914+
...checkingProvider,
915+
auth: { status: "authenticated" },
916+
} satisfies ServerProvider;
878917
const failedProbeProvider = {
879918
...checkingProvider,
880919
status: "warning",
920+
message: "ACP discovery failed.",
881921
} satisfies ServerProvider;
882922

883923
assert.deepStrictEqual(
@@ -887,6 +927,13 @@ it.layer(
887927
{ slug: "gpt-5.6-sol", name: "GPT-5.6-Sol", isCustom: false, capabilities: null },
888928
],
889929
);
930+
assert.deepStrictEqual(
931+
ProviderRegistry.mergeProviderSnapshot(previousProvider, confirmedCheckingProvider).models,
932+
[
933+
{ slug: "default", name: "Default", isCustom: false, capabilities: null },
934+
{ slug: "gpt-5.6-sol", name: "GPT-5.6-Sol", isCustom: false, capabilities: null },
935+
],
936+
);
890937
assert.deepStrictEqual(
891938
ProviderRegistry.mergeProviderSnapshot(previousProvider, failedProbeProvider).models,
892939
[

‎apps/server/src/provider/ProviderRegistry.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,16 @@ export function upsertProviderWorkspaceSnapshot(
211211
const shouldRetainMissingProviderModels = (provider: ServerProvider): boolean => {
212212
if (provider.driver === ProviderDriverKind.make("acpRegistry")) {
213213
// ACP Registry discovery probes return the agent's complete inventory, so
214-
// a completed probe (ready and authenticated) replaces the model list —
215-
// otherwise agents that rename or collapse models leave stale entries
216-
// pinned forever through the snapshot cache. Readiness-only and failed
217-
// probe snapshots only know the "default" placeholder and stay partial.
214+
// a completed probe replaces the model list — otherwise agents that rename
215+
// or collapse models leave stale entries pinned forever through the
216+
// snapshot cache. Only a completed probe reports `nativeSessions`;
217+
// readiness-only and failed probe snapshots only know the "default"
218+
// placeholder and stay partial. Auth is no signal here: agents without
219+
// sign-in stay "unknown" after every probe.
218220
return !(
219221
provider.installed &&
220222
provider.status === "ready" &&
221-
provider.auth.status === "authenticated"
223+
provider.nativeSessions !== undefined
222224
);
223225
}
224226

0 commit comments

Comments
 (0)