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

Review finding (stale wording): the drift remediation and the missing-parameter error
still steered the model to the unadvertised top-level memory(action=...) shape. Both now
name operations[] (a single change is a one-item list); the legacy shape still executes.
The [BLOCKED: ...] load-time placeholder keeps its memory(action=remove, ...) hint: two
origin/main tests pin that exact text, and that call still works.
This commit is contained in:
Teknium committed 2026-10-24 18:44:31 -07:00
1 parent 4353f850d3
commit ff706b7787
2 files changed
+7 -7

No files matched your search

+4 -4
View File
@@ -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)
+3 -3
View File
@@ -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]: