Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix: never pick the attachments folder as the MCP result folder

AdityaUmaleda2b0b570e41
diff --git a/server/index.ts b/server/index.ts
index de2419bde2..1341b96568 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -8569,7 +8569,7 @@ async function beginTurn(
...(integrations.browser && browserIsThePlace(turnSurfacePlan(bot, undefined, threadId, true)) ? { preloadBrowserTools: true } : {}),
...settingsTurnFields(cfg, DATA_DIR, managedPolicy.restrictsMcp()),
cwd,
- ...(worksInWorkspace || guestConfined || cloudGuestOpened(threadId) ? {} : { toolResultFolder: messageFileRootsForThread(bot.id, threadId)[0] }),
+ ...(worksInWorkspace || guestConfined || cloudGuestOpened(threadId) ? {} : { toolResultFolder: messageFileRootsForThread(bot.id, threadId).find((root) => root !== ATTACHMENTS_DIR) }),
botSettingsFile: botSettingsFile(bot),
}, (input) => quickFallback.sendTurn(instance, input, route.quickModel ? { model, own: bot.modelSelection, onFallback: () => store.patchMessage(threadId, userMessage.id, { quickModel: undefined }) } : undefined))), () => companyShutdown || !directTurnClaimExists(bot.id, dispatchClaimId, threadId), async () => {
await (runningTurnEngines.get(threadId) ?? instance).adapter.interruptTurn(threadId).catch(() => {});
@@ -10465,7 +10465,7 @@ async function runClaimedGroupMemberTurn(
system: roomSystem.text,
systemStable: roomSystem.stable,
systemVolatile: roomSystem.volatile,
- cwd, ...(worksInWorkspace || roomGuestConfined || cloudGuestOpened(threadId) ? {} : { toolResultFolder: messageFileRootsForThread(readyBot.id, threadId)[0] }),
+ cwd, ...(worksInWorkspace || roomGuestConfined || cloudGuestOpened(threadId) ? {} : { toolResultFolder: messageFileRootsForThread(readyBot.id, threadId).find((root) => root !== ATTACHMENTS_DIR) }),
integrations,
...(integrations.browser && browserIsThePlace(roomPlan) ? { preloadBrowserTools: true } : {}),
...settingsTurnFields(cfg, DATA_DIR, managedPolicy.restrictsMcp()),