Skip to content

Commit 9b04f82

Browse files
authored
refactor: remove dead auth status projection (#129358)
Removed the inert auth-status alias projection, its obsolete copied-credential coverage, and the unused provider set so the Gateway returns canonical provider health directly.
1 parent 1e68499 commit 9b04f82

3 files changed

Lines changed: 10 additions & 110 deletions

File tree

‎src/gateway/server-methods/models-auth-status-projection.ts‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎src/gateway/server-methods/models-auth-status.test.ts‎

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -807,65 +807,6 @@ describe("models.authStatus", () => {
807807
expect(provider).toMatchObject({ provider: "minimax-portal", status: "expired" });
808808
});
809809

810-
it("does not publish a synthetic Anthropic missing row beside owned Claude CLI OAuth", async () => {
811-
const profileId = "anthropic:claude-cli";
812-
mocks.getRuntimeConfig.mockReturnValue({
813-
auth: { profiles: { [profileId]: { provider: "anthropic", mode: "token" } } },
814-
});
815-
const profile = {
816-
profileId,
817-
provider: "claude-cli",
818-
type: "oauth",
819-
status: "expired",
820-
expiresAt: 1,
821-
remainingMs: -1,
822-
source: "store",
823-
label: profileId,
824-
} satisfies AuthHealthSummary["profiles"][number];
825-
setPreparedAuthStore(
826-
Object.assign(
827-
{
828-
version: 1,
829-
profiles: {
830-
[profileId]: {
831-
type: "oauth",
832-
provider: "claude-cli",
833-
access: "expired-access",
834-
refresh: "cli-owned-refresh",
835-
expires: 1,
836-
} satisfies AuthProfileStore["profiles"][string],
837-
},
838-
},
839-
{ runtimeExternalCliProfileIds: [profileId] },
840-
),
841-
);
842-
mocks.buildAuthHealthSummary.mockReturnValue({
843-
now: 2,
844-
warnAfterMs: 0,
845-
profiles: [profile],
846-
providers: [
847-
{ provider: "anthropic", status: "missing", profiles: [] },
848-
{
849-
provider: "claude-cli",
850-
status: "expired",
851-
expiresAt: 1,
852-
remainingMs: -1,
853-
profiles: [profile],
854-
},
855-
],
856-
});
857-
858-
const result = await readAuthStatus();
859-
860-
expect(result.providers).toEqual([
861-
expect.objectContaining({
862-
provider: "claude-cli",
863-
status: "ok",
864-
profiles: [expect.anything()],
865-
}),
866-
]);
867-
});
868-
869810
it("keeps a missing Anthropic row when its model route has independent auth config", async () => {
870811
const profileId = "anthropic:claude-cli";
871812
mocks.getRuntimeConfig.mockReturnValue({

‎src/gateway/server-methods/models-auth-status.ts‎

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import { formatForLog } from "../ws-log.js";
4747
import { modelAuthAgentScopeError, resolveModelAuthAgentScope } from "./model-auth-agent-scope.js";
4848
import { resolveModelProviderCapabilities } from "./model-provider-capabilities.js";
4949
import { resolveProviderApiKeys } from "./models-auth-status-api-keys.js";
50-
import { suppressSyntheticAliasRowsCoveredByExternalCli } from "./models-auth-status-projection.js";
5150
import {
5251
clearModelAuthStatusUsageCache,
5352
type ProviderUsageStatus,
@@ -376,11 +375,9 @@ function resolveConfiguredProviders(
376375
): {
377376
providers: string[];
378377
expectsOAuth: Set<string>;
379-
directModelAuthProviders: Set<string>;
380378
} {
381379
const out = new Set<string>();
382380
const expectsOAuth = new Set<string>();
383-
const directModelAuthProviders = new Set<string>();
384381
for (const [id, provider] of Object.entries(cfg.models?.providers ?? {})) {
385382
const normalized = normalizeProviderId(id);
386383
if (!normalized) {
@@ -395,7 +392,6 @@ function resolveConfiguredProviders(
395392
if (mode !== "oauth" && mode !== "token" && !hasApiKey) {
396393
continue;
397394
}
398-
directModelAuthProviders.add(normalized);
399395
if (apiKeys.has(normalized)) {
400396
continue;
401397
}
@@ -427,7 +423,7 @@ function resolveConfiguredProviders(
427423
expectsOAuth.add(normalized);
428424
}
429425
}
430-
return { providers: Array.from(out), expectsOAuth, directModelAuthProviders };
426+
return { providers: Array.from(out), expectsOAuth };
431427
}
432428

433429
export const modelsAuthStatusHandlers: GatewayRequestHandlers = {
@@ -645,20 +641,16 @@ export const modelsAuthStatusHandlers: GatewayRequestHandlers = {
645641
.map(([profileId]) => profileId),
646642
);
647643
const configBoundProfileIds = resolveConfigBoundProfileIds(cfg, store, authAliasLookupParams);
648-
const providers = suppressSyntheticAliasRowsCoveredByExternalCli(
649-
authHealth.providers.map((prov) =>
650-
mapProvider(
651-
prov,
652-
usageByProvider,
653-
configured.expectsOAuth,
654-
apiKeys,
655-
logoutProfileIds,
656-
configBoundProfileIds,
657-
externalCliProfileIds,
658-
),
644+
const providers = authHealth.providers.map((prov) =>
645+
mapProvider(
646+
prov,
647+
usageByProvider,
648+
configured.expectsOAuth,
649+
apiKeys,
650+
logoutProfileIds,
651+
configBoundProfileIds,
652+
externalCliProfileIds,
659653
),
660-
externalCliProfileIds,
661-
new Map(),
662654
);
663655
const providerCapabilities = buildProviderCapabilities({
664656
config: cfg,

0 commit comments

Comments
 (0)