Skip to content

fix(gateway): suppress "(empty)" visible replies on chat surfaces - #6166

Closed
livingghost wants to merge 1 commit into
NousResearch:mainfrom
livingghost:fix/suppress-empty-visible-replies
Closed

fix(gateway): suppress "(empty)" visible replies on chat surfaces#6166
livingghost wants to merge 1 commit into
NousResearch:mainfrom
livingghost:fix/suppress-empty-visible-replies

Conversation

@livingghost

@livingghost livingghost commented Apr 8, 2026

Copy link
Copy Markdown

What does this PR do?

This prevents Hermes from sending the literal string "(empty)" to messaging platforms when a reasoning-only completion produces no visible user-facing text.

Core Hermes intentionally stores reasoning-only completions with content = "(empty)" so providers and session history keep a non-empty assistant message. That behavior is useful internally, but it leaks a confusing placeholder into Discord and other chat surfaces.

This patch keeps the core/session-history behavior unchanged and only suppresses "(empty)" at the messaging boundary, making it behave like "no reply" for platform delivery.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Tests (adding or improving test coverage)

Changes Made

  • Added _is_silent_response(...) in gateway/platforms/base.py
  • Treat "(empty)" the same as None/empty at the platform delivery boundary
  • Kept core run_agent.py behavior unchanged, preserving the semantics introduced by fix: accept reasoning-only responses without retries — set content to "(empty)" #5278
  • Added regression tests in tests/gateway/test_platform_base.py for:
    • exact "(empty)"
    • whitespace-wrapped "(empty)"
    • normal visible responses still sending normally

How to Test

  1. Run:
    python -m pytest -o addopts= tests/gateway/test_platform_base.py -q
  2. Trigger a reasoning-only completion that would otherwise surface "(empty)"
  3. Confirm no visible chat message is sent
  4. Confirm regular non-empty replies still send normally

Tested on

  • Windows 11 host
  • Linux Docker container
  • Manual Discord verification that reasoning-only completions no longer surface "(empty)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant