fix(cli): clear stale no_mcp and normalize numeric toolset names on save (#13028) - #13086
Closed
dingn42 wants to merge 1 commit into
Closed
fix(cli): clear stale no_mcp and normalize numeric toolset names on save (#13028)#13086dingn42 wants to merge 1 commit into
dingn42 wants to merge 1 commit into
Conversation
…ave (NousResearch#13028) _save_platform_tools had two edge-case defects: 1. When a platform previously had the "no_mcp" disable-all sentinel and the user re-enabled an MCP server, the sentinel survived through the preserve-filter and silently re-suppressed the newly selected server on the next read. 2. YAML may parse bare numeric toolset names (e.g. ``12306:``) as int. The read path in _get_platform_tools already normalizes to str, but the save path sorted mixed str/int entries and crashed with ``TypeError: '<' not supported between instances of 'str' and 'int'``. Normalize existing_toolsets to strings up front and drop the stale no_mcp entry whenever the new selection re-enables any MCP server. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 22, 2026
fix(discord): end-to-end Discord support — toolset loading, tool split, and context injection
#15091
Closed
Contributor
|
Thanks for the thorough write-up and repro steps, @dingn42! Both fixes landed on Automated hermes-sweeper review found the following evidence:
The main implementation uses unconditional |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_save_platform_tools()has two separate save-path defects (both reproducible by running the Python snippets in the issue body):no_mcpdisable-all sentinel and the user re-enables an MCP server, the sentinel survives the preserve-filter and silently re-suppresses the newly selected server on the next read. Observed:_get_platform_toolsreturned['web']immediately after saving{'web', 'exa'}.12306:) asint. The read path in_get_platform_toolsalready normalizes tostr(lines 522-524), but the save path sorted mixedstr/intentries and crashed withTypeError: '<' not supported between instances of 'str' and 'int'.Fixes #13028.
Fix
existing_toolsetsto strings up front sosorted()on the merged set stays monomorphic — mirrors what_get_platform_toolsalready does on the read side.enabled_toolset_keyscontains any MCP server name (resolved fromconfig['mcp_servers']), drop theno_mcpsentinel frompreserved_entries. Plain saves that don't touch MCP still keep the sentinel.Test plan
tests/hermes_cli/test_tools_config.py:test_save_platform_tools_clears_stale_no_mcp_when_enabling_mcp_servertest_save_platform_tools_normalises_numeric_existing_entriespytest tests/hermes_cli/test_tools_config.py— 34 passed['exa', 'web']saved,['exa', 'web']enabled after reload; second case: noTypeError,12306round-trips as string