fix(tools): don't drop a toolset from platform inference when a tool is registered into it (salvage #56480) - #722
Merged
Merged
Conversation
…is registered into it (salvage NousResearch#56480)
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.
Summary
Fixes the class where an inference-based platform (
api_server, and plugin platforms with no explicitplatform_toolsetsentry) silently loses an entire toolset because_get_platform_tools()reverse-maps the static composite against the registry-merged toolset view.resolve_toolset("terminal")grows to{terminal, process, read_terminal, close_terminal}once tools are registered, but thehermes-api-servercomposite enumerates only the static names{terminal, process}. The old all-toolsset.issubset()test then failed and dropped the wholeterminaltoolset fromapi_server— no log, no error, model just losesterminal.The fix compares each candidate toolset's static (pre-registry-merge) membership during reverse-mapping via a new
include_registryflag onget_toolset()/resolve_toolset(). Registry-added tools stop gating inference but remain exposed (subject to their owncheck_fn) once the toolset is enabled — matching how explicitly-configured platforms already behave. This fixes the bug class at the reverse-map layer instead of data-patching one composite at a time.Changes
toolsets.py:include_registry: bool = Truekwarg onget_toolset()/resolve_toolset(), threaded through recursion, theall/*alias, includes, and thehermes-<plugin>fallback.include_registry=Falsereturns the staticTOOLSETSview.hermes_cli/tools_config.py: the three reverse-map candidate comparisons in_get_platform_tools()resolve the candidate toolset withinclude_registry=False. Universes stay registry-merged so a platform never under-counts what it provides.tests/: behavior-contract tests for the flag + regression tests (defaultapi_serverkeepsterminal; registering a tool into a toolset doesn't drop it from inference; default-off/restricted toolsets stay off).get_toolset'sNonereturn; AUTHOR_MAP entry for the salvaged contributor commits.Validation
api_serverterminal in final tool defsread_terminalCredit
Salvage of NousResearch#56480 by @designnotdrum (root-cause fix) — commits cherry-picked with authorship preserved. Supersedes symptom-patch PRs NousResearch#56735 (@HexLab98) and NousResearch#49626 (@liuhao1024), which data-patched the composites; this fixes the class at the reverse-map layer so no composite needs per-tool maintenance.
Fixes NousResearch#56732
Fixes NousResearch#49622
Mirror-of: NousResearch#56887
NousResearch#56887