Skip to content

fix: expose context engine tools with saved toolsets (salvage of #31194) - #33719

Merged
teknium1 merged 1 commit into
mainfrom
fix/context-engine-toolset-31194
May 28, 2026
Merged

fix: expose context engine tools with saved toolsets (salvage of #31194)#33719
teknium1 merged 1 commit into
mainfrom
fix/context-engine-toolset-31194

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Plugin context engines like hermes-lcm expose runtime tools through get_tool_schemas(). AIAgent only injects those schemas when the context_engine toolset is enabled (agent/agent_init.py:1497). But:

  • context_engine wasn't a registered toolset in toolsets.py
  • saved platform toolset lists from hermes tools (web, terminal, etc.) never included it

So an active LCM session running with context.engine: lcm would never see the lcm_* tools — the schemas existed but the toolset gate filtered them out.

This adds a first-class context_engine toolset and auto-enables it when a non-default context.engine is configured, while preserving the explicit empty-selection contract (a user who deliberately deselects everything still gets nothing).

Changes

  • toolsets.py — adds a static context_engine toolset entry (empty tool list; engines populate at runtime via get_tool_schemas())
  • hermes_cli/tools_config.py — adds context_engine to CONFIGURABLE_TOOLSETS; _get_platform_tools() auto-enables it when context.engine is set to anything other than the default compressor, unless the user has explicitly saved an empty selection
  • tests/hermes_cli/test_tools_config.py — 40 lines of regressions for visibility with explicit platform toolsets, default compressor behavior, and the empty-selection contract
  • tests/run_agent/test_plugin_context_engine_init.py — end-to-end regression proving a plugin context engine's tool schema reaches AIAgent.valid_tool_names after platform tool resolution

Validation

pytest tests/hermes_cli/test_tools_config.py tests/test_toolsets.py \
       tests/run_agent/test_plugin_context_engine_init.py -q
112 passed

Salvage notes

Salvage of PR #31194 by @stephenschoettler — original commit 6bd2b5b43 cherry-picked onto current main with authorship preserved (455 commits behind when picked, conflict-free auto-merge). Original PR will be closed with credit after merge.

Related: stephenschoettler/hermes-lcm#200.

@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: fix/context-engine-toolset-31194 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9528 on HEAD, 9528 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5020 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1
teknium1 merged commit 8595281 into main May 28, 2026
25 checks passed
@teknium1
teknium1 deleted the fix/context-engine-toolset-31194 branch May 28, 2026 07:28
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets comp/plugins Plugin system and bundled plugins labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants