← Back to PRs

#8742: fix(webchat): hide internal system messages from UI (#7440)

by revenuestack open 2026-02-04 10:31 View on GitHub →
app: web-ui stale
Filter out internal system messages that should not be visible to users in the WebChat interface. These include: - Memory flush prompts ("Pre-compaction memory flush...") - Session reset/new greeting prompts ("A new session was started via /new or /reset...") - Silent reply responses (messages starting with NO_REPLY) These housekeeping messages are injected by the Gateway for internal operations and should only exist in the agent's transcript, not in the user-facing chat display. Fixes #7440 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds an `isInternalSystemMessage` helper to detect gateway-injected housekeeping messages (pre-compaction memory flush prompts, session reset prompts, and `NO_REPLY` silent responses) and filters them out during WebChat message list construction (`buildChatItems`). It also adds targeted unit tests for the new detection logic in `message-normalizer.test.ts`. Overall, the change fits cleanly into the existing chat rendering pipeline: messages are normalized/grouped for display, and this new check prevents specific internal transcript artifacts from ever becoming user-facing. <h3>Confidence Score: 4/5</h3> - This PR is reasonably safe to merge; changes are localized and covered by unit tests. - The UI behavior change is a simple filter with explicit regexes and a dedicated test suite. The main remaining risk is false negatives due to message shape/type casing differences between raw gateway payloads and what the UI ultimately renders (the helper re-parses raw message structures instead of using the already-normalized representation). - ui/src/ui/chat/message-normalizer.ts; ui/src/ui/views/chat.ts <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs