-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
fix(tools): treat no-op edits and identical writes as terminal tool-loop failures #96983
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automationExclude from stale automation
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automationExclude from stale automation
Type
Fields
Priority
None yet
Summary
No-op file mutations should be treated as terminal tool-loop failures in agent execution, rather than as successful mutations or recoverable tool errors.
Two recurring cases:
writeis called with content identical to the existing file content.No changes made.In agent loops, these can be interpreted as progress or a recoverable failure, causing repeated identical write/edit attempts.
Expected behavior
writecan cheaply precheck that the target file already contains identical content, it should stop before overwriting and return/throw a terminal no-op result.No changes made, the wrapper should classify it as terminal rather than allowing the agent to retry the same edit indefinitely.Suggested implementation direction
There are a few possible API shapes. The important semantic boundary is:
no-op-writeorno-op-edit.If the current tool runtime already has a terminal tool-loop error type, this could use that. Otherwise, adding a structured denied reason would make this easier to test and easier for frontends to display.
Minimal tests
writeto an existing file with identical content does not rewrite the file and returns a terminal no-op reason.writewith different content still succeeds.writecreating a new file still succeeds.No changes madeis classified as terminal.Compatibility note
Some callers may currently rely on same-content
writebeing idempotent success. If so, it may be useful to scope this behavior to agent tool-loop execution rather than lower-level file APIs, or to expose a compatibility flag. The key bug is allowing an LLM-controlled tool loop to repeatedly perform or retry no-op mutations as if progress is being made.