You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In backend/utils/retrieval/tools/file_tools.py, invoking search_files_tool exhibits several resilience and input-type failure modes:
String end_seconds TypeError:
When LLM tool calls supply end_seconds as a string (e.g., "15") with start_seconds=None, line 203 previously executed: start = start_seconds if start_seconds is not None else max(0, (end_seconds or 0) - 5)
In Python, ("15" or 0) - 5 raises an unhandled TypeError: unsupported operand type(s) for -: 'str' and 'int'.
Missing top-level config fallback: user_id and chat_session_id are only checked in cfg.get('configurable', {}). In standard LangChain/LangGraph invocations or alternate runnables where configuration provides top-level user_id or chat_session_id, the tool previously defaulted to empty strings without fallback.
Unhandled non-numeric / malformed timestamps:
Non-numeric strings or invalid float values (such as nan, inf, or malformed text) passed into timestamp fields can cause unexpected math or conversion errors in downstream file window slicing.
Empty question validation:
Empty or whitespace-only questions were passed down to vision/multimodal LLM processing instead of returning an immediate validation message.
Single string file_ids coercion:
If an LLM supplies a single string file_ids="file_123" instead of a list, iterating or testing membership treats the string as a sequence of single characters unless normalized to [file_ids].
Proposed Changes
Timestamp Sanitization (_parse_seconds):
Add helper _parse_seconds to safely coerce int, float, or numeric strings to finite non-negative floats, while safely ignoring None, booleans, non-numeric strings, and infinities/NaNs.
Activity
fix(file-tools): guard string end_seconds coercion and fallback top-l…
test(file-tools): add unit tests for coercion, bounds, and guards (Ba…
Dimank92 commentedon Oct 22, 2026
PR created with comprehensive hermetic unit tests: #23200
Bounty proposal: $50 USDC
Payout address:
0xC345C07229307d4f1c7935aD2cAe48e390215808(USDC Polygon/Base/Arbitrum)undivisible commentedon Oct 22, 2026
Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏
fix(file-tools): guard string end_seconds coercion and fallback top-l…
style(file-tools): wrap lines under 120 chars, format blank lines and…
style(file-tools): wrap overlong assert and remove unused pytest/Chat…
fix(file-tools): guard string end_seconds coercion and fallback top-l…
style(file-tools): wrap lines under 120 chars, format blank lines and…
style(file-tools): wrap overlong assert and remove unused pytest/Chat…
fix(file-tools): guard string end_seconds coercion and fallback top-l…
style(file-tools): wrap lines under 120 chars, format blank lines and…
style(file-tools): wrap overlong assert and remove unused pytest/Chat…