Skip to content

fix(gateway): honor profile toolset capabilities - #88820

Open
TheTom wants to merge 1 commit into
NousResearch:mainfrom
TheTom:codex/profile-enabled-toolsets
Open

TheTom wants to merge 1 commit into
NousResearch:mainfrom
TheTom:codex/profile-enabled-toolsets

Conversation

@TheTom

@TheTom TheTom commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Completes the runtime side of the profile capability editor contract introduced by #85216 and made user-honest by #86227.

profiles.configure persists a non-empty profile capability selection at tools.enabled_toolsets, and profiles.describe presents that pin as authoritative. The TUI/Desktop gateway did not consume it when constructing an agent. A Bot Chat opened in a code workspace could therefore show one capability set in the editor while receiving the generic coding toolset at runtime.

Root cause

#43316 intentionally made focus-mode coding posture fill only an unpinned default selection. _load_enabled_toolsets() recognized HERMES_TUI_TOOLSETS as an explicit pin, but never checked the equivalent profile-scoped pin in the active HERMES_HOME before asking coding posture for a selection.

That made the editor and runtime disagree, and profile plugin tools disappeared from the model schema without an error.

Fix

The gateway now resolves toolsets in this order:

  1. HERMES_TUI_TOOLSETS operator override
  2. Active profile tools.enabled_toolsets pin
  3. Coding-context posture
  4. Existing platform configuration fallback

For a profile pin, plugin discovery runs before the agent snapshots schemas. Enabled MCP servers and client-surface toolsets continue to ride alongside the selected profile capabilities. An absent pin, including an editor-cleared empty list, preserves the existing posture and platform behavior.

No config keys, model tools, plugin-specific behavior, or user-facing commands are added.

Changes made

  • tui_gateway/server.py: consume the active profile capability pin before coding posture and document the resolver contract.
  • tests/test_tui_gateway_server.py: cover precedence, generic plugin discovery, MCP inclusion, desktop surface inclusion, and a real profile-scoped config.yaml load.
  • AGENTS.md: record the capability-resolution precedence so future gateway changes preserve editor/runtime parity.

How to test

  1. Save a profile with tools.enabled_toolsets: [memory, web].
  2. Start a TUI/Desktop Bot Chat for that profile from a code workspace with agent.coding_context: focus.
  3. Confirm the runtime receives memory, web, enabled MCP servers, and its client-surface tools rather than replacing the profile selection with coding.
  4. Set HERMES_TUI_TOOLSETS; confirm that operator override still wins.

Verification

  • scripts/run_tests.sh tests/test_tui_gateway_server.py -q — 587 passed
  • scripts/run_tests.sh tests/test_tui_gateway_server.py -k load_enabled_toolsets -q — 13 passed
  • ruff check tui_gateway/server.py tests/test_tui_gateway_server.py — passed
  • Gateway import smoke test — passed
  • git diff --check upstream/main...HEAD — passed

Documentation

No user guide update is needed because this introduces no new setting or workflow. The existing setting now behaves as documented by the profile editor. The internal precedence invariant is recorded in AGENTS.md.

@TheTom
TheTom force-pushed the codex/profile-enabled-toolsets branch from 781a03d to 175b7db Compare August 18, 2026 01:21
@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) area/profiles Multi-profile isolation, HERMES_HOME scoping area/config Config system, migrations, profiles tool/mcp MCP client and OAuth P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 18, 2026
@TheTom
TheTom force-pushed the codex/profile-enabled-toolsets branch 2 times, most recently from bab2a80 to 2bfb593 Compare August 18, 2026 01:33
profiles.configure persists an explicit tools.enabled_toolsets pin, and
profiles.describe presents that pin as the profile capability source of
truth. The TUI/Desktop runtime resolver did not consume it: focus-mode
coding posture could replace the selected capabilities when a Bot Chat
started in a code workspace.

Resolve the active profile pin after the operator HERMES_TUI_TOOLSETS
override but before coding posture. Discover profile plugins before the
agent snapshots schemas, and preserve enabled MCP servers plus
client-surface toolsets alongside the pin.

Document the precedence contract in AGENTS.md. Cover the resolver
relationship with a focused plugin/MCP/surface test and a profile-scoped
config test that reads the pin through the real load_config path.
@TheTom
TheTom force-pushed the codex/profile-enabled-toolsets branch from 2bfb593 to 1bc06f7 Compare August 18, 2026 15:02
@TheTom

TheTom commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

CI follow-up: the earlier failure was in tests/gateway/test_goal_verdict_send.py::test_goal_verdict_continue_enqueues_continuation, outside the files and behavior changed by this PR. The test passed in five consecutive local runs. After rebasing onto current main, the complete CI matrix reran successfully with no failures, so the original result appears to have been an unrelated timing flake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles area/profiles Multi-profile isolation, HERMES_HOME scoping comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/mcp MCP client and OAuth type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants