Skip to content

The agent that grows with you

fix(kanban): drop the TUI empty-selection change and refit tests to the opt-in contract

teknium19b9026e62ff0
diff --git a/tests/test_tui_gateway_server.py b/tests/test_tui_gateway_server.py
index 0f08d29b50f..0441de28e1a 100644
--- a/tests/test_tui_gateway_server.py
+++ b/tests/test_tui_gateway_server.py
@@ -2605,17 +2605,18 @@ def test_load_enabled_toolsets_rejects_disabled_mcp_env(monkeypatch, capsys):
config_mod, "load_config", lambda: {"platform_toolsets": {"cli": ["memory"]}}
)
- # Sorted: ["kanban", "memory", "project"]. `kanban` is auto-recovered by
- # _get_platform_tools (a non-configurable platform toolset in hermes-cli's
- # universe); `project` is GUI-only, folded in by _load_enabled_toolsets.
- # Toolsets inside their first release (_RECENTLY_SHIPPED_TOOLSETS) are
- # back-filled onto saved lists that never offered them — allow those too.
+ # Sorted: ["memory", "project"]. `kanban` is a configurable opt-in and is
+ # never recovered onto a saved list; `project` is GUI-only, folded in by
+ # _load_enabled_toolsets. Toolsets inside their first release
+ # (_RECENTLY_SHIPPED_TOOLSETS) are back-filled onto saved lists that never
+ # offered them — allow those too.
from hermes_cli.tools_config import _RECENTLY_SHIPPED_TOOLSETS
result = server._load_enabled_toolsets()
assert result is not None
- assert {"kanban", "memory", "project"} <= set(result)
- assert set(result) - {"kanban", "memory", "project"} <= _RECENTLY_SHIPPED_TOOLSETS
+ assert {"memory", "project"} <= set(result)
+ assert "kanban" not in result
+ assert set(result) - {"memory", "project"} <= _RECENTLY_SHIPPED_TOOLSETS
err = capsys.readouterr().err
assert "ignoring disabled MCP servers" in err
assert "mcp-off" in err
@@ -2640,8 +2641,9 @@ def test_load_enabled_toolsets_falls_back_when_tui_env_invalid(monkeypatch, caps
result = server._load_enabled_toolsets()
assert result is not None
- assert {"kanban", "memory", "project"} <= set(result)
- assert set(result) - {"kanban", "memory", "project"} <= _RECENTLY_SHIPPED_TOOLSETS
+ assert {"memory", "project"} <= set(result)
+ assert "kanban" not in result
+ assert set(result) - {"memory", "project"} <= _RECENTLY_SHIPPED_TOOLSETS
assert "using configured CLI toolsets" in capsys.readouterr().err
diff --git a/tests/tools/test_kanban_toolset_opt_in.py b/tests/tools/test_kanban_toolset_opt_in.py
index 727ca82fc82..591aa030726 100644
--- a/tests/tools/test_kanban_toolset_opt_in.py
+++ b/tests/tools/test_kanban_toolset_opt_in.py
@@ -119,15 +119,11 @@ def test_selection_is_scoped_and_preserves_worker_and_deny_boundaries(legacy, tm
assert not _names(["kanban"], ["kanban"])
assert not _names([])
assert bool(_names(sorted(_get_platform_tools(load_config(), "cli")))) is legacy
-
- # Explicitly empty saved configuration wins over a legacy fallback, including
- # the actual Desktop/TUI loader (which must not turn [] back into None/all).
+ # An explicitly saved (non-empty) selection is authoritative over the legacy key.
cfg = load_config()
- cfg["platform_toolsets"]["cli"] = []
+ cfg["platform_toolsets"]["cli"] = ["file"]
save_config(cfg)
- monkeypatch.delenv("HERMES_TUI_TOOLSETS", raising=False)
- from tui_gateway.server import _load_enabled_toolsets
- assert not _names(_load_enabled_toolsets("desktop"))
+ assert not _names(sorted(_get_platform_tools(load_config(), "cli")))
monkeypatch.setenv("HERMES_KANBAN_TASK", "t_worker")
worker = _names(["file"])
diff --git a/tui_gateway/server.py b/tui_gateway/server.py
index 4ba8a6738d4..cbfe41572db 100644
--- a/tui_gateway/server.py
+++ b/tui_gateway/server.py
@@ -1869,9 +1869,7 @@ def _load_enabled_toolsets(platform: str | None = None) -> list[str] | None:
enabled = _get_platform_tools(cfg, "cli", include_default_mcp_servers=True)
if fallback_notice is not None:
_tui_notice(fallback_notice)
- # An explicitly empty selection is not "all". Keep only client-surface
- # affordances instead of resurrecting legacy opt-ins via the None path.
- return sorted(enabled | _gui_surface_toolsets(session_platform))
+ return sorted(enabled | _gui_surface_toolsets(session_platform)) if enabled else None
except Exception:
if fallback_notice is not None:
_tui_notice("[tui] no valid HERMES_TUI_TOOLSETS entries and configured CLI toolsets could not be loaded; enabling all toolsets")