← Back to PRs

#23370: fix: strip [[reply_to_current]] tags from WebChat + validate invoke cwd

by alexmelges open 2026-02-22 07:58 View on GitHub →
app: web-ui gateway size: S
Split from #23186. ## Changes ### WebChat: Strip directive tags only from assistant messages - Previously, `[[reply_to_current]]` and other inline directive tags were stripped from all messages in the WebChat chat history - Now only strips from assistant messages, preserving user message content - Also strips directive tags from text blocks within array-style content for assistant messages ### Node Host: Validate working directory for system.run - Adds `validateWorkingDirectory` function to return a clear error when the specified cwd doesn't exist - Adds cross-platform test coverage for cwd validation Closes #23053 <!-- greptile_comment --> <h3>Greptile Summary</h3> Splits WebChat directive tag stripping to only affect assistant messages (preserving user message content) and adds clear error handling for invalid `cwd` in `system.run`. **Issues Found:** - **Critical:** `sanitizeChatHistoryContentBlock` at src/gateway/server-methods/chat.ts:107 unconditionally strips directive tags from all content blocks, breaking the intent to preserve user message content when messages have array-style content - The function needs an `isAssistant` parameter to conditionally strip tags based on message role **Node-host changes:** - `validateWorkingDirectory` implementation is correct and well-tested - Cross-platform test coverage is appropriate (uses `fileURLToPath` for path handling) <h3>Confidence Score: 2/5</h3> - This PR has a critical logical bug that prevents it from achieving its stated goal - The WebChat changes have a critical flaw where `sanitizeChatHistoryContentBlock` unconditionally strips directive tags from all text blocks in array-style content, regardless of message role. This means user messages with array content will still lose their directive tags, contradicting the PR's purpose. The node-host validation changes are solid and well-tested. - src/gateway/server-methods/chat.ts requires fixes to properly preserve user message directive tags in array-style content <sub>Last reviewed commit: 54c63e0</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs