diff --git a/packages/opencode/src/account/index.ts b/packages/opencode/src/account/index.ts index 991ba29a94..a1bb614ce4 100644 --- a/packages/opencode/src/account/index.ts +++ b/packages/opencode/src/account/index.ts @@ -301,17 +301,15 @@ export namespace Account { const orgsByAccount = Effect.fn("Account.orgsByAccount")(function* () { const accounts = yield* repo.list() - const [errors, results] = yield* Effect.partition( + return yield* Effect.forEach( accounts, - (account) => orgs(account.id).pipe(Effect.map((orgs) => ({ account, orgs }))), + (account) => + orgs(account.id).pipe( + Effect.catch(() => Effect.succeed([] as readonly Org[])), + Effect.map((orgs) => ({ account, orgs })), + ), { concurrency: 3 }, ) - for (const error of errors) { - yield* Effect.logWarning("failed to fetch orgs for account").pipe( - Effect.annotateLogs({ error: String(error) }), - ) - } - return results }) const orgs = Effect.fn("Account.orgs")(function* (accountID: AccountID) { diff --git a/packages/opencode/src/server/routes/experimental.ts b/packages/opencode/src/server/routes/experimental.ts index 91350b24c7..a4b1f4d084 100644 --- a/packages/opencode/src/server/routes/experimental.ts +++ b/packages/opencode/src/server/routes/experimental.ts @@ -75,17 +75,7 @@ export const ExperimentalRoutes = lazy(() => }, }), async (c) => { - const [accounts, active] = await Promise.all([Account.list(), Account.active()]) - const groups = await Promise.all( - accounts.map(async (account) => { - try { - const orgs = await Account.orgs(account.id) - return { account, orgs } - } catch { - return { account, orgs: [] } - } - }), - ) + const [groups, active] = await Promise.all([Account.orgsByAccount(), Account.active()]) const orgs = groups.flatMap((group) => group.orgs.map((org) => ({