fix: detach all memory tools when enabling memfs (#900)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Kevin Lin
2026-02-10 16:04:28 -08:00
committed by GitHub
parent 394aaf6777
commit f78d864f2d
5 changed files with 107 additions and 4 deletions

View File

@@ -15,6 +15,16 @@ import {
const CODEX_TOOLS = OPENAI_PASCAL_TOOLS;
const GEMINI_TOOLS = GEMINI_PASCAL_TOOLS;
// Server-side memory tool names that can mutate memory blocks.
// When memfs is enabled, we detach ALL of these from the agent.
export const MEMORY_TOOL_NAMES = new Set([
"memory",
"memory_apply_patch",
"memory_insert",
"memory_replace",
"memory_rethink",
]);
// Toolset type including snake_case variants
export type ToolsetName =
| "codex"
@@ -130,7 +140,7 @@ export async function detachMemoryTools(agentId: string): Promise<boolean> {
let detachedAny = false;
for (const tool of currentTools) {
if (tool.name === "memory" || tool.name === "memory_apply_patch") {
if (tool.name && MEMORY_TOOL_NAMES.has(tool.name)) {
if (tool.id) {
await client.agents.tools.detach(tool.id, { agent_id: agentId });
detachedAny = true;