fix(agent): unwrap pre-wrapped tool schemas from context engines and memory providers - #47732
Closed
srojk34 wants to merge 1 commit into
Closed
Conversation
…memory providers
A context engine or memory provider returning a schema already in
{"type":"function","function":{...}} form caused a second wrap at each
consumer site. The resulting tool had no top-level name, making it
un-routable internally and triggering HTTP 400 "missing field name" on
strict providers (e.g. DeepSeek) for every request in the session.
Fixed in four consumer sites:
- agent/agent_init.py: context-engine schema loop
- agent/memory_manager.py: _add_schemas_to_agent helper
- agent/memory_manager.py: _tool_to_provider routing index
- agent/memory_manager.py: MemoryManager.get_all_tool_schemas()
Also added a nameless-schema guard in the context-engine loop so a
schema with no 'name' is skipped rather than appended as a dead tool.
Fixes NousResearch#47707
Contributor
|
Automated hermes-sweeper review: this fix is already implemented on current Evidence:
Thanks for the report and fix work here; the behavior is now covered on main. |
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
{"type":"function","function":{...}}(OpenAI tool) form. Each consumer site blindly wrapped them again, producing a tool with no top-levelname.HTTP 400: tools[N].function: missing field nameon strict providers such as DeepSeek — failing every request in the session, not just the offending tool.nameafter unwrapping is skipped rather than appended as dead weight.Changes
agent/agent_init.pyagent/memory_manager.py_add_schemas_to_agent,_tool_to_providerindex, andget_all_tool_schemas()tests/agent/test_memory_provider.pyTestContextEngineToolsetGatehelper to mirror the fixed production codeTest plan
uv run --frozen python -m pytest tests/agent/test_memory_provider.py -x -q→ 96 passedFixes #47707