Skip to content

fix(memory): coerce string-typed days/limit in search_past_conversations#1764

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
autofix/issue-1763
Open

fix(memory): coerce string-typed days/limit in search_past_conversations#1764
github-actions[bot] wants to merge 1 commit into
mainfrom
autofix/issue-1763

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Before: search_past_conversations crashed with TypeError: '<' not supported between instances of 'int' and 'str' whenever a model emitted days/limit as 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 clamp min("7", 365) tried to compare an int against a str and raised. After: the tool coerces string-typed days/limit to 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 -x passes
  • python util/lint.py --all passes (black/isort/pylint/flake8 clean)
  • Deterministic repro from the issue no longer triggers the tool crash: calling search_past_conversations(days="7") returns status found/empty, and search_past_conversations(days="soon") returns a status: error message containing days.

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
@kovtcharov

Copy link
Copy Markdown
Collaborator

@alexey-tyurin let me know if this fixes it for you.

@alexey-tyurin

Copy link
Copy Markdown
Contributor

@kovtcharov-amd - Confirmed — fixes it for me. The string-arg repro now coerces and clamps instead
of raising, and non-numeric input returns the structured error per the acceptance
criteria. Thanks for the quick turnaround! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: search_past_conversations crashes on string-typed days/limit ("'<' not supported between instances of 'int' and 'str'")

2 participants