Skip to content

Redirect to noai when AI is disabled#8717

Draft
marcosholgado wants to merge 5 commits into
developfrom
feature/marcos/noai
Draft

Redirect to noai when AI is disabled#8717
marcosholgado wants to merge 5 commits into
developfrom
feature/marcos/noai

Conversation

@marcosholgado
Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/task/1215234100141222?focus=true

Description

When a user performs a search while Duck.ai is disabled, route the query to
noai.duckduckgo.com instead of duckduckgo.com so the server can serve an AI-free
SERP. Gated behind a new remote feature flag.

Rather than change AppUrl.Url.HOST (referenced in ~20 places — cookies, URL
classification, JS-messaging allowlists, sync, surveys), the host swap is scoped to
search-query URL construction only. A new DuckDuckGoSerpHostProvider owns the
decision (noAiSerpHost flag enabled and !duckChat.isEnabled()) and the host
string, and is consulted at the query-building sites. Because DuckDuckGoUrlDetector
matches on the registrable domain (topPrivateDomain()), noai.duckduckgo.com is
still recognised as a DDG URL everywhere downstream, so the other HOST usages are
untouched.

Details:

  • New flag androidBrowserConfig.noAiSerpHost (default INTERNAL during rollout).
  • New AppUrl.Url.NO_AI_HOST = "noai.duckduckgo.com".
  • DuckDuckGoSerpHostProvider reads the flag + Duck.ai state fresh per query (no caching),
    so it reflects the user toggling AI mid-session.
  • Wired into QueryUrlConverter (omnibar / navigated queries) and the AutoComplete
    visited-SERP suggestion URL.
  • When the noai host is used, the existing kbg=-1 (HIDE_DUCK_AI) param is no longer
    appended in DuckDuckGoRequestRewriter — the host itself signals AI-off, so the two
    are mutually exclusive.

Steps to test this PR

Use an internal build (./gradlew installInternalDebug) — the flag defaults on there.

Queries route to noai when AI is disabled

  • Turn Duck.ai off (Duck.ai settings).
  • Search from the address bar; confirm the SERP loads from noai.duckduckgo.com
    (check the loaded URL via proxy/web inspector) and that kbg=-1 is NOT in the query.
  • Tap a previous search suggestion in autocomplete → also routes to noai.duckduckgo.com.

Queries stay on duckduckgo.com when AI is enabled

  • Re-enable Duck.ai; search again → SERP loads from duckduckgo.com.

Flag off = unchanged behaviour

  • Disable the noAiSerpHost flag (feature-flag inventory / dev settings). With Duck.ai
    off, searches go to duckduckgo.com and kbg=-1 is present, exactly as before.

Typed URLs unaffected

  • With AI off + flag on, type a full URL (e.g. example.com) → navigates there unchanged
    (no host rewrite).

UI changes

No UI changes — the AI-free SERP is rendered server-side by the noai host.

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