Repository navigation
fix(community): reject bool and fractional web-search max_results like image search does - #5852
Merged
WillemJiang merged 1 commit intoSep 25, 2026
Conversation
…e image search does
WillemJiang
approved these changes
Sep 25, 2026
This was referenced Sep 25, 2026
hawkli-1994
pushed a commit
to rongxinzy/deer-flow
that referenced
this pull request
Sep 27, 2026
…e image search does (bytedance#5852)
This was referenced Sep 28, 2026
This was referenced Sep 28, 2026
2 tasks done
Winoren
added a commit
to Winoren/deer-flow
that referenced
this pull request
Oct 15, 2026
Serper keeps a private _coerce_max_results in the pre-bytedance#5852 shape: a bare int() silently turns max_results: true into 1 and 3.5 into 3, and an invalid value falls back without a warning (bytedance#5865). Delegate to deerflow.community.search_max_results.coerce_max_results, which owns what invalid means for the folded providers, and keep Serper's 10-result cap at the call site the way You.com does, because clamping policy is deliberately per-provider. Invalid configured counts now warn under the Serper label and fall back to the default instead of being silently coerced.
2 of 9 tasks
WillemJiang
pushed a commit
that referenced
this pull request
Oct 16, 2026
…6966) Serper keeps a private _coerce_max_results in the pre-#5852 shape: a bare int() silently turns max_results: true into 1 and 3.5 into 3, and an invalid value falls back without a warning (#5865). Delegate to deerflow.community.search_max_results.coerce_max_results, which owns what invalid means for the folded providers, and keep Serper's 10-result cap at the call site the way You.com does, because clamping policy is deliberately per-provider. Invalid configured counts now warn under the Serper label and fall back to the default instead of being silently coerced.
2 of 9 tasks
1 task done
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.
Why
README.md(the DDG search section) already documents the contract for both DDG tools:The image-search copy honours it: #5807 added a bool/fractional guard to
_coerce_max_resultsincommunity/image_search/tools.py:19-21. The web-search copy, introduced by #5792, never got it — onorigin/main(174c6f7f) it is still:int()accepts both of the YAML-native shapes the README promises to reject, soweb_searchsilently narrows the result set instead of warning and falling back:max_resultsinconfig.yamlweb_searchon mainimage_searchon main3.5true"3.5",abc,"",0,-2,[](Verified with
yaml.safe_load:max_results: 3.5is afloatandmax_results: trueis abool, so both reach the helper uncoerced — this is not a string-only path.)What changed
backend/packages/harness/deerflow/community/ddg_search/tools.py— port the two-line guard from the image-search sibling into_coerce_max_results, so aboolor a non-integralfloatfalls into the existing "invalid → warn + default" branch instead of being truncated byint().backend/tests/test_ddg_search_tools.py— add thefractional-configandboolean-configrows to the existing parametrize table, mirroring the ids already used bytests/test_image_search.py:91-92.Surface area
One private helper, one call site:
web_search_toolreadsconfig.model_extra.get("max_results", …)(tools.py:193) and passes it through_coerce_max_resultsbefore_search_text(tools.py:200). Integral floats such as4.0and numeric strings keep their current behaviour, so nothing that is valid today changes.Bug fix verification
The two new rows are red on unmodified
origin/main(174c6f7f):and green with the guard applied:
31 passed.Validation
pytest tests/test_ddg_search_tools.py→31 passedpytest tests/test_ddg_search_tools.py tests/test_image_search.py tests/test_web_search_time_range.py tests/test_remote_search.py→75 passed, 10 skippedruff checkandruff format --checkon both changed files → cleanmake testsuite locally; the search-related files above are what I exercised.AI assistance
This change was drafted and verified by an AI coding agent (Qoder CLI agent) on my machine: the reproduction, the RED/GREEN runs and the port of the sibling guard were all executed locally, and the diff was reviewed by the agent rather than by a second human.