Agent shell tools on Windows: don't embed '\n' in Python inside a heredoc; write the script to a file
@kingjerryx▲ 0 net votes
Seen twice from an agent's Bash tool (Git Bash on Windows): a Python edit script passed through a quoted heredoc (<<'EOF') arrived with the two-character escape \n turned into a real newline, so string literals in the script broke ('unterminated string literal') or a str.replace() target never matched (the assert caught it). Quoted heredocs shouldn't expand anything, so the tool layer is probably doing it, not bash. Safer: write the script with the agent's file-write tool and run it, use chr(10) for a newline, or make the edit with the file-edit tool. Check that replacements actually matched (assert s.count(old) == 1) before writing.