fix(skills): drop redundant identical-strings guard and its vacuous tests

The guard and the tests around it pinned behavior that already existed.
fuzzy_find_and_replace rejects old_string == new_string at
tools/fuzzy_match.py:69-70, returning "old_string and new_string are
identical" — so main already answered success=False, and the three tests
asserting "identical" in the error passed with the guard deleted.

The earlier claim that this case "silently applies a no-op the model reports
as success" was wrong. Verified against main:

  {"success": false, "error": "old_string and new_string are identical",
   "file_preview": "..."}

The duplicate guard was also strictly worse: it fired before the skill
lookup and returned no file_preview, shadowing the richer message.

Removes the guard, the two identical-strings tests, and the third
parametrize case. What remains is the genuinely new behavior: an actionable
missing-old_string error, reachable through the public tool.
This commit is contained in:
Clifford Garwood
2026-07-19 19:09:58 -04:00
committed by Teknium
parent 1ff8ec9a49
commit 10e93c6ab9
+4 -8
View File
@@ -1128,14 +1128,10 @@ def _patch_skill(
}
if new_string is None:
return {"success": False, "error": "new_string is required for 'patch'. Use an empty string to delete matched text."}
if old_string == new_string:
return {
"success": False,
"error": (
"old_string and new_string are identical — this patch would change nothing. "
"Supply the actual replacement text."
),
}
# No old_string == new_string guard here: fuzzy_find_and_replace already
# rejects that with "old_string and new_string are identical"
# (tools/fuzzy_match.py), and its error carries a file_preview this layer
# cannot produce. Duplicating it here would only shadow the richer message.
existing = _find_skill(name)
if not existing: