Repository navigation
fix(duckduckgo): send an honest User-Agent instead of a spoofed browser UA - #164726
Conversation
…er UA extensions/duckduckgo/src/ddg-client.ts sent a spoofed desktop Chrome/Linux User-Agent on every request to html.duckduckgo.com. DuckDuckGo's HTML endpoint flags that spoofed UA and answers with an HTTP 202 bot-challenge page instead of search results, even for a single, non-parallel request, so web_search fails almost immediately with a generic provider_error. Send an honest, plugin-identifying UA (openclaw-duckduckgo/<version>) instead, following the same convention already used by the parallel plugin's web-search client. Verified live against html.duckduckgo.com: the spoofed UA gets a 202 bot-challenge; the honest UA gets a normal 200 with real results. Fixes openclaw#164471 Co-authored-by: Copilot <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 12:42 AM ET / 04:42 UTC (Revision 3). ClawSweeper reviewWhat this changesThe DuckDuckGo search plugin identifies requests with its name and package version instead of a Chrome User-Agent, with a regression test for the outgoing header. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and the latest release retain the reported header. The focused fix has convincing real-search proof and no blocking findings. Priority: P2 Review scores
Verification
How this fits togetherThe DuckDuckGo plugin receives web_search queries and fetches DuckDuckGo’s HTML endpoint through OpenClaw’s shared network boundary. It parses results into titles, links, and snippets or reports a provider error. flowchart LR
A[Search query and settings] --> B[DuckDuckGo plugin]
B --> C[Request with plugin identity]
C --> D[Shared network boundary]
D --> E[DuckDuckGo HTML response]
E --> F{Results or challenge}
F --> G[Search results]
F --> H[Provider error]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +6, Tests +59. Total +65 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep request identity in the existing DuckDuckGo client, reuse the public version helper, and retain explicit challenge handling and documented service limitations. Do we have a high-confidence way to reproduce the issue? Yes, the supplied isolated Gateway comparison provides a concrete reproduction path and observed before/after results. This review verified the source path but did not independently execute current main; upstream challenges remain variable. Is this the best way to solve the issue? Yes, changing the header in its existing request owner is a narrow repair supported by live comparisons and an established sibling pattern. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 078ca8950dbc. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Simplify private package plumbing and repeated transformations while preserving public APIs, protocol shapes, lifecycle ordering and security behavior. Reuse canonical Markdown spans and llm validation; reduce memory byte/token/trigger boilerplate, internal aliases and private forwarding helpers. Coverage-exhausted batch: 285 net production lines removed; the PR contains a READ log for all 114 production files over 200 lines. Blacksmith Testbox passed 1,343 tests in 65 files and both cycle checks reported zero. Independent review completed; the original multimodal fallback and SDK protected API were retained. Shrink the affected assertion baseline from 3 to 1. Exact-head hosted CI owns the final gate. Land under the explicitly authorized inherited-failure exception. Final-head CI run 37172814274 has only the mock-export ratchet git ENOBUFS failure and the type-suppression inventory 18-versus-16 mismatch. Unrelated PR #164726 current run 37172830533 reproduces both exact failures in unchanged tooling/SDK test files. All remaining CI jobs passed or were intentionally skipped; Security Review reports only the same failed CI aggregate. The CJK lint correction passed independent review, AWS focused tests and lint, and both zero-cycle guards.
Simplify private package plumbing and repeated transformations while preserving public APIs, protocol shapes, lifecycle ordering and security behavior. Reuse canonical Markdown spans and llm validation; reduce memory byte/token/trigger boilerplate, internal aliases and private forwarding helpers. Coverage-exhausted batch: 285 net production lines removed; the PR contains a READ log for all 114 production files over 200 lines. Blacksmith Testbox passed 1,343 tests in 65 files and both cycle checks reported zero. Independent review completed; the original multimodal fallback and SDK protected API were retained. Shrink the affected assertion baseline from 3 to 1. Exact-head hosted CI owns the final gate. Land under the explicitly authorized inherited-failure exception. Final-head CI run 37172814274 has only the mock-export ratchet git ENOBUFS failure and the type-suppression inventory 18-versus-16 mismatch. Unrelated PR openclaw#164726 current run 37172830533 reproduces both exact failures in unchanged tooling/SDK test files. All remaining CI jobs passed or were intentionally skipped; Security Review reports only the same failed CI aggregate. The CJK lint correction passed independent review, AWS focused tests and lint, and both zero-cycle guards.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 51f4a70. Thanks @takyyon! Verified against live html.duckduckgo.com through a built Gateway: with the spoofed Chrome UA main got HTTP 202 challenges and provider_error on all three queries; with the plugin-identifying UA every query returned real results. DuckDuckGo may still rate-limit at times; that part is outside our control. |
…er (openclaw#164726) Identify DuckDuckGo web_search requests as openclaw-duckduckgo/<version> instead of a spoofed desktop Chrome User-Agent, which DuckDuckGo answered with an HTTP 202 bot challenge and surfaced as provider_error. Fixes openclaw#164471. Co-authored-by: Krrish <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
DuckDuckGo's HTML endpoint can return an HTTP 202 bot-challenge page for the plugin's spoofed Chrome User-Agent. The real
web_searchtool then returnsprovider_errorinstead of results.Fixes #164471.
Changes
Identify the client honestly as
openclaw-duckduckgo/<plugin-version> (+https://docs.openclaw.ai), using the existing public package-version helper. No endpoint, parser, retries, configuration, other providers, or challenge-handling changes. Keep takyyon's original fix and regression; make the regression query deterministic and avoid claiming that challenges disappear entirely.Merged current main to incorporate the inherited inventory repair. No overlap with Pash/Sarah changes.
Evidence
Verified through
POST /tools/invokeon built Gateways in a network-enabled, secretless Docker container (Node 24.21.0), with isolated profiles/state and DuckDuckGo explicitly selected. Diagnostics captured actual outgoing User-Agent and upstream HTTP status; no response or request-header substitution.Queries:
OpenClaw documentation,TypeScript handbook,NASA Mars mission.provider_error497de2e869f6, candidate with only request owner reverted)provider_errorcbb2e1be96842752ca570843208ec405db46e387Captured base UA:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36.Captured candidate UA:
openclaw-duckduckgo/2026.9.8 (+https://docs.openclaw.ai).Returned URLs included
https://docs.openclaw.ai/,https://www.typescriptlang.org/docs/handbook/intro.html, andhttps://mars.nasa.gov/.The baseline varied between successful searches and challenges. This is a live, unofficial HTML service, not a guarantee against throttling; no evasion, UA rotation, or burst testing was used. Candidate passed both sequential sets in this environment.
node scripts/run-vitest.mjs extensions/duckduckgo/src/— 19 tests passed across 4 files, 10.55 s wall. Hosted test timing pending the new head.pnpm tsgotypecheck completed without diagnostics; built Gateway and external plugin runtime completed.gpt-5-minicall completed with reasoninglow, output budget 4096, and responseopenclaw-ddg-live-gate-ok.Earlier CI classification
The original head had three underlying failures plus duplicate aggregate CI-gate failures:
check-test-mock-exports.mtsstopped atspawnSync git ENOBUFS, not a DuckDuckGo assertion. Earlier line-cap and assertion ratchets passed.plugin-config-runtime.test.tsnegative assertions. Main's d073c774d3c adds precisely those entries; now merged.openclaw/ci-gatecheck and status propagated those job failures.Thanks to @takyyon for the report, original fix, and deployment observations.
Final formatting correction
Head
82a15d017cf85da9a53adae36c5f47fa3b2784b4only expands the deterministic test request into the repository's required multiline layout; production/runtime bytes are unchanged from the live proof above. The earliercheck-lintfailure was ours, not inherited, and is fixed. Targeted formatting, realpnpm tsgo, and the focused regression passed (6.72 s combined wall). All other CI jobs passed on the preceding head, and ClawSweeper marked that head ready. A fresh exact-head CI/review is requested. The realgpt-5-minigate also completed on the final head (reasoning low, output budget 4096).