fix (tools): correctly report duckduckgo ratelimit events - #3456
Open
sven2718 wants to merge 3 commits into
Open
fix (tools): correctly report duckduckgo ratelimit events#3456sven2718 wants to merge 3 commits into
sven2718 wants to merge 3 commits into
Conversation
When DuckDuckGo throttles a client it doesn't error: it serves a captcha/anomaly page with HTTP 200 (or a 202 interstitial) that parses as zero results. The web_search tool then reports "No results found. Try rephrasing your search.", so the agent rephrases and searches again, over and over, digging a deeper ban. Detect the bot-check page and the 202 interstitial and report rate limiting with guidance to wait or fetch known URLs directly, and name rate limiting as the likely cause in the empty-results message. 💘 Generated with Crush Assisted-by: Kimi K3 via Crush <crush@charm.land>
Test against the real bot-check payload captured from lite.duckduckgo.com (HTTP 202, captcha modal, kept in testdata): the 202 interstitial and the anomaly page both surface as throttling, a normal results page still parses, and the empty-results message names rate limiting. 💘 Generated with Crush Assisted-by: Kimi K3 via Crush <crush@charm.land>
staticcheck ST1005: error strings should not end with punctuation. 💘 Generated with Crush Assisted-by: Kimi K3 via Crush <crush@charm.land>
Contributor
Author
|
@taciturnaxolotl: poke for review. |
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.
I've noticed that if crush is running agentic fetch and the fetch-agent uses the search tool quickly/frequently enough, it will trigger a rate limit block by duckduckgo. In such a case, the search tool's response to the agent will be "No results found". This happens because duckduckgo's rate limiting reply is not a "retry-after", it's a 2xx that includes a captcha so that a human user could continue their search.
Misreporting a rate-limit as an empty result is a problem, particularly if you've set a relatively strong model as your "small" default. Using Kimi 2.6 as my small model, I've managed to spend over an hour inside a single agentic fetch call in which kimi keeps trying different strategies to figure out why search terms that obviously should return plenty of results are instead returning "no results found".
The issue is easily fixable via a crush patch -- mod the search tool so that if it gets results that look like a captcha page triggered by rate limiting, the tool tells the agent "looks like we hit a rate limit", rather than "no results found".
CONTRIBUTING.md.