fix: prefer explicit dates in Tavily searches#9234
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Tavily web search tool to prioritize start_date and end_date over time_range when constructing the search payload, and adds comprehensive unit tests for this normalization logic. The feedback recommends stripping whitespace from start_date and end_date to prevent whitespace-only strings from being incorrectly treated as truthy values, which could cause API errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
feede96 to
add2ba8
Compare
add2ba8 to
f15a1ba
Compare
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The allowed
time_rangevalues ("day","week","month","year") are now duplicated inline in this logic; consider centralizing them as a shared constant or enum so future changes don’t require hunting through call sites.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The allowed `time_range` values (`"day"`, `"week"`, `"month"`, `"year"`) are now duplicated inline in this logic; consider centralizing them as a shared constant or enum so future changes don’t require hunting through call sites.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Reviewed: the allowed time_range list is not duplicated by this change; the existing check was moved unchanged into the mutually exclusive branch. Keeping this single-use validation inline follows the repository Inline-First rule. |
Fixes #8154
Modifications / 改动点
Prefer explicit start/end dates when a Tavily request also contains time_range.
Preserve the existing time_range behavior when no explicit date is provided.
Add regression coverage for both dates, either single date, and empty dates.
This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
Summary by Sourcery
Normalize Tavily web search date filters to prefer explicit start/end dates over time_range while preserving existing behavior when no valid dates are provided.
Bug Fixes:
Tests: