fix(gateway): no runtime footer to a bot peer (a streamed reply sends it as its own message)

This commit is contained in:
Teknium committed 2026-11-04 21:01:10 -08:00
1 parent 17c2065b2b
commit 4c466d86f2
2 files changed
+11 -1

No files matched your search

+2 -1
View File
@@ -263,7 +263,8 @@ class GatewayTurnPersistenceMixin:
the printed answer itself."""
from gateway.run import _load_gateway_config, _platform_config_key, _terminal_scope_cwd
from gateway.session_finite import finite_turn_required
if finite_turn_required() is True:
# A bot peer gets the model's words only: a streamed reply sends the footer as its own message.
if finite_turn_required() is True or not automatic_notices_allowed(source):
return ""
try:
from gateway.runtime_footer import build_footer_line as _bfl
@@ -137,3 +137,12 @@ async def test_platform_notices_and_the_inactivity_warning_skip_a_bot_peer(is_bo
assert adapter.send.await_count == sent and adapter.emit_warning.await_count == sent
@pytest.mark.parametrize("is_bot", [True, False], ids=["bot peer", "human control"])
def test_the_runtime_footer_is_not_sent_to_a_bot_peer(monkeypatch, is_bot):
import gateway.runtime_footer as footer
monkeypatch.setattr(footer, "build_footer_line", lambda **kw: "— model · 3s")
line = _Runner()._hmwa_runtime_footer_line({"model": "m"}, _source(is_bot), 3.0)
assert line == ("" if is_bot else "— model · 3s")