Skip to content

fix(duckduckgo): send an honest User-Agent instead of a spoofed browser UA - #164726

Merged
obviyus merged 4 commits into
openclaw:mainfrom
takyyon:fix/ddg-honest-user-agent
Oct 7, 2026
Merged

obviyus merged 4 commits into
openclaw:mainfrom
takyyon:fix/ddg-honest-user-agent

Conversation

@takyyon

@takyyon takyyon commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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_search tool then returns provider_error instead 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/invoke on 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.

Runtime Upstream HTTP status User-visible result
Original PR base request owner 200, 200, 202 Two real result sets; NASA query returned provider_error
Current main control (497de2e869f6, candidate with only request owner reverted) 202, 202, 202 All three returned provider_error
Candidate cbb2e1be96842752ca570843208ec405db46e387 200, 200, 200 Three real results per query
Candidate repeated after current-main control 200, 200, 200 Three real results per query

Captured 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, and https://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.

  • Original contributed regression: failed on the original request owner with the captured Chrome UA (1 failed, 2.68 s wall); passed on the original PR head (1 passed, 4.37 s wall).
  • Frozen merged candidate: 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.
  • Real pnpm tsgo typecheck completed without diagnostics; built Gateway and external plugin runtime completed.
  • One real gpt-5-mini call completed with reasoning low, output budget 4096, and response openclaw-ddg-live-gate-ok.

Earlier CI classification

The original head had three underlying failures plus duplicate aggregate CI-gate failures:

  • PR context and evidence: required problem/evidence headings were missing; supplied here.
  • checks-fast-baseline-ratchets: check-test-mock-exports.mts stopped at spawnSync git ENOBUFS, not a DuckDuckGo assertion. Earlier line-cap and assertion ratchets passed.
  • checks-node-compact-small-2: missing inventory entries for two existing plugin-config-runtime.test.ts negative assertions. Main's d073c774d3c adds precisely those entries; now merged.
  • openclaw/ci-gate check and status propagated those job failures.
  • One cancelled auto-response job, with no executed steps; not a selected test lane.

Thanks to @takyyon for the report, original fix, and deployment observations.

Final formatting correction

Head 82a15d017cf85da9a53adae36c5f47fa3b2784b4 only expands the deterministic test request into the repository's required multiline layout; production/runtime bytes are unchanged from the live proof above. The earlier check-lint failure was ours, not inherited, and is fixed. Targeted formatting, real pnpm 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 real gpt-5-mini gate also completed on the final head (reasoning low, output budget 4096).

…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]>
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added extensions: duckduckgo size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Oct 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 12:42 AM ET / 04:42 UTC (Revision 3).

ClawSweeper review

What this changes

The 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
Reviewed head: 82a15d017cf85da9a53adae36c5f47fa3b2784b4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable fix with convincing live comparisons and a useful regression; no material remediation remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The recorded Docker Gateway /tools/invoke comparison exercises the changed DuckDuckGo request owner against the real service, captures the new header, and shows repeated HTTP 200 searches with parsed results after control failures. Final-head production bytes match that candidate. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The recorded Docker Gateway /tools/invoke comparison exercises the changed DuckDuckGo request owner against the real service, captures the new header, and shows repeated HTTP 200 searches with parsed results after control failures. Final-head production bytes match that candidate. No stored-data contract changes.
Evidence reviewed 10 items Verified introduced change: The pinned merge-base-to-head diff changes only the DuckDuckGo request identity and adds its focused regression. It preserves the endpoint, parser, cancellation, challenge rejection, configuration, and shared transport.
Still necessary on main: Current main still sends the spoofed Chrome/Linux header. Its request-owner blob is 40ca8107c4b87e37824dcb66d4d1187af7bc0c97, identical to the pinned PR base.
Latest release source: The supplied latest release, v2026.9.8, contains the same request-owner blob and Chrome User-Agent; this fix is not present there.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +6, Tests +59. Total +65 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 8 2 +6
Tests 1 59 0 +59
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 67 2 +65

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #164471
Summary: This PR is the focused candidate fix for the paired open DuckDuckGo report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs ordinary searches for an explicitly selected experimental provider with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The recorded Docker Gateway /tools/invoke comparison exercises the changed DuckDuckGo request owner against the real service, captures the new header, and shows repeated HTTP 200 searches with parsed results after control failures. Final-head production bytes match that candidate. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The recorded Docker Gateway /tools/invoke comparison exercises the changed DuckDuckGo request owner against the real service, captures the new header, and shows repeated HTTP 200 searches with parsed results after control failures. Final-head production bytes match that candidate. No stored-data contract changes.

Evidence

What I checked:

  • Verified introduced change: The pinned merge-base-to-head diff changes only the DuckDuckGo request identity and adds its focused regression. It preserves the endpoint, parser, cancellation, challenge rejection, configuration, and shared transport. (extensions/duckduckgo/src/ddg-client.ts:175, 82a15d017cf8)
  • Still necessary on main: Current main still sends the spoofed Chrome/Linux header. Its request-owner blob is 40ca8107c4b87e37824dcb66d4d1187af7bc0c97, identical to the pinned PR base. (extensions/duckduckgo/src/ddg-client.ts:168, 078ca8950dbc)
  • Latest release source: The supplied latest release, v2026.9.8, contains the same request-owner blob and Chrome User-Agent; this fix is not present there. (extensions/duckduckgo/src/ddg-client.ts:168, fc23bc864e45)
  • Real production-path proof: The captured PR body records POST /tools/invoke on built Gateways in isolated, secretless Docker profiles with DuckDuckGo explicitly selected. Actual outgoing headers and upstream statuses were observed without substitution. The current-main control returned HTTP 202 and provider_error for three queries; the candidate returned HTTP 200 and three real results for each query, including a repeated candidate set. This is supplied runtime evidence, not reviewer-executed testing. (cbb2e1be9684)
  • Proof remains applicable to final head: The live-tested candidate and final reviewed head both reference production blob 11eee3eaf97f69030615e57054ece19f37e4e45e. The final commit therefore preserves the proven production behavior. (extensions/duckduckgo/src/ddg-client.ts:25, 82a15d017cf8)
  • Existing SDK and sibling pattern: The existing public package-version helper tolerates source and installed layouts with an unknown-version fallback. Parallel search already uses the same helper for a plugin-identifying header. This PR consumes the existing SDK contract without expanding it. (src/plugin-sdk/extension-shared.ts:196, 82a15d017cf8)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-04T03:05:28.733Z sha da987fc :: needs maintainer review before merge. :: none
  • reviewed 2026-10-07T04:29:22.851Z sha cbb2e1b :: needs maintainer review before merge. :: none

steipete added a commit that referenced this pull request Oct 4, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
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.
@obviyus

obviyus commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Oct 7, 2026
@obviyus

obviyus commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus
obviyus merged commit 51f4a70 into openclaw:main Oct 7, 2026
102 checks passed
@obviyus

obviyus commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

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.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: duckduckgo P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DuckDuckGo web_search returns provider_error due to spoofed User-Agent triggering bot challenge

2 participants