Skip to content

feat(search): harvest custom DuckDuckGo endpoint#2767

Merged
Hmbown merged 1 commit into
codex/v0.9.0-stewardshipfrom
codex/harvest-2510-search-base-url
Jun 5, 2026
Merged

feat(search): harvest custom DuckDuckGo endpoint#2767
Hmbown merged 1 commit into
codex/v0.9.0-stewardshipfrom
codex/harvest-2510-search-base-url

Conversation

@Hmbown
Copy link
Copy Markdown
Owner

@Hmbown Hmbown commented Jun 5, 2026

Summary

  • Harvests feat(search): allow custom DuckDuckGo endpoint #2510 by @cyq1017 for DuckDuckGo-compatible private search endpoints requested in Support custom URL for search provider #2436 by @Artenx.
  • Adds [search].base_url, preferred CODEWHALE_SEARCH_BASE_URL, and legacy DEEPSEEK_SEARCH_BASE_URL support.
  • Gates network policy on the configured endpoint host, disables public Bing fallback for custom endpoints, and returns explicit errors for non-DuckDuckGo provider/base_url pairings and challenge pages.
  • Polishes diagnostics so custom endpoint results report the configured host in source instead of always duckduckgo.

Credit

Harvested from PR #2510 by @cyq1017.
Reported by @Artenx in #2436.

Verification

  • cargo test -p codewhale-tui --all-features --locked custom_duckduckgo -- --nocapture
  • cargo test -p codewhale-tui --all-features --locked search_base_url -- --nocapture
  • cargo test -p codewhale-tui --all-features --locked search_provider -- --nocapture
  • cargo check -p codewhale-tui --all-features --locked
  • cargo clippy -p codewhale-tui --all-features --locked -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/release/check-versions.sh
  • python3 scripts/check-coauthor-trailers.py --author-map .github/AUTHOR_MAP --range origin/codex/v0.9.0-stewardship..HEAD --check-authors

Fixes #2436.

Add optional [search].base_url support for DuckDuckGo-compatible private search endpoints, including a preferred CODEWHALE_SEARCH_BASE_URL env override and the legacy DEEPSEEK_SEARCH_BASE_URL alias.

Network policy now gates the configured endpoint host, custom endpoints do not fall back to public Bing, non-DuckDuckGo provider/base_url combinations and challenge pages return explicit errors, and custom endpoint results report the configured host as their source.

Fixes #2436

Reported by @Artenx

Harvested from PR #2510 by @cyq1017

Co-authored-by: cyq1017 <61975706+cyq1017@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmbown has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@Hmbown Hmbown merged commit 8cbdf95 into codex/v0.9.0-stewardship Jun 5, 2026
2 checks passed
@Hmbown Hmbown deleted the codex/harvest-2510-search-base-url branch June 5, 2026 02:49
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for custom DuckDuckGo-compatible private search endpoints via the [search].base_url configuration or the CODEWHALE_SEARCH_BASE_URL environment variable. Custom endpoints bypass the public Bing fallback, enforce network policies on their configured host, and report the custom host as the result source. The review feedback suggests validating that the custom base_url uses an http or https scheme to prevent potential runtime errors during request execution.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +1367 to +1371
let mut url = reqwest::Url::parse(raw).map_err(|err| {
ToolError::invalid_input(format!(
"Invalid DuckDuckGo-compatible search base_url: {err}"
))
})?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The custom base_url is parsed using reqwest::Url::parse, but there is no validation to ensure that the scheme is either http or https. If an unsupported scheme (like ftp or file) is configured, it could lead to unexpected runtime errors or failures when reqwest attempts to execute the request. Adding an explicit check for http or https schemes improves robustness.

    let mut url = reqwest::Url::parse(raw).map_err(|err| {
        ToolError::invalid_input(format!(
            "Invalid DuckDuckGo-compatible search base_url: {err}"
        ))
    })?;
    if url.scheme() != "http" && url.scheme() != "https" {
        return Err(ToolError::invalid_input(format!(
            "DuckDuckGo-compatible search base_url must use http or https scheme, got: {}",
            url.scheme()
        )));
    }

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