Skip to content

The agent that grows with you

fix(memory): point the drift remediation and missing-args error at operations[]

Tekniumff706b7787f4
diff --git a/tools/memory_tool.py b/tools/memory_tool.py
index 5c485066661..abf8342f0b0 100644
--- a/tools/memory_tool.py
+++ b/tools/memory_tool.py
@@ -268,14 +268,14 @@ def _memory_tool(action, target, content, old_text, new_text, operations, store)
if gate_result is not None:
return "rejected", gate_result
return _applied(store.apply_batch(target, operations))
- # Reject calls that provide neither action (single-op) nor operations
- # (batch). Without this guard the dispatch falls through to the generic
+ # Reject calls with neither operations[] nor the legacy top-level action.
+ # Without this guard the dispatch falls through to the generic
# "Unknown action 'None'" error, which gives the model no signal about
# *why* the call was malformed and can trigger repeated retries. (#64291)
if not action and not operations:
return _invalid(
- "Missing required parameter: provide 'action' (add/patch/remove) "
- "or 'operations' (batch list). Got neither."
+ "Missing required parameter: 'operations', a list of {action: add/patch/remove, "
+ "content?, old_text?} changes; a single change is a one-item list."
)
if action == "replace":
return _invalid(_REPLACE_REMOVED)
diff --git a/tools/memory_tool_store.py b/tools/memory_tool_store.py
index 6d523428f11..097d69afcce 100644
--- a/tools/memory_tool_store.py
+++ b/tools/memory_tool_store.py
@@ -55,9 +55,9 @@ def _drift_error(path: Path, bak_path: str) -> dict[str, Any]:
f"either rewrite the file as a clean §-delimited list of entries, or move the extra "
f"content out — then retry. This guard exists to prevent silent data loss (issue #26045)."
), "drift", drift_backup=bak_path, remediation=(
- "Open the .bak file, integrate the missing entries into the memory tool one at a time via "
- f"memory(action=add, target='{_store_target(path.name)}', content=...), then remove or rewrite the "
- "original file to a clean state."))
+ "Open the .bak file, integrate the missing entries into the memory tool with one add op per entry via "
+ f"memory(target='{_store_target(path.name)}', operations=[{{action: 'add', content: ...}}]), then remove or "
+ "rewrite the original file to a clean state."))
def _read_failed_error(path: Path) -> dict[str, Any]: