Skip to content

plugin: don't read a dict tool response with no output key as output - #155

Closed
Shabnam (nazarli-shabnam) wants to merge 1 commit into
microsoft:mainfrom
nazarli-shabnam:fix/151-edit-result-not-error
Closed

Shabnam (nazarli-shabnam) wants to merge 1 commit into
microsoft:mainfrom
nazarli-shabnam:fix/151-edit-result-not-error

Conversation

@nazarli-shabnam

Copy link
Copy Markdown

Fixes #151

response_text serialized a dict tool_response with none of the known output keys to JSON. Claude Code's Edit result is such a dict (it carries originalFile, oldString, newString, ...), so a successful Edit of a document containing words like assert or failed matched ERR_RE and was counted as an error output by the loop guard.

It now returns an empty string for that case, as suggested in the issue. A real Edit failure still reaches the guard through PostToolUseFailure.

Added tests/test_response_text.py (fails before the change, passes after). python -m pytest tests passes. Four tests under experiments/tests fail on Windows both with and without this change.

response_text serialized such a dict to JSON. Claude Code's Edit result is
one: it carries the edited file and both strings, so a successful Edit of a
document containing words like 'assert' or 'failed' counted as an error
output in the loop guard. A real failure still arrives through
PostToolUseFailure.

Fixes microsoft#151
@nazarli-shabnam

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@SakshamUboweja

Copy link
Copy Markdown
Collaborator

Thanks for this! #152 fixes the same issue (#151) and is now merged. Your tests pass on main with it, so I’m closing this as a duplicate.

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