Skip to content

fix(Plugins.Web): Tavily max_results must not subtract Skip - #14143

Open
Diwakar Ray Yadav (Diwak4r) wants to merge 3 commits into
microsoft:mainfrom
Diwak4r:fix/latent-defect
Open

fix(Plugins.Web): Tavily max_results must not subtract Skip#14143
Diwakar Ray Yadav (Diwak4r) wants to merge 3 commits into
microsoft:mainfrom
Diwak4r:fix/latent-defect

Conversation

@Diwak4r

Copy link
Copy Markdown

Summary

TavilyTextSearch set max_results = top - skip. Tavily has no offset parameter — max_results is its page size — so subtracting skip under-fetched results when paging (Top=5, Skip=2 sent max_results=3), and Skip >= Top sent max_results <= 0.

Impact

A caller paginating with Skip > 0 gets too few (or zero) results. Sibling BingTextSearch correctly uses count={top}&offset={skip}; Tavily must send top directly.

Fix

int? maxResults = top;

Test

Added SkipIsNotSubtractedFromMaxResultsAsync to TavilyTextSearchTests.cs. Asserts the request body contains "max_results":5 for Top=5, Skip=2. FAILS before the fix (max_results:3), PASSES after; full Tavily suite = 31 passed.

🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

@Diwak4r
Diwakar Ray Yadav (Diwak4r) requested a review from a team as a code owner July 8, 2026 19:31
Copilot AI review requested due to automatic review settings July 8, 2026 19:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Diwak4r

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Tavily has no offset parameter, so max_results is its page size. Subtracting
Skip under-fetched results when paging (Top=5, Skip=2 sent max_results=3), and
Skip >= Top sent max_results <= 0. Send top directly, matching Bing's
count/offset handling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Diwak4r

Copy link
Copy Markdown
Author

Friendly bump — this PR has been open for ~2.5 weeks with no activity since the CLA check passed. Just rebased onto current main and force-pushed, so it's up to date again. One-line change: stop subtracting skip from max_results in TavilyTextSearch, since paging and result count are orthogonal. A unit test is included. Happy to adjust if there are review concerns.

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.

2 participants