fix(memory): coerce string-typed days/limit in search_past_conversations#1764
Open
github-actions[bot] wants to merge 1 commit into
Open
fix(memory): coerce string-typed days/limit in search_past_conversations#1764github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Smaller runtime models sometimes emit numeric tool args as JSON strings
(e.g. {"days": "7"}). The clamp via min("7", 365) raised
TypeError: '<' not supported between instances of 'int' and 'str',
crashing the tool on some turns. Coerce days/limit to int before
clamping; non-numeric input now returns a clear, arg-naming error
instead of a raw TypeError.
Closes #1763
3 tasks
Collaborator
|
@alexey-tyurin let me know if this fixes it for you. |
Contributor
|
@kovtcharov-amd - Confirmed — fixes it for me. The string-arg repro now coerces and clamps instead |
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.
Before:
search_past_conversationscrashed withTypeError: '<' not supported between instances of 'int' and 'str'whenever a model emitteddays/limitas a JSON string (e.g.{"days": "7"}) — common with smaller runtime models, and observed unrelated-to-the-PR during eval runs in #1629 and #1762. The clampmin("7", 365)tried to compare an int against a str and raised. After: the tool coerces string-typeddays/limitto int before clamping, so"7"/"10"work; genuinely non-numeric input (e.g.days="soon") now returns a clear{"status": "error", ...}naming the offending arg instead of a raw TypeError — no silent fallback.Closes #1763
Test plan
GAIA_MEMORY_DISABLED=1 python -m pytest tests/unit/test_memory_mixin.py::TestLLMToolParameterClamping -xpassespython util/lint.py --allpasses (black/isort/pylint/flake8 clean)search_past_conversations(days="7")returnsstatusfound/empty, andsearch_past_conversations(days="soon")returns astatus: errormessage containingdays.