Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/opencode/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -873,13 +873,15 @@ export const AnthropicAuthPlugin: Plugin = async (ctx) => {
ReturnType<FallbackAccountManager['getUsableFallbackAccounts']>
>,
trace?: PerfTrace,
existingStorage?: Awaited<ReturnType<typeof loadAccounts>>,
) {
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(
Expand Down Expand Up @@ -1022,6 +1024,7 @@ export const AnthropicAuthPlugin: Plugin = async (ctx) => {
mainResponse,
preselectedFallbackAccounts,
trace,
storage,
)

trace.done('return_response', { status: response.status })
Expand Down