
























@@ -21,16 +21,22 @@ const MUTATING_TOOL_NAMES = new Set([
2121"session_status",
2222]);
232324-// File-mutation tools that operate on the same `path`/`oldpath` target identity.
24+// File-mutation tools that operate on the same `path` target identity.
2525// Recovery is allowed across these even when the tool name differs (e.g.
2626// edit-fails-then-write-succeeds on the same path), because the user-visible
2727// invariant is "the file at this path is in the desired state."
28-const FILE_MUTATING_TOOL_NAMES = new Set(["edit", "write", "apply_patch"]);
28+//
29+// `apply_patch` is intentionally excluded: production `apply_patch` calls take
30+// only an opaque `input` patch string, so `buildToolActionFingerprint` cannot
31+// extract a `path=` segment from real call args. Including `apply_patch` here
32+// would only match handcrafted-fingerprint test inputs, not real recoveries.
33+const FILE_MUTATING_TOOL_NAMES = new Set(["edit", "write"]);
293430-// Stable target segments produced by `buildToolActionFingerprint` that identify
31-// the file being mutated. Other segments (`tool=`, `action=`, `id=`, `meta=`)
32-// are call-specific and excluded from cross-tool target comparison.
33-const FILE_TARGET_FINGERPRINT_KEYS = new Set(["path", "oldpath"]);
35+// Stable target segment produced by `buildToolActionFingerprint` that
36+// identifies the file being mutated. Other segments (`tool=`, `action=`,
37+// `id=`, `meta=`) are call-specific and excluded from cross-tool target
38+// comparison.
39+const FILE_TARGET_FINGERPRINT_KEYS = new Set(["path"]);
34403541const READ_ONLY_ACTIONS = new Set([
3642"get",
@@ -258,9 +264,9 @@ export function isSameToolMutationAction(existing: ToolActionRef, next: ToolActi
258264return true;
259265}
260266// Cross-tool recovery: a successful file-mutation on the same `path`
261-// (and `oldpath`, where applicable) clears an unresolved file-mutation
262-// failure even when the tool name differs (e.g. edit→write self-heal).
263-// Different paths or non-file-mutating tools never qualify.
267+// clears an unresolved file-mutation failure even when the tool name
268+// differs (e.g. edit→write self-heal). Different paths or
269+// non-file-mutating tools never qualify.
264270if (isFileMutatingToolName(existing.toolName) && isFileMutatingToolName(next.toolName)) {
265271const existingTarget = extractFileTargetFingerprint(existing.actionFingerprint);
266272const nextTarget = extractFileTargetFingerprint(next.actionFingerprint);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。