← Back to PRs

#21215: Windows PowerShell reliability fixes (exec shim + Discord numeric parse + sanitized tool errors)

by musosoft open 2026-02-19 19:52 View on GitHub →
channel: discord agents size: M
## Summary Ports and validates Windows workflow fixes on top of current main (2026.2.19 line). ### Included - sanitize terminal control sequences in logger/tool error text - normalize xec tool commands on Windows to run via cmd /d /s /c when command contains && or || - parse numeric guildId/channelId Discord targets correctly - apply messages.suppressToolErrors before tool-error warning fallback ### Validation - src/logger.test.ts - src/discord/resolve-channels.test.ts - src/agents/pi-tool-definition-adapter.e2e.test.ts - src/agents/pi-embedded-runner/run/payloads.e2e.test.ts <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR consolidates Windows PowerShell reliability fixes into the current main branch. The changes address terminal control sequence sanitization, Windows command execution with shell operators, Discord numeric channel resolution, and tool error suppression behavior. Key changes: - Sanitizes terminal control sequences (ANSI escape codes, OSC sequences) from logger error messages and tool error text to prevent log pollution - Wraps Windows `exec` tool commands containing `&&` or `||` with `cmd /d /s /c` to ensure proper shell operator handling - Fixes Discord channel resolution to correctly parse numeric guild/channel ID pairs (e.g., `111/222`) by checking if both parts are numeric before routing to channel ID lookup - Reorders `suppressToolErrors` check to occur before mutating tool error detection, ensuring `messages.suppressToolErrors` config properly suppresses all tool errors including mutating ones - Changes tool execution error logging from `logError` to `logDebug` for cleaner console output <h3>Confidence Score: 4/5</h3> - This PR is safe to merge with minor considerations about edge case handling - The changes are well-tested with comprehensive unit tests covering the main scenarios. The terminal sanitization and tool error suppression logic are straightforward and correct. The Discord numeric parsing fix addresses a real bug. The Windows cmd shim has potential edge cases with complex escaping scenarios (backslashes in paths), but these are likely rare in practice and the basic functionality is sound. No security issues or critical bugs detected. - Pay attention to `src/agents/pi-tool-definition-adapter.ts` for potential Windows command escaping edge cases with file paths containing backslashes <sub>Last reviewed commit: bebfd19</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs