Skip to content

loopguard: ignore structured file-diff dicts in response_text (#151) - #152

Merged
Saksham Uboweja (SakshamUboweja) merged 1 commit into
microsoft:mainfrom
TejasLamba2006:fix/edit-response-text
Nov 6, 2026
Merged

Saksham Uboweja (SakshamUboweja) merged 1 commit into
microsoft:mainfrom
TejasLamba2006:fix/edit-response-text

Conversation

@TejasLamba2006

Copy link
Copy Markdown
Contributor

Fixes #151.

While checking #151 against recorded Claude Code transcripts on my machine, I noticed two places where response_text feeds edited file contents into ERR_RE:

  1. Edit returns {filePath, oldString, newString, originalFile, structuredPatch, ...} with none of _RESPONSE_KEYS, so response_text fell back to json.dumps(resp).
  2. Write returns {type, filePath, content, originalFile, structuredPatch, ...}, where content is the written file body.

Replaying response_text across 964 local Claude Code session logs (37,797 structured toolUseResult dicts), 12,279 successful Edit/Write calls matched ERR_RE before this change and 0 after. Real edit failures still arrive through PostToolUseFailure (_failure_response), which carries error without structuredPatch.

@SakshamUboweja
Saksham Uboweja (SakshamUboweja) merged commit acb82bc into microsoft:main Nov 6, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loop guard counts a successful Edit as an error when the edited text contains 'assert' or 'failed'

2 participants