diff --git a/packages/opencode/src/index.ts b/packages/opencode/src/index.ts index 38f51a5..e02bcf3 100644 --- a/packages/opencode/src/index.ts +++ b/packages/opencode/src/index.ts @@ -873,13 +873,15 @@ export const AnthropicAuthPlugin: Plugin = async (ctx) => { ReturnType >, trace?: PerfTrace, + existingStorage?: Awaited>, ) { if (!isReplayableRequest(input, init?.body)) return mainResponse const loadStart = nowMs() - const storage = await loadAccounts() + const storage = existingStorage ?? (await loadAccounts()) trace?.mark('fallback_load_storage', { ms: roundMs(nowMs() - loadStart), + cached: !!existingStorage, }) let currentResponse = mainResponse let shouldFallback = shouldFallbackStatus( @@ -1022,6 +1024,7 @@ export const AnthropicAuthPlugin: Plugin = async (ctx) => { mainResponse, preselectedFallbackAccounts, trace, + storage, ) trace.done('return_response', { status: response.status })