fix(tool_search): accept sanitized keys in deferred tool_call probe - #72650
fix(tool_search): accept sanitized keys in deferred tool_call probe#72650Adolanium wants to merge 1 commit into
Conversation
daccf9a to
e2e4ea7
Compare
|
Thanks for the focused regression fix. Current main still has the key-namespace mismatch: Suggested changes
This is an automated hermes-sweeper review. |
The blind-call probe checked registry wire required names, while the model and tool_describe use schema-sanitizer keys (e.g. issue_class_neq for issue_class~neq). Unrename args before the key-absence check and return model-facing parameters in the probe error so repair matches tool_describe.
e2e4ea7 to
dcbb69c
Compare
|
Salvaged onto current main in dcbb69c. The probe unrenames model args with the same unrename_tool_args path coerce_tool_args uses before the required-key check, so a call that matches tool_describe no longer gets rejected as missing required fields. The error keeps the tool_error envelope from 1a7f73b, now carrying the model-facing parameter schema and sanitized missing names so a repair round-trip matches what tool_describe shows. The regression cases are restored beside TestDeferredCallSchemaProbe. tests/tools/test_tool_search.py passes 31/31. |
SummaryOne PR addresses #72648. #72650 fixes the reported namespace mismatch by reverse-mapping sanitized model-facing keys before required-field validation and returning model-facing names and parameters in repair errors. Related pull requests
Suggested consolidationKeep #72650 open with a salvage path: retain the reverse-mapping and model-facing error-schema changes in Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I72648(["issue #72648 (open)"])
P72650["PR #72650 (open)"]
P72650 -->|best fix| I72648
class I72648 open
class P72650 open
class P72650 best
class P72650 target
click I72648 "https://github.com/NousResearch/hermes-agent/issues/72648"
click P72650 "https://github.com/NousResearch/hermes-agent/pull/72650"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 10 kB of PR diffs, 9 kB of issue/PR text, <1 kB of discussion (1 comments), 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
What does this PR do?
The Tool Search blind-call probe (
validate_deferred_call_args) checked registry wirerequirednames against the nestedtool_callarguments. After schema sanitization, the model andtool_describeuse renamed keys (for exampleissue_class_neqfor Cloudflare-styleissue_class~neq). A complete call with those model-facing keys was treated as missing required fields and never reachedunrename_tool_args/ dispatch.That contradicts the probe's contract that valid calls are never blocked, and it breaks deferred MCP tools whose property keys need sanitizer renames (the Cloudflare path #67034 already handles at dispatch).
This PR reverse-maps args with the same
unrename_tool_argspathcoerce_tool_argsuses before the key-absence check. Probe error payloads list model-facing missing names and the sanitized parameters object so a repair round-trip matchestool_describe. Fail-open on unrename/validator errors is unchanged. Clean-key tools are unaffected.Related Issue
Fixes #72648
Type of Change
Changes Made
tools/tool_search.py: unrename deferredtool_callargs before required-key checks invalidate_deferred_call_args. Build model-facing parameters for probe errors via the schema sanitizer so error text andparametersmatchtool_describe.tests/tools/test_tool_search.py: addTestDeferredCallSchemaProbecases for sanitized required keys (accept, still-block missing, end-to-end dispatch, blind-call error naming), using the flat MCP schema shape.How to Test
python -m pytest tests/tools/test_tool_search.py::TestDeferredCallSchemaProbe -q- 10 passedpython -m pytest tests/tools/test_tool_search.py tests/tools/test_schema_sanitizer.py -q- 112 passedissue_class~neq, callhandle_function_call("tool_call", arguments={"issue_class_neq": "...", "zone_id": "..."}). On main the probe returns missingissue_class~neq. With this branch the tool dispatches.document_idis present.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/tools/test_tool_search.py tests/tools/test_schema_sanitizer.py -qand all tests pass (112). Full suite not re-run here. Change is isolated to tool_search probe + tests.Documentation & Housekeeping
docs/, docstrings) - or N/A (docstring update only in the probe)cli-config.yaml.exampleif I added/changed config keys - or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - or N/AScreenshots / Logs