fix(gateway): coerce tool_progress_command as a real boolean
This commit is contained in:
@@ -85,6 +85,25 @@ class TestVerboseCommand:
|
||||
saved = yaml.safe_load(config_path.read_text(encoding="utf-8"))
|
||||
assert saved["display"]["platforms"]["telegram"]["tool_progress"] == "verbose"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_quoted_false_keeps_command_disabled(self, tmp_path, monkeypatch):
|
||||
"""Quoted false must not enable the /verbose gateway command."""
|
||||
hermes_home = tmp_path / "hermes"
|
||||
hermes_home.mkdir()
|
||||
config_path = hermes_home / "config.yaml"
|
||||
config_path.write_text(
|
||||
'display:\n tool_progress_command: "false"\n tool_progress: all\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
monkeypatch.setattr(gateway_run, "_hermes_home", hermes_home)
|
||||
|
||||
runner = _make_runner()
|
||||
result = await runner._handle_verbose_command(_make_event())
|
||||
|
||||
assert "not enabled" in result.lower()
|
||||
assert "tool_progress_command" in result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cycles_through_all_modes(self, tmp_path, monkeypatch):
|
||||
"""Calling /verbose repeatedly cycles through all four modes."""
|
||||
|
||||
@@ -405,6 +405,21 @@ class TestGatewayConfigGate:
|
||||
joined = "\n".join(lines)
|
||||
assert "`/verbose" in joined
|
||||
|
||||
def test_config_gate_quoted_false_stays_disabled_everywhere(self, tmp_path, monkeypatch):
|
||||
"""Quoted false must not enable config-gated gateway commands."""
|
||||
config_file = tmp_path / "config.yaml"
|
||||
config_file.write_text('display:\n tool_progress_command: "false"\n')
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
|
||||
lines = gateway_help_lines()
|
||||
joined = "\n".join(lines)
|
||||
names = {name for name, _ in telegram_bot_commands()}
|
||||
mapping = slack_subcommand_map()
|
||||
|
||||
assert "`/verbose" not in joined
|
||||
assert "verbose" not in names
|
||||
assert "verbose" not in mapping
|
||||
|
||||
def test_config_gate_excluded_from_telegram_when_off(self, tmp_path, monkeypatch):
|
||||
config_file = tmp_path / "config.yaml"
|
||||
config_file.write_text("display:\n tool_progress_command: false\n")
|
||||
|
||||
Reference in New Issue
Block a user