Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(web): remove stale KV cache for allAgents and allColleagues (#323)
Gener057e8b5e491e
diff --git a/src/web/src/app/api/agent-links/[id]/route.ts b/src/web/src/app/api/agent-links/[id]/route.tsindex 9568d509b..454755f8c 100644--- a/src/web/src/app/api/agent-links/[id]/route.ts+++ b/src/web/src/app/api/agent-links/[id]/route.ts@@ -34,10 +34,7 @@ export const PATCH = withAuth(async (req, ctx) => {});if (!updated) return writeError("not found", 404);- await Promise.all([- invalidate(cacheKeys.allColleagues(ws.workspaceId)),- invalidate(cacheKeys.agentLinks(ws.workspaceId)),- ]);+ await invalidate(cacheKeys.agentLinks(ws.workspaceId));return writeJSON(agentLinkToResponse(updated));});@@ -64,10 +61,7 @@ export const DELETE = withAuth(async (req, ctx) => {const deleted = await queries.agentLink.remove(db, id, ws.workspaceId);if (!deleted) return writeError("not found", 404);- await Promise.all([- invalidate(cacheKeys.allColleagues(ws.workspaceId)),- invalidate(cacheKeys.agentLinks(ws.workspaceId)),- ]);+ await invalidate(cacheKeys.agentLinks(ws.workspaceId));return writeJSON(agentLinkToResponse(deleted));});diff --git a/src/web/src/app/api/agent-links/route.test.ts b/src/web/src/app/api/agent-links/route.test.tsindex 1f242985b..87e804a61 100644--- a/src/web/src/app/api/agent-links/route.test.ts+++ b/src/web/src/app/api/agent-links/route.test.ts@@ -240,7 +240,6 @@ describe("PUT /api/agent-links (upsert)", () => {const body = await res.json();expect(body.created).toBe(true);expect(body.instruction).toBe("delegate");- expect(mockInvalidate).toHaveBeenCalledWith("allColleagues:ws1");expect(mockInvalidate).toHaveBeenCalledWith("agentLinks:ws1");});diff --git a/src/web/src/app/api/agent-links/route.ts b/src/web/src/app/api/agent-links/route.tsindex 943230630..d79fdd4dc 100644--- a/src/web/src/app/api/agent-links/route.ts+++ b/src/web/src/app/api/agent-links/route.ts@@ -26,7 +26,7 @@ export const GET = withAuth(async (req: NextRequest, ctx) => {const offset = Number(url.searchParams.get("offset")) || 0;const [allAgents, allAccess] = await Promise.all([- cached(cacheKeys.allAgents(ws.workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId)),+ queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId),cached(cacheKeys.allAgentAccess(ws.workspaceId), 300, () => queries.agentAccess.getAllAgentAccessForWorkspace(db, ws.workspaceId)),]);const visibleIds = new Set(filterVisibleAgents(allAgents, ctx.userId, allAccess).map((a) => a.id));@@ -67,10 +67,7 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {targetAgentId: body.target_agent_id,instruction: body.instruction,});- await Promise.all([- invalidate(cacheKeys.allColleagues(ws.workspaceId)),- invalidate(cacheKeys.agentLinks(ws.workspaceId)),- ]);+ await invalidate(cacheKeys.agentLinks(ws.workspaceId));return writeJSON(agentLinkToResponse(created), 201);} catch (e) {if (isUniqueConstraintError(e)) {@@ -133,10 +130,7 @@ export const PUT = withAuth(async (req: NextRequest, ctx) => {created = false;}- await Promise.all([- invalidate(cacheKeys.allColleagues(ws.workspaceId)),- invalidate(cacheKeys.agentLinks(ws.workspaceId)),- ]);+ await invalidate(cacheKeys.agentLinks(ws.workspaceId));return writeJSON({ ...agentLinkToResponse(row), created }, created ? 201 : 200);});diff --git a/src/web/src/app/api/agents/[id]/access/[userId]/route.ts b/src/web/src/app/api/agents/[id]/access/[userId]/route.tsindex fb0455c1a..84ccfe697 100644--- a/src/web/src/app/api/agents/[id]/access/[userId]/route.ts+++ b/src/web/src/app/api/agents/[id]/access/[userId]/route.ts@@ -24,10 +24,6 @@ export const DELETE = withAuth(async (req: NextRequest, ctx) => {if (removeWhitelist && member?.userEmail) {await queries.whitelist.removeWhitelistByEmail(db, agentId, ws.workspaceId, member.userEmail);}- await Promise.all([- invalidate(cacheKeys.allAgents(ws.workspaceId)),- invalidate(cacheKeys.allAgentAccess(ws.workspaceId)),- invalidate(cacheKeys.allColleagues(ws.workspaceId)),- ]);+ await invalidate(cacheKeys.allAgentAccess(ws.workspaceId));return new Response(null, { status: 204 });});diff --git a/src/web/src/app/api/agents/[id]/access/route.ts b/src/web/src/app/api/agents/[id]/access/route.tsindex f0b114d56..d11362420 100644--- a/src/web/src/app/api/agents/[id]/access/route.ts+++ b/src/web/src/app/api/agents/[id]/access/route.ts@@ -44,10 +44,6 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {if (member?.userEmail) {await queries.whitelist.addWhitelist(db, id, ws.workspaceId, member.userEmail);}- await Promise.all([- invalidate(cacheKeys.allAgents(ws.workspaceId)),- invalidate(cacheKeys.allAgentAccess(ws.workspaceId)),- invalidate(cacheKeys.allColleagues(ws.workspaceId)),- ]);+ await invalidate(cacheKeys.allAgentAccess(ws.workspaceId));return writeJSON({ id: access.id, user_id: access.userId }, 201);});diff --git a/src/web/src/app/api/agents/[id]/route.ts b/src/web/src/app/api/agents/[id]/route.tsindex ccba38c55..8765b5f91 100644--- a/src/web/src/app/api/agents/[id]/route.ts+++ b/src/web/src/app/api/agents/[id]/route.ts@@ -75,10 +75,8 @@ export const PATCH = withAuth(async (req, ctx) => {await Promise.all([invalidate(cacheKeys.agent(ws.workspaceId, id)),- invalidate(cacheKeys.allAgents(ws.workspaceId)),invalidate(cacheKeys.allHandles(ws.workspaceId)),invalidate(cacheKeys.allAgentAccess(ws.workspaceId)),- invalidate(cacheKeys.allColleagues(ws.workspaceId)),]);return writeJSON(agentToResponse(updated));@@ -107,10 +105,8 @@ export const DELETE = withAuth(async (req, ctx) => {await Promise.all([invalidate(cacheKeys.agent(ws.workspaceId, id)),- invalidate(cacheKeys.allAgents(ws.workspaceId)),invalidate(cacheKeys.allHandles(ws.workspaceId)),invalidate(cacheKeys.allAgentAccess(ws.workspaceId)),- invalidate(cacheKeys.allColleagues(ws.workspaceId)),]);return new Response(null, { status: 204 });diff --git a/src/web/src/app/api/agents/active-task-counts/route.ts b/src/web/src/app/api/agents/active-task-counts/route.tsindex e5cbe709c..cf1b1b553 100644--- a/src/web/src/app/api/agents/active-task-counts/route.ts+++ b/src/web/src/app/api/agents/active-task-counts/route.ts@@ -15,7 +15,7 @@ export const GET = withAuth(async (req, ctx) => {const db = getDb((env as Env).DB);const [allAgents, allAccess] = await Promise.all([- cached(cacheKeys.allAgents(ws.workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId)),+ queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId),cached(cacheKeys.allAgentAccess(ws.workspaceId), 300, () => queries.agentAccess.getAllAgentAccessForWorkspace(db, ws.workspaceId)),]);const agents = filterVisibleAgents(allAgents, ctx.userId, allAccess);diff --git a/src/web/src/app/api/agents/active-tasks/route.ts b/src/web/src/app/api/agents/active-tasks/route.tsindex 6af8e744f..98b8d2d60 100644--- a/src/web/src/app/api/agents/active-tasks/route.ts+++ b/src/web/src/app/api/agents/active-tasks/route.ts@@ -15,7 +15,7 @@ export const GET = withAuth(async (req, ctx) => {const db = getDb((env as Env).DB);const [allAgents, allAccess] = await Promise.all([- cached(cacheKeys.allAgents(ws.workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId)),+ queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId),cached(cacheKeys.allAgentAccess(ws.workspaceId), 300, () => queries.agentAccess.getAllAgentAccessForWorkspace(db, ws.workspaceId)),]);const agents = filterVisibleAgents(allAgents, ctx.userId, allAccess);diff --git a/src/web/src/app/api/agents/recruit/route.ts b/src/web/src/app/api/agents/recruit/route.tsindex 65241cae4..83c882f8f 100644--- a/src/web/src/app/api/agents/recruit/route.ts+++ b/src/web/src/app/api/agents/recruit/route.ts@@ -103,10 +103,8 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {}await Promise.all([- invalidate(cacheKeys.allAgents(ws.workspaceId)),invalidate(cacheKeys.allHandles(ws.workspaceId)),invalidate(cacheKeys.allAgentAccess(ws.workspaceId)),- invalidate(cacheKeys.allColleagues(ws.workspaceId)),invalidate(cacheKeys.agentLinks(ws.workspaceId)),]);diff --git a/src/web/src/app/api/agents/route.ts b/src/web/src/app/api/agents/route.tsindex e411f984c..aff6d9526 100644--- a/src/web/src/app/api/agents/route.ts+++ b/src/web/src/app/api/agents/route.ts@@ -18,7 +18,7 @@ export const GET = withAuth(async (req, ctx) => {const db = getDb((env as Env).DB)const [allAgents, allAccess] = await Promise.all([- cached(cacheKeys.allAgents(ws.workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId)),+ queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId),cached(cacheKeys.allAgentAccess(ws.workspaceId), 300, () => queries.agentAccess.getAllAgentAccessForWorkspace(db, ws.workspaceId)),]);const agents = filterVisibleAgents(allAgents, ctx.userId, allAccess);@@ -87,7 +87,6 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {}await Promise.all([- invalidate(cacheKeys.allAgents(ws.workspaceId)),invalidate(cacheKeys.allHandles(ws.workspaceId)),invalidate(cacheKeys.allAgentAccess(ws.workspaceId)),]);diff --git a/src/web/src/app/api/agents/sidebar/reorder/route.ts b/src/web/src/app/api/agents/sidebar/reorder/route.tsindex 384f93e42..8aaf97921 100644--- a/src/web/src/app/api/agents/sidebar/reorder/route.ts+++ b/src/web/src/app/api/agents/sidebar/reorder/route.ts@@ -5,7 +5,7 @@ import { getDb } from "@/lib/db";import { withAuth } from "@/lib/middleware/auth";import { withWorkspaceMember } from "@/lib/middleware/workspace";import { writeError } from "@/lib/middleware/helpers";-import { cached, cacheKeys, invalidate } from "@/lib/cache";+import { cacheKeys, invalidate } from "@/lib/cache";export const PUT = withAuth(async (req: NextRequest, ctx) => {const ws = await withWorkspaceMember(req, ctx);@@ -27,7 +27,7 @@ export const PUT = withAuth(async (req: NextRequest, ctx) => {const db = getDb((env as Env).DB);const [agents, existingPins] = await Promise.all([- cached(cacheKeys.allAgents(ws.workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId)),+ queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId),queries.agentPin.listPins(db, ws.workspaceId, ctx.userId),]);const agentIds = new Set(agents.map((a) => a.id));diff --git a/src/web/src/app/api/studios/route.ts b/src/web/src/app/api/studios/route.tsindex 9e0dd8ce4..9c67a6892 100644--- a/src/web/src/app/api/studios/route.ts+++ b/src/web/src/app/api/studios/route.ts@@ -182,9 +182,7 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {const dateStr = new Date().toISOString().slice(0, 10);await Promise.all([- invalidate(cacheKeys.allAgents(ws.workspaceId)),invalidate(cacheKeys.allHandles(ws.workspaceId)),- invalidate(cacheKeys.allColleagues(ws.workspaceId)),invalidate(cacheKeys.allAgentAccess(ws.workspaceId)),invalidate(cacheKeys.allMembers(ws.workspaceId)),invalidate(cacheKeys.overviewTaskStats(ws.workspaceId, dateStr)),diff --git a/src/web/src/app/api/traces/[traceId]/route.ts b/src/web/src/app/api/traces/[traceId]/route.tsindex 5384e7e90..59014177b 100644--- a/src/web/src/app/api/traces/[traceId]/route.ts+++ b/src/web/src/app/api/traces/[traceId]/route.ts@@ -31,7 +31,7 @@ export const GET = withAuth(async (req: NextRequest, ctx) => {}const [allAgents, allAccess] = await Promise.all([- cached(cacheKeys.allAgents(ws.workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId)),+ queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId),cached(cacheKeys.allAgentAccess(ws.workspaceId), 300, () => queries.agentAccess.getAllAgentAccessForWorkspace(db, ws.workspaceId)),]);const agents = filterVisibleAgents(allAgents, ctx.userId, allAccess);diff --git a/src/web/src/app/api/traces/route.ts b/src/web/src/app/api/traces/route.tsindex ba7f3fbce..fa87a6d5d 100644--- a/src/web/src/app/api/traces/route.ts+++ b/src/web/src/app/api/traces/route.ts@@ -27,7 +27,7 @@ export const GET = withAuth(async (req: NextRequest, ctx) => {const result = await queries.task.listTraces(db, ws.workspaceId, { status, limit, before, multiAgent, agentId, channel });const [allAgents, allAccess] = await Promise.all([- cached(cacheKeys.allAgents(ws.workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId)),+ queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId),cached(cacheKeys.allAgentAccess(ws.workspaceId), 300, () => queries.agentAccess.getAllAgentAccessForWorkspace(db, ws.workspaceId)),]);const agents = filterVisibleAgents(allAgents, ctx.userId, allAccess);diff --git a/src/web/src/app/api/workspaces/[id]/overview/route.ts b/src/web/src/app/api/workspaces/[id]/overview/route.tsindex 8835e2b12..2d2141441 100644--- a/src/web/src/app/api/workspaces/[id]/overview/route.ts+++ b/src/web/src/app/api/workspaces/[id]/overview/route.ts@@ -25,7 +25,7 @@ export const GET = withAuth(async (req, ctx) => {const dateStr = todayStart.toISOString().slice(0, 10);const [allAgents, allAccess] = await Promise.all([- cached(cacheKeys.allAgents(ws.workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId)),+ queries.agent.getAllAgentsForWorkspace(db, ws.workspaceId),cached(cacheKeys.allAgentAccess(ws.workspaceId), 300, () => queries.agentAccess.getAllAgentAccessForWorkspace(db, ws.workspaceId)),]);const visibleAgents = filterVisibleAgents(allAgents, ctx.userId, allAccess);diff --git a/src/web/src/components/agent-edit-form.tsx b/src/web/src/components/agent-edit-form.tsxindex 6fccf246d..bdbcec960 100644--- a/src/web/src/components/agent-edit-form.tsx+++ b/src/web/src/components/agent-edit-form.tsx@@ -14,7 +14,8 @@ import { Label } from "@/components/ui/label";import { MarkdownEditor } from "@/components/ui/markdown-editor";import { RuntimeSelect } from "@/components/runtime-select";import { useWorkspace } from "@/contexts/workspace-context";-import { updateAgent as updateAgentApi } from "@/lib/api";+import { useAgentContext } from "@/contexts/agent-context";+import { getAgent as getAgentApi, updateAgent as updateAgentApi } from "@/lib/api";import { toast } from "sonner";import {GeneralFields,@@ -140,6 +141,7 @@ export function AgentEditForm({saving,}: AgentEditFormProps) {const { workspaceId } = useWorkspace();+ const { patchAgent } = useAgentContext();const [activeTab, setActiveTab] = useState<TabId>("general");const [name, setName] = useState(agent.name ?? "");const [description, setDescription] = useState(agent.description ?? "");@@ -166,6 +168,18 @@ export function AgentEditForm({const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);const savingInstructionsRef = useRef(false);+ useEffect(() => {+ let cancelled = false;+ getAgentApi(agent.id, workspaceId).then((fresh) => {+ if (cancelled) return;+ if (fresh.instructions !== instructionsRef.current && !savingInstructionsRef.current) {+ setInstructions(fresh.instructions);+ setSavedInstructions(fresh.instructions);+ }+ }).catch(() => {});+ return () => { cancelled = true; };+ }, [agent.id, workspaceId]);+const scheduleInstructionSaveRef = useRef<() => void>(() => {});const flushInstructions = useCallback(async () => {@@ -176,6 +190,7 @@ export function AgentEditForm({try {await updateAgentApi(agent.id, { instructions: current }, workspaceId);setSavedInstructions(current);+ patchAgent(agent.id, { instructions: current });} catch (err) {toast.error(err instanceof Error ? err.message : "Failed to save instructions");} finally {@@ -184,7 +199,7 @@ export function AgentEditForm({scheduleInstructionSaveRef.current();}}- }, [agent.id, workspaceId]);+ }, [agent.id, workspaceId, patchAgent]);const scheduleInstructionSave = useCallback(() => {if (debounceRef.current) clearTimeout(debounceRef.current);diff --git a/src/web/src/contexts/agent-context.tsx b/src/web/src/contexts/agent-context.tsxindex 54f8d3c0a..5d8a8b33a 100644--- a/src/web/src/contexts/agent-context.tsx+++ b/src/web/src/contexts/agent-context.tsx@@ -66,6 +66,7 @@ interface AgentContextValue {getFirstOnlineRuntimeId: () => string;handleGenerateToken: () => Promise<string | null>;handleDeleteMachine: (daemonId: string) => Promise<boolean>;+ patchAgent: (id: string, fields: Partial<Agent>) => void;}const AgentContext = createContext<AgentContextValue | null>(null);@@ -395,6 +396,10 @@ export function AgentProvider({[reload, workspaceId]);+ const patchAgent = useCallback((id: string, fields: Partial<Agent>) => {+ setAgents((prev) => prev.map((a) => (a.id === id ? { ...a, ...fields } : a)));+ }, []);+return (<AgentContext.Providervalue={{@@ -422,6 +427,7 @@ export function AgentProvider({getFirstOnlineRuntimeId,handleGenerateToken,handleDeleteMachine,+ patchAgent,}}>{children}diff --git a/src/web/src/lib/api.ts b/src/web/src/lib/api.tsindex 3b0a327a7..7964a3552 100644--- a/src/web/src/lib/api.ts+++ b/src/web/src/lib/api.ts@@ -166,6 +166,9 @@ export const createAgent = (req: CreateAgentRequest, workspaceId: string) =>body: JSON.stringify(req),});+export const getAgent = (id: string, workspaceId: string) =>+ apiFetch<Agent>(`/api/agents/${id}${wsQuery(workspaceId)}`);+export const updateAgent = (id: string, req: UpdateAgentRequest, workspaceId: string) =>apiFetch<Agent>(`/api/agents/${id}${wsQuery(workspaceId)}`, {method: "PATCH",diff --git a/src/web/src/lib/cache.test.ts b/src/web/src/lib/cache.test.tsindex 3f5f39e42..9f2537e23 100644--- a/src/web/src/lib/cache.test.ts+++ b/src/web/src/lib/cache.test.ts@@ -224,8 +224,6 @@ describe("cache", () => {expect(cacheKeys.member("ws1", "usr1")).toBe("mem:ws1:usr1");expect(cacheKeys.user("usr1")).toBe("usr:usr1");expect(cacheKeys.allEmailAccounts("ws1")).toBe("ea:ws1");- expect(cacheKeys.allColleagues("ws1")).toBe("col:ws1");- expect(cacheKeys.allAgents("ws1")).toBe("agents:ws1");expect(cacheKeys.allHandles("ws1")).toBe("handles:ws1");expect(cacheKeys.heartbeat("ws1", "d1")).toBe("hb:ws1:d1");expect(cacheKeys.machineToken("al_1234567890abcdefghij_rest")).toBe("mt:al_1234567890abcdefg");@@ -256,12 +254,10 @@ describe("cache", () => {cacheKeys.allAgentAccess(ws),cacheKeys.allRuntimes(ws),cacheKeys.allMembers(ws),- cacheKeys.allAgents(ws),cacheKeys.allEmailAccounts(ws),- cacheKeys.allColleagues(ws),cacheKeys.allHandles(ws),]);- expect(keys.size).toBe(9);+ expect(keys.size).toBe(7);});it("overviewTaskStats includes date for cross-midnight isolation", () => {diff --git a/src/web/src/lib/cache.ts b/src/web/src/lib/cache.tsindex fd382509c..661039672 100644--- a/src/web/src/lib/cache.ts+++ b/src/web/src/lib/cache.ts@@ -162,9 +162,7 @@ export const cacheKeys = {agent: (workspaceId: string, agentId: string) => `ag:${workspaceId}:${agentId}`,heartbeat: (workspaceId: string, daemonId: string) => `hb:${workspaceId}:${daemonId}`,user: (userId: string) => `usr:${userId}`,- allAgents: (workspaceId: string) => `agents:${workspaceId}`,allEmailAccounts: (workspaceId: string) => `ea:${workspaceId}`,- allColleagues: (workspaceId: string) => `col:${workspaceId}`,agentLinks: (workspaceId: string) => `al:${workspaceId}`,allHandles: (workspaceId: string) => `handles:${workspaceId}`,overviewEmailAccounts: (workspaceId: string) => `ov_ea:${workspaceId}`,diff --git a/src/web/src/lib/services/sweep.ts b/src/web/src/lib/services/sweep.tsindex 5027d0f28..064f4c057 100644--- a/src/web/src/lib/services/sweep.ts+++ b/src/web/src/lib/services/sweep.ts@@ -47,7 +47,6 @@ export async function sweepStaleState(db: Database, workspaceId: string) {// Invalidate caches that sweep modifiedconst dateStr = new Date().toISOString().slice(0, 10);await Promise.all([- invalidate(cacheKeys.allAgents(workspaceId)),invalidate(cacheKeys.overviewTaskStats(workspaceId, dateStr)),invalidate(cacheKeys.activeTaskCounts(workspaceId)),]).catch(() => {});diff --git a/src/web/src/lib/services/task-payload-builder.ts b/src/web/src/lib/services/task-payload-builder.tsindex 0a5202a5b..0f776934b 100644--- a/src/web/src/lib/services/task-payload-builder.ts+++ b/src/web/src/lib/services/task-payload-builder.ts@@ -12,9 +12,9 @@ export class TaskPayloadBuilder {const [allAgents, allEmailAccounts, allColleagues] = agentIds.length > 0? await Promise.all([- cached(cacheKeys.allAgents(workspaceId), 300, () => queries.agent.getAllAgentsForWorkspace(this.db, workspaceId)),+ queries.agent.getAllAgentsForWorkspace(this.db, workspaceId),cached(cacheKeys.allEmailAccounts(workspaceId), 600, () => queries.emailAccount.getAllEmailAccountsForWorkspace(this.db, workspaceId)),- cached(cacheKeys.allColleagues(workspaceId), 600, () => queries.agentLink.getAllColleaguesForWorkspace(this.db, workspaceId)).catch(() => [] as Awaited<ReturnType<typeof queries.agentLink.getAllColleaguesForWorkspace>>),+ queries.agentLink.getAllColleaguesForWorkspace(this.db, workspaceId).catch(() => [] as Awaited<ReturnType<typeof queries.agentLink.getAllColleaguesForWorkspace>>),]).then(([agents, emails, colleagues]) => {const agentIdSet = new Set(agentIds);return [