@devries-cameron20 / t3code Mirror · read-only / commits / 3adac9403f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 03:00 UTC

fix(server): ACP agents that need no sign-in drop models they stopped advertising (#18807)

Igor Makowski committed Oct 18, 2026 at 22:10 UTC 3adac9403fd8a85f32ff0c2f9f0c236051f1f040
2 files changed +54 -5
apps/server/src/provider/ProviderRegistry.test.ts
+47
@@ -849,6 +849,7 @@ it.layer(
849 },
850 { slug: "default", name: "Default", isCustom: false, capabilities: null },
851 ],
852 + nativeSessions: { canList: false, canLoad: false, canResume: false },
853 slashCommands: [],
854 skills: [],
855 } as const satisfies ServerProvider;
@@ -864,6 +865,37 @@ it.layer(
865 );
866 });
867
868 + it("drops stale ACP Registry models when an agent without sign-in completes discovery", () => {
869 + const previousProvider = {
870 + instanceId: ProviderInstanceId.make("acpRegistry_kimi"),
871 + driver: ProviderDriverKind.make("acpRegistry"),
872 + status: "ready",
873 + enabled: true,
874 + installed: true,
875 + auth: { status: "unknown", canLogout: false },
876 + checkedAt: "2026-08-13T00:00:00.000Z",
877 + version: "1.2.0",
878 + models: [
879 + { slug: "kimi-old", name: "Kimi Old", isCustom: false, capabilities: null },
880 + { slug: "default", name: "Default", isCustom: false, capabilities: null },
881 + ],
882 + nativeSessions: { canList: true, canLoad: true, canResume: false },
883 + slashCommands: [],
884 + skills: [],
885 + } as const satisfies ServerProvider;
886 + // Agents that advertise no auth methods stay "unknown" after every probe.
887 + const probedProvider = {
888 + ...previousProvider,
889 + checkedAt: "2026-08-13T00:01:00.000Z",
890 + models: [{ slug: "kimi-new", name: "Kimi New", isCustom: false, capabilities: null }],
891 + } satisfies ServerProvider;
892 +
893 + assert.deepStrictEqual(
894 + ProviderRegistry.mergeProviderSnapshot(previousProvider, probedProvider).models,
895 + [...probedProvider.models],
896 + );
897 + });
898 +
899 it("retains ACP Registry models while discovery has not completed", () => {
900 const previousProvider = {
901 instanceId: ProviderInstanceId.make("acpRegistry_codex"),
@@ -882,11 +914,19 @@ it.layer(
914 ...previousProvider,
915 checkedAt: "2026-08-13T00:01:00.000Z",
916 auth: { status: "unknown" },
917 + message: "Checking ACP authentication, models, and commands in the background...",
918 models: [{ slug: "default", name: "Default", isCustom: false, capabilities: null }],
919 } satisfies ServerProvider;
920 + // A saved sign-in confirmation marks the readiness snapshot authenticated
921 + // before discovery has run.
922 + const confirmedCheckingProvider = {
923 + ...checkingProvider,
924 + auth: { status: "authenticated" },
925 + } satisfies ServerProvider;
926 const failedProbeProvider = {
927 ...checkingProvider,
928 status: "warning",
929 + message: "ACP discovery failed.",
930 } satisfies ServerProvider;
931
932 assert.deepStrictEqual(
@@ -896,6 +936,13 @@ it.layer(
936 { slug: "gpt-5.6-sol", name: "GPT-5.6-Sol", isCustom: false, capabilities: null },
937 ],
938 );
939 + assert.deepStrictEqual(
940 + ProviderRegistry.mergeProviderSnapshot(previousProvider, confirmedCheckingProvider).models,
941 + [
942 + { slug: "default", name: "Default", isCustom: false, capabilities: null },
943 + { slug: "gpt-5.6-sol", name: "GPT-5.6-Sol", isCustom: false, capabilities: null },
944 + ],
945 + );
946 assert.deepStrictEqual(
947 ProviderRegistry.mergeProviderSnapshot(previousProvider, failedProbeProvider).models,
948 [
apps/server/src/provider/ProviderRegistry.ts
+7 -5
@@ -157,14 +157,16 @@ const shouldRetainMissingProviderModels = (provider: ServerProvider): boolean =>
157
158 if (provider.driver === ProviderDriverKind.make("acpRegistry")) {
159 // ACP Registry discovery probes return the agent's complete inventory, so
160 - // a completed probe (ready and authenticated) replaces the model list —
161 - // otherwise agents that rename or collapse models leave stale entries
162 - // pinned forever through the snapshot cache. Readiness-only and failed
163 - // probe snapshots only know the "default" placeholder and stay partial.
160 + // a completed probe replaces the model list — otherwise agents that rename
161 + // or collapse models leave stale entries pinned forever through the
162 + // snapshot cache. Only a completed probe reports `nativeSessions`;
163 + // readiness-only and failed probe snapshots only know the "default"
164 + // placeholder and stay partial. Auth is no signal here: agents without
165 + // sign-in stay "unknown" after every probe.
166 return !(
167 provider.installed &&
168 provider.status === "ready" &&
167 - provider.auth.status === "authenticated"
169 + provider.nativeSessions !== undefined
170 );
171 }
172