Skip to content

fix(searxng): avoid duplicating configured search endpoint - #113661

Merged
steipete merged 1 commit into
openclaw:mainfrom
VectorPeak:fix/searxng-search-endpoint-base-url
Jul 29, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
VectorPeak:fix/searxng-search-endpoint-base-url

Conversation

@VectorPeak

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes an issue where users configuring a self-hosted SearXNG instance with a base URL that already points at the /search endpoint would have OpenClaw send requests to /search/search instead.

This affects the SearXNG web-search path because runSearxngSearch() resolves the configured base URL and then buildSearxngSearchUrl() appends the search endpoint before the guarded provider request is made. A normal endpoint-style configuration such as http://127.0.0.1:<port>/search therefore targets the wrong route.

Why This Change Was Made

The URL builder now trims trailing slashes from the configured path and reuses it when it already ends in /search; otherwise it keeps the existing behavior of appending /search to base-path prefixes.

This keeps the fix local to the SearXNG client endpoint construction. It does not change SSRF validation, trusted/self-hosted routing, query parameter handling, category retry behavior, response parsing, or cache keys.

User Impact

Users can configure either a SearXNG host root or an explicit SearXNG search endpoint without OpenClaw duplicating the path segment.

For example, https://search.example.com/searxng still builds https://search.example.com/searxng/search?..., while https://search.example.com/search now builds https://search.example.com/search?... rather than https://search.example.com/search/search?....

Evidence

User-realistic local path capture using runSearxngSearch() against a local HTTP server:

Before: {baseUrl:http://127.0.0.1:<port>/search,requests:[/search/search?q=q&format=json]}
After:  {baseUrl:http://127.0.0.1:<port>/search,requests:[/search?q=q&format=json]}

Focused validation:

node scripts/run-vitest.mjs run extensions/searxng/src/searxng-client.test.ts

Test Files  1 passed (1)
Tests       15 passed (15)

Additional check:

git diff --check -- extensions/searxng/src/searxng-client.ts extensions/searxng/src/searxng-client.test.ts
passed

Sibling surface checked: the existing base-path-prefix test still verifies that a configured prefix such as /searxng continues to append /search instead of being treated as a complete endpoint.

@VectorPeak
VectorPeak force-pushed the fix/searxng-search-endpoint-base-url branch from d4c966a to 68bdaed Compare July 25, 2026 13:00
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
@VectorPeak
VectorPeak force-pushed the fix/searxng-search-endpoint-base-url branch from 68bdaed to 2c483b5 Compare July 25, 2026 13:15
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels Jul 25, 2026
@clawsweeper

clawsweeper Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 25, 2026, 9:19 AM ET / 13:19 UTC.

ClawSweeper review

What this changes

The PR makes the SearXNG web-search client reuse a configured URL path already ending in /search, including a trailing-slash form, and adds focused URL-builder tests.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer review. The current implementation on main always appends /search, so an already endpoint-qualified SearXNG URL produces /search/search; this patch corrects that narrow behavior while preserving host-root and base-prefix handling. The branch is behind main, so required checks and merge-result review should apply to the refreshed head before landing.

Likely related people: vincentkoc is a low-confidence routing candidate based on recent SearXNG feature-tracker discussion, rather than a proven source-history ownership trail.

Priority: P2
Reviewed head: 2c483b5e1df11df562d9f8b27c52bc0fc602b8c8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-scoped repair with source-aligned tests and credible real-path evidence; only the normal refreshed-head CI gate remains.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body includes an after-fix local HTTP-server request-path capture through the real runSearxngSearch() path, showing /search instead of /search/search; it also includes focused test output. No private data is shown.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body includes an after-fix local HTTP-server request-path capture through the real runSearxngSearch() path, showing /search instead of /search/search; it also includes focused test output. No private data is shown.
Evidence reviewed 4 items Current-main behavior: The current buildSearxngSearchUrl implementation appends /search whenever the configured pathname does not end in /; a configured /search path therefore becomes /search/search.
Patch scope and regression coverage: The proposed change removes trailing slashes, preserves a pathname already ending in /search, and adds coverage for both /search and /search/; the existing base-prefix behavior remains covered according to the PR evidence.
Real-path proof supplied: The PR body records an after-fix local HTTP-server capture through runSearxngSearch() showing /search rather than /search/search, plus a focused test run reporting 15 passing tests.
Findings None None.
Security None None.

How this fits together

The bundled SearXNG plugin converts a configured self-hosted instance URL plus a search query into a JSON search request. That request is validated and sent through OpenClaw’s guarded web-search transport, then normalized into tool results for agents.

flowchart LR
  A[Configured SearXNG URL] --> B[Resolve search settings]
  C[Agent web search query] --> D[Build JSON search URL]
  B --> D
  D --> E[Validate endpoint and send request]
  E --> F[Parse SearXNG results]
  F --> G[Return normalized web-search results]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main; refresh the merge result and let required checks gate the exact head before landing. No concrete three-way regression is evidenced by that status alone.
  • Complete next step (P2) - No discrete repair is needed from ClawSweeper: the patch is correct, while branch refresh and required-check completion are ordinary contributor and maintainer review steps.
Agent review details

Security

None.

PR surface

Source +1, Tests +15. Total +16 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 1 15 0 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 17 1 +16

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase or update the branch onto current main, retain the focused endpoint and base-prefix coverage, and merge once the refreshed required checks succeed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase or update the branch onto current main, retain the focused endpoint and base-prefix coverage, and merge once the refreshed required checks succeed.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: configure the SearXNG base URL with a pathname ending in /search and call the web-search path; current main appends another /search. The contributor also supplied a local HTTP-server after-fix capture, but this review did not independently execute it.

Is this the best way to solve the issue?

Yes. Normalizing only trailing slashes and treating an existing /search suffix as a complete endpoint is the narrowest maintainable repair; it preserves configured base-path prefixes such as /searxng and leaves request validation and query handling unchanged.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9a7a5791c720.

Labels

Label changes:

  • add P2: This is a bounded configuration-path bug in an optional web-search provider; affected users receive requests to the wrong endpoint but the repair has limited blast radius.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-fix local HTTP-server request-path capture through the real runSearxngSearch() path, showing /search instead of /search/search; it also includes focused test output. No private data is shown.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes an after-fix local HTTP-server request-path capture through the real runSearxngSearch() path, showing /search instead of /search/search; it also includes focused test output. No private data is shown.

Label justifications:

  • P2: This is a bounded configuration-path bug in an optional web-search provider; affected users receive requests to the wrong endpoint but the repair has limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 PR body includes an after-fix local HTTP-server request-path capture through the real runSearxngSearch() path, showing /search instead of /search/search; it also includes focused test output. No private data is shown.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-fix local HTTP-server request-path capture through the real runSearxngSearch() path, showing /search instead of /search/search; it also includes focused test output. No private data is shown.

Evidence

What I checked:

  • Current-main behavior: The current buildSearxngSearchUrl implementation appends /search whenever the configured pathname does not end in /; a configured /search path therefore becomes /search/search. (extensions/searxng/src/searxng-client.ts:78, 9a7a5791c720)
  • Patch scope and regression coverage: The proposed change removes trailing slashes, preserves a pathname already ending in /search, and adds coverage for both /search and /search/; the existing base-prefix behavior remains covered according to the PR evidence. (extensions/searxng/src/searxng-client.test.ts:67, 2c483b5e1df1)
  • Real-path proof supplied: The PR body records an after-fix local HTTP-server capture through runSearxngSearch() showing /search rather than /search/search, plus a focused test run reporting 15 passing tests. (2c483b5e1df1)
  • Related feature context: The prior SearXNG feature discussion was consolidated into the bundled-plugin tracking issue by vincentkoc; it establishes the surrounding feature area but does not establish the same root cause for this URL-construction repair.

Likely related people:

  • vincentkoc: A repository member consolidated earlier SearXNG feature discussion into the current bundled-plugin tracking direction; no local history evidence was available to establish direct ownership of this client helper. (role: related feature-tracker contributor; confidence: low; files: extensions/searxng/src/searxng-client.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Update the branch against current main and let the required checks validate that refreshed merge result.

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.

@steipete
steipete merged commit 404faff into openclaw:main Jul 29, 2026
161 of 165 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

pull Bot pushed a commit to yann0001/openclaw that referenced this pull request Jul 29, 2026
* origin/main:
  fix(codex): restore connected apps for token-authenticated runs (openclaw#115075)
  fix(codex): classify hosted search timeouts (openclaw#115837)
  fix(msteams): keep attachment replies in channel threads (openclaw#94348)
  fix(telegram): linkPreview:false is ignored on streamed replies (openclaw#114125)
  fix(protocol): make Swift model checks non-mutating (openclaw#115793)
  fix(searxng): avoid duplicating search endpoint (openclaw#113661)
  fix(agents): preserve tool-result middleware identity (openclaw#115821)
  refactor(meetings): consolidate runtime facades (openclaw#115819)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
* origin/main:
  fix(codex): restore connected apps for token-authenticated runs (openclaw#115075)
  fix(codex): classify hosted search timeouts (openclaw#115837)
  fix(msteams): keep attachment replies in channel threads (openclaw#94348)
  fix(telegram): linkPreview:false is ignored on streamed replies (openclaw#114125)
  fix(protocol): make Swift model checks non-mutating (openclaw#115793)
  fix(searxng): avoid duplicating search endpoint (openclaw#113661)
  fix(agents): preserve tool-result middleware identity (openclaw#115821)
  refactor(meetings): consolidate runtime facades (openclaw#115819)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: XS 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.

2 participants