fix(cli): stop sending the coding posture as a toolsets pick

The gateway now resolves it from the session cwd; the CLI keeps the list only for its local display.

(cherry picked from commit 75cb9203d09178a56aef54a6aa4827e3d26aa7bb)
This commit is contained in:
unsupportedpastels
2026-10-15 03:59:18 +00:00
committed by kshitij
parent aee5a705b2
commit aca77bf059
2 changed files with 8 additions and 6 deletions

7
cli.py
View File

@@ -1508,7 +1508,9 @@ def _build_cli_from_args(model, toolsets, provider, reasoning, api_key, base_url
for t in toolsets:
toolsets_list.extend([x.strip() for x in t.split(",")] if isinstance(t, str) else [str(t)])
elif not toolsets:
# Coding posture inside a code workspace, else the shared platform resolver.
# Coding posture inside a code workspace, else the shared platform resolver. Neither is a
# pick: the gateway resolves both from the session's cwd, so this list only feeds the display.
profile_default = True
try:
from agent.coding_context import coding_selection
toolsets_list = coding_selection(platform="cli", config=CLI_CONFIG)
@@ -1517,7 +1519,6 @@ def _build_cli_from_args(model, toolsets, provider, reasoning, api_key, base_url
if toolsets_list is None:
from hermes_cli.tools_config import _get_platform_tools
toolsets_list = sorted(_get_platform_tools(CLI_CONFIG, "cli"))
profile_default = True
parsed_skills = _parse_skills_argument(skills)
@@ -1546,7 +1547,7 @@ def _build_cli_from_args(model, toolsets, provider, reasoning, api_key, base_url
sys.exit(1)
raise
if profile_default:
cli._explicit_toolsets = False # the gateway resolves the profile's toolsets itself
cli._explicit_toolsets = False # the gateway resolves the default and coding posture itself
# Only a typed -t is checked against a resumed session's frozen toolsets.
cli._typed_toolsets = toolsets_list if toolsets else None

View File

@@ -81,7 +81,8 @@ def test_explicit_unknown_toolset_is_still_refused(store, monkeypatch):
build_policy(params, CONFIG)
def test_coding_posture_selection_still_rides_session_create(store, monkeypatch):
def test_coding_posture_is_left_to_the_gateway(store, monkeypatch):
db, client = store
_launch(monkeypatch, db, coding=["terminal"])
assert _created(client)["toolsets"] == ["terminal"]
host, _printed = _launch(monkeypatch, db, coding=["terminal"])
assert host.enabled_toolsets == ["terminal"] # the local display still shows the posture
assert "toolsets" not in _created(client)