mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(gateway): fix regression causing display.streaming to override root streaming key
This commit is contained in:
parent
8bb5973950
commit
b583210c97
3 changed files with 41 additions and 4 deletions
|
|
@ -9,6 +9,10 @@ Resolution order (first non-None wins):
|
||||||
3. ``_PLATFORM_DEFAULTS[<platform>][<key>]`` — built-in sensible default
|
3. ``_PLATFORM_DEFAULTS[<platform>][<key>]`` — built-in sensible default
|
||||||
4. ``_GLOBAL_DEFAULTS[<key>]`` — built-in global default
|
4. ``_GLOBAL_DEFAULTS[<key>]`` — built-in global default
|
||||||
|
|
||||||
|
Exception: ``display.streaming`` is CLI-only. Gateway streaming follows the
|
||||||
|
top-level ``streaming`` config unless ``display.platforms.<platform>.streaming``
|
||||||
|
sets an explicit per-platform override.
|
||||||
|
|
||||||
Backward compatibility: ``display.tool_progress_overrides`` is still read as a
|
Backward compatibility: ``display.tool_progress_overrides`` is still read as a
|
||||||
fallback for ``tool_progress`` when no ``display.platforms`` entry exists. A
|
fallback for ``tool_progress`` when no ``display.platforms`` entry exists. A
|
||||||
config migration (version bump) automatically moves the old format into the new
|
config migration (version bump) automatically moves the old format into the new
|
||||||
|
|
@ -143,7 +147,10 @@ def resolve_display_setting(
|
||||||
if val is not None:
|
if val is not None:
|
||||||
return _normalise(setting, val)
|
return _normalise(setting, val)
|
||||||
|
|
||||||
# 2. Global user setting (display.<key>)
|
# 2. Global user setting (display.<key>). Skip display.streaming because
|
||||||
|
# that key controls only CLI terminal streaming; gateway token streaming is
|
||||||
|
# governed by the top-level streaming config plus per-platform overrides.
|
||||||
|
if setting != "streaming":
|
||||||
val = display_cfg.get(setting)
|
val = display_cfg.get(setting)
|
||||||
if val is not None:
|
if val is not None:
|
||||||
return _normalise(setting, val)
|
return _normalise(setting, val)
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,15 @@ class TestStreamingPerPlatform:
|
||||||
result = resolve_display_setting(config, "telegram", "streaming")
|
result = resolve_display_setting(config, "telegram", "streaming")
|
||||||
assert result is None # caller should check global StreamingConfig
|
assert result is None # caller should check global StreamingConfig
|
||||||
|
|
||||||
|
def test_global_display_streaming_is_cli_only(self):
|
||||||
|
"""display.streaming must not act as a gateway streaming override."""
|
||||||
|
from gateway.display_config import resolve_display_setting
|
||||||
|
|
||||||
|
for value in (True, False):
|
||||||
|
config = {"display": {"streaming": value}}
|
||||||
|
assert resolve_display_setting(config, "telegram", "streaming") is None
|
||||||
|
assert resolve_display_setting(config, "discord", "streaming") is None
|
||||||
|
|
||||||
def test_explicit_false_disables(self):
|
def test_explicit_false_disables(self):
|
||||||
"""Explicit False disables streaming for that platform."""
|
"""Explicit False disables streaming for that platform."""
|
||||||
from gateway.display_config import resolve_display_setting
|
from gateway.display_config import resolve_display_setting
|
||||||
|
|
|
||||||
|
|
@ -572,6 +572,27 @@ async def test_run_agent_streaming_does_not_enable_completed_interim_commentary(
|
||||||
assert not any(call["content"] == "I'll inspect the repo first." for call in adapter.sent)
|
assert not any(call["content"] == "I'll inspect the repo first." for call in adapter.sent)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_display_streaming_does_not_enable_gateway_streaming(monkeypatch, tmp_path):
|
||||||
|
adapter, result = await _run_with_agent(
|
||||||
|
monkeypatch,
|
||||||
|
tmp_path,
|
||||||
|
CommentaryAgent,
|
||||||
|
session_id="sess-display-streaming-cli-only",
|
||||||
|
config_data={
|
||||||
|
"display": {
|
||||||
|
"streaming": True,
|
||||||
|
"interim_assistant_messages": True,
|
||||||
|
},
|
||||||
|
"streaming": {"enabled": False},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert result.get("already_sent") is not True
|
||||||
|
assert adapter.edits == []
|
||||||
|
assert [call["content"] for call in adapter.sent] == ["I'll inspect the repo first."]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_run_agent_interim_commentary_works_with_tool_progress_off(monkeypatch, tmp_path):
|
async def test_run_agent_interim_commentary_works_with_tool_progress_off(monkeypatch, tmp_path):
|
||||||
adapter, result = await _run_with_agent(
|
adapter, result = await _run_with_agent(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue