fix: add missing await for async functions after sync-to-async migration

- getOAuthTokenFromOpenClaw: make async to properly await readAuthProfiles
- secure-storage: add await for getActiveOpenClawProviders call
- ipc-handlers: add await for updateAgentModelProvider in OAuth flow

Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-02-27 12:02:49 +00:00
parent d8be0b085b
commit 786b0de361
3 changed files with 5 additions and 5 deletions

View File

@@ -1192,7 +1192,7 @@ function registerProviderHandlers(gatewayManager: GatewayManager): void {
// authHeader immediately, without waiting for Gateway to sync openclaw.json. // authHeader immediately, without waiting for Gateway to sync openclaw.json.
try { try {
const defaultModelId = provider.model?.split('/').pop(); const defaultModelId = provider.model?.split('/').pop();
updateAgentModelProvider(targetProviderKey, { await updateAgentModelProvider(targetProviderKey, {
baseUrl, baseUrl,
api, api,
authHeader: targetProviderKey === 'minimax-portal' ? true : undefined, authHeader: targetProviderKey === 'minimax-portal' ? true : undefined,

View File

@@ -181,12 +181,12 @@ export async function saveOAuthTokenToOpenClaw(
* @param agentId - Optional single agent ID to read from, defaults to 'main' * @param agentId - Optional single agent ID to read from, defaults to 'main'
* @returns The OAuth token access string or null if not found * @returns The OAuth token access string or null if not found
*/ */
export function getOAuthTokenFromOpenClaw( export async function getOAuthTokenFromOpenClaw(
provider: string, provider: string,
agentId = 'main' agentId = 'main'
): string | null { ): Promise<string | null> {
try { try {
const store = readAuthProfiles(agentId); const store = await readAuthProfiles(agentId);
const profileId = `${provider}:default`; const profileId = `${provider}:default`;
const profile = store.profiles[profileId]; const profile = store.profiles[profileId];

View File

@@ -214,7 +214,7 @@ export async function getAllProvidersWithKeyInfo(): Promise<
> { > {
const providers = await getAllProviders(); const providers = await getAllProviders();
const results: Array<ProviderConfig & { hasKey: boolean; keyMasked: string | null }> = []; const results: Array<ProviderConfig & { hasKey: boolean; keyMasked: string | null }> = [];
const activeOpenClawProviders = getActiveOpenClawProviders(); const activeOpenClawProviders = await getActiveOpenClawProviders();
// We need to avoid deleting native ones like 'anthropic' or 'google' // We need to avoid deleting native ones like 'anthropic' or 'google'
// that don't need to exist in openclaw.json models.providers // that don't need to exist in openclaw.json models.providers