





















@@ -15,6 +15,10 @@ import {
1515removeProviderAuthProfilesWithLock,
1616resolvePersistedAuthProfileOwnerAgentDir,
1717} from "../../agents/auth-profiles.js";
18+import {
19+clearCurrentProviderAuthState,
20+warmCurrentProviderAuthState,
21+} from "../../agents/model-provider-auth.js";
1822import { resolveProviderIdForAuth } from "../../agents/provider-auth-aliases.js";
1923import { normalizeProviderId } from "../../agents/provider-id.js";
2024import type { OpenClawConfig } from "../../config/config.js";
@@ -89,6 +93,12 @@ let cached: { ts: number; result: ModelAuthStatusResult } | null = null;
8993 */
9094export function invalidateModelAuthStatusCache(): void {
9195cached = null;
96+// The prepared provider-auth map (model-provider-auth.ts) was built from
97+// the pre-mutation auth state, so it must be invalidated alongside this
98+// cache whenever an auth-profile mutation lands (logout, login, token
99+// rotation, etc.). Without this, `/models` and pickers keep advertising
100+// providers the running gateway can no longer authenticate.
101+clearCurrentProviderAuthState();
92102}
9310394104function readProviderParam(params: Record<string, unknown>): string | null {
@@ -380,6 +390,9 @@ export const modelsAuthStatusHandlers: GatewayRequestHandlers = {
380390}
381391await refreshActiveSecretsRuntimeSnapshot();
382392invalidateModelAuthStatusCache();
393+void warmCurrentProviderAuthState(context.getRuntimeConfig()).catch((err) => {
394+log.warn(`provider auth state rewarm after logout failed: ${formatForLog(err)}`);
395+});
383396const { runIds: abortedRunIds } = abortChatRunsForProvider(
384397createAuthLogoutAbortOps(context),
385398{
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。