Skip to content

fix (tools): correctly report duckduckgo ratelimit events - #3456

Open
sven2718 wants to merge 3 commits into
charmbracelet:mainfrom
sven2718:catch_search_ratelimit
Open

fix (tools): correctly report duckduckgo ratelimit events#3456
sven2718 wants to merge 3 commits into
charmbracelet:mainfrom
sven2718:catch_search_ratelimit

Conversation

@sven2718

@sven2718 sven2718 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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".

  • I have read CONTRIBUTING.md.
  • [N/A] I have created a discussion that was approved by a maintainer (for new features).

sven2718 added 2 commits July 29, 2026 14:32
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>
@sven2718 sven2718 changed the title fix (agentic_fetch): correctly report duckduckgo ratelimit events fix (tools): correctly report duckduckgo ratelimit events Jul 29, 2026
staticcheck ST1005: error strings should not end with punctuation.

💘 Generated with Crush

Assisted-by: Kimi K3 via Crush <crush@charm.land>
@sven2718

Copy link
Copy Markdown
Contributor Author

@taciturnaxolotl: poke for review.

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.

1 participant