← Back to PRs

#19576: fix: tighten isSilentReplyText to match whole-text only

by aldoeliacim open 2026-02-18 00:02 View on GitHub →
size: XS trusted-contributor
## Problem `isSilentReplyText()` uses a suffix regex (`\bNO_REPLY\b\W*$`) that matches `NO_REPLY` at the **end** of any response text, even when preceded by substantive content. This causes legitimate replies to be silently suppressed and never delivered to the user. Observed with Gemini 3 Pro which appends `NO_REPLY` to conversational replies, but any model could trigger this. ## Fix Replace the prefix + suffix regex pair with a single whole-string match: `^\s*TOKEN\s*$`. Only responses that are **entirely** the silent token (with optional whitespace) are now treated as silent. ## Tests Added `src/auto-reply/tokens.test.ts` with 7 test cases covering: - Exact token match - Whitespace variants - Substantive text ending with token (the regression case) - Substantive text starting with token - Embedded token - Custom token parameter All tests pass: `npx vitest run src/auto-reply/tokens.test.ts` Fixes #19537 <!-- greptile_comment --> <h3>Greptile Summary</h3> Replaces overly permissive prefix/suffix regex matching with strict whole-string matching for silent reply detection. The old implementation used `\bNO_REPLY\b\W*$` suffix pattern that matched `NO_REPLY` at the end of any text, causing legitimate replies ending with the token to be silently suppressed. The new `^\s*TOKEN\s*$` pattern only treats responses that are entirely the silent token (with optional whitespace) as silent, fixing the regression where models like Gemini 3 Pro append `NO_REPLY` to conversational responses. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no concerns - The fix correctly addresses a critical bug where legitimate replies were being suppressed. The change is minimal, well-tested with 7 comprehensive test cases covering the regression and edge cases, and the logic change is straightforward and correct. - No files require special attention <sub>Last reviewed commit: a6e4442</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs