← Back to PRs

#17371: fix(heartbeat): always strip HEARTBEAT_OK token from reply text

by BinHPdev open 2026-02-15 17:59 View on GitHub →
channel: mattermost size: XS
## Summary Always strip the `HEARTBEAT_OK` token from reply text. The stripping logic was gated behind `!params.isHeartbeat`, which paradoxically skipped stripping during heartbeat runs — the exact case where the token appears. This caused `HEARTBEAT_OK` to leak into user-visible replies. Removed the `!params.isHeartbeat` guard. Fixes #16974 ## Validation - [x] `pnpm build` — passed - [x] `pnpm check` (format + tsgo + lint) — passed - [x] `pnpm test` — 1073 tests passed (105 test files) ## Scope - Single focused fix — single file changed (`src/auto-reply/reply/agent-runner-execution.ts`) ## AI-Assistance - AI-assisted (Claude Code) for implementation - Human-reviewed: confirmed understanding of changes - Testing: full local validation suite passed <!-- greptile_comment --> <h3>Greptile Summary</h3> Fixes logic bug where `HEARTBEAT_OK` token was paradoxically skipped during heartbeat runs due to incorrect `!params.isHeartbeat` guard. The guard prevented stripping during the exact scenario where the token appears, causing it to leak into user-visible replies when `showOk: false` is configured. The fix correctly removes the guard so stripping always occurs when the token is present, while preserving the verbose log only for unexpected (non-heartbeat) occurrences. This aligns with other call sites that unconditionally strip the token in streaming contexts. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no risk - it's a focused, well-tested bug fix - Single-line logic fix that corrects an obvious bug where the conditional guard was inverted. The change is minimal, focused, and well-validated (1073 tests passed). The fix aligns perfectly with the function's purpose and matches patterns used elsewhere in the codebase - No files require special attention <sub>Last reviewed commit: c26f035</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs