diff --git a/foundry/packages/backend/CLAUDE.md b/foundry/packages/backend/CLAUDE.md index ce0b87f..949db90 100644 --- a/foundry/packages/backend/CLAUDE.md +++ b/foundry/packages/backend/CLAUDE.md @@ -29,6 +29,7 @@ WorkspaceActor - Branch rename is a real git operation, not just metadata. - `SandboxInstanceActor` stays separate from `TaskActor`; tasks/sessions reference it by identity. - Sync actors are polling workers only. They feed parent actors and should not become the source of truth. +- When a backend request path must aggregate multiple independent actor calls or reads, prefer bounded parallelism over sequential fan-out when correctness permits. Do not serialize independent work by default. ## Maintenance diff --git a/foundry/packages/backend/src/actors/workspace/app-shell.ts b/foundry/packages/backend/src/actors/workspace/app-shell.ts index ecbe6f3..7cae917 100644 --- a/foundry/packages/backend/src/actors/workspace/app-shell.ts +++ b/foundry/packages/backend/src/actors/workspace/app-shell.ts @@ -230,19 +230,23 @@ async function buildAppSnapshot(c: any, sessionId: string): Promise { + try { + const workspace = await getOrCreateWorkspace(c, organizationId); + const organizationState = await getOrganizationState(workspace); + return organizationState.snapshot; + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + if (!message.includes("Actor not found")) { + throw error; + } + return null; + } + }), + ) + ).filter((organization): organization is FoundryOrganization => organization !== null); const currentUser: FoundryUser | null = session.currentUserId ? {