From 74de1aba48c179763a989051236474cde84a969a Mon Sep 17 00:00:00 2001 From: yiling Date: Tue, 9 Jun 2026 09:09:33 +0800 Subject: [PATCH] fix(agent): remove redundant fileCount increments in tool activities --- packages/agent/src/activities/agent.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/agent/src/activities/agent.ts b/packages/agent/src/activities/agent.ts index 90d7d3dd..9b3ba599 100644 --- a/packages/agent/src/activities/agent.ts +++ b/packages/agent/src/activities/agent.ts @@ -866,12 +866,6 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams): creatorId: userId, }) - // Increment fileCount of parent folder - await prisma.asset.update({ - where: { id: parent }, - data: { fileCount: { increment: 1 } }, - }) - return { id: newFolder.id, name: newFolder.name, @@ -930,12 +924,8 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams): creatorId: userId, }) - // Increment fileCount of parent and update ancestor size + // Increment update ancestor size await prisma.$transaction(async (tx) => { - await tx.asset.update({ - where: { id: parent }, - data: { fileCount: { increment: 1 } }, - }) // eslint-disable-next-line @typescript-eslint/no-explicit-any await assetService.updateAncestorsSize(tx as any, parent, fileSize) @@ -1026,11 +1016,10 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams): where: { id: newFile.id }, data: { sortIndex: newSortIndex }, }) - // Increment stack's fileCount and size + // Increment stack's size (fileCount is incremented by createAsset already) const updatedStack = await tx.asset.update({ where: { id: stackId }, data: { - fileCount: { increment: 1 }, sizeByte: { increment: fileSize }, }, })