Fixing Trailing spaces and Newline required at end of file

The agent stuck on the loop, keep trying to fix “Trailing spaces and Newline required at end of file” but it will fail.

that force me to tell the agent that i will handle that manually:
“I will fix trailing spaces and newline at end of file by myself manually”
And agent just forget about that after some tool calls, which get stuck on the loop again!

Maybe give the agent tool to format the document and that will fix the problem.

Models:
Sonnet 3.5/3.7/3.7 think all stuck on the loop.

Can we get some love here?

The problem is with the LLM that applies the changes. The one that generates the solution is OK, but when we click “apply” it messes up

EDIT: I was wrong, sometimes Sonnet also includes trailing spaces