You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] memory tool remove action rejects valid old_text arg with "old_text is required" error #43412
Bug
Calling the memory tool with action="remove" and a non-empty old_text argument
returns the error:
> old_text is required for 'remove' action.
…even when old_text is clearly populated.
Root cause
MEMORY_SCHEMA in tools/memory_tool.py:684-707 declares:
python
"required": ["action", "target"],
old_text is not in the required list. As a result, schema-aware LLM tool-calling
layers (and possibly some clients) drop the old_text argument before invoking the
handler. The handler at line 639-642 then sees an empty string and bails:
python
elif action == "remove":
if not old_text:
return tool_error("old_text is required for 'remove' action.", success=False)
result = store.remove(target, old_text)
The same affects replace (line 632-637).
Reproduction
1. Add two memory entries.
2. Call memory with action="remove", target="memory",
old_text="<a unique short substring of entry 1>".
3. Tool returns the "old_text is required" error.
Suggested fix
Make old_text part of the top-level required list — it is unused by add
(which never reads it), and the cost of always passing it is zero:
python
"required": ["action", "target", "old_text"],
A more correct but invasive alternative is to split the schema into
add_memory / replace_memory / remove_memory tools, each with its own
parameter set and required list.
Workaround
Edit ~/.hermes/memories/MEMORY.md directly with the patch tool — entries
are §-delimited, so deletions are straightforward as long as the trailing
Fixed on main via PR #49997 (commit c6bf6bd). Single-op replace/remove no longer dead-ends when old_text is dropped by a strict-schema client — it now returns the current entry inventory plus a retry instruction so the model can reissue with old_text set. Your root-cause analysis (old_text not in the schema required list → schema-aware layers strip it) was correct; we couldn't make it conditionally-required (the if/then form 400s on OpenAI's Codex backend), so the fix makes the missing-old_text case recoverable instead. Thanks for the precise report.
Activity
fix(memory): recover from missing old_text on single-op replace/remove (
teknium1 commentedon Jun 21, 2026
Fixed on main via PR #49997 (commit c6bf6bd). Single-op replace/remove no longer dead-ends when old_text is dropped by a strict-schema client — it now returns the current entry inventory plus a retry instruction so the model can reissue with old_text set. Your root-cause analysis (old_text not in the schema required list → schema-aware layers strip it) was correct; we couldn't make it conditionally-required (the if/then form 400s on OpenAI's Codex backend), so the fix makes the missing-old_text case recoverable instead. Thanks for the precise report.
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (
fix(memory): recover from missing old_text on single-op replace/remove (