From 596dda907fb9d7db70ac52440b0db50195d835c1 Mon Sep 17 00:00:00 2001 From: Ella CEO Date: Thu, 16 Jul 2026 14:37:44 +0700 Subject: [PATCH] fix(agent): create built-in memory store when memory toolset is enabled despite skip_memory (#65429) skip_memory=True was meant to skip the external memory *provider* for flush/ background agents, but it also suppressed creation of the built-in file-backed MemoryStore. When a caller still enables the "memory" toolset, the memory tool dispatched with store=None and every call failed with "Memory is not available", silently losing the main automatic memory-capture path. Now the built-in store is created whenever memory is enabled in config OR the memory toolset is explicitly enabled, while the external-provider block stays gated on skip_memory (preserving flush-agent intent). --- agent/agent_init.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agent/agent_init.py b/agent/agent_init.py index 65c897c0c833..1477d4e98bb8 100644 --- a/agent/agent_init.py +++ b/agent/agent_init.py @@ -1561,7 +1561,14 @@ def init_agent( agent._memory_nudge_interval = 10 agent._turns_since_memory = 0 agent._iters_since_skill = 0 - if not skip_memory: + # A flush/background agent may pass skip_memory=True to avoid spinning up an + # external memory *provider*, but if the caller also explicitly enables the + # "memory" toolset it still needs the built-in file-backed store — otherwise + # the memory tool dispatches with store=None and every call fails (#65429). + # So the built-in store is created unless memory is globally disabled, while + # the external-provider block below stays gated on skip_memory. + _memory_toolset_requested = "memory" in (agent.enabled_toolsets or []) + if not skip_memory or _memory_toolset_requested: try: mem_config = _agent_cfg.get("memory", {}) agent._memory_enabled = mem_config.get("memory_enabled", False)