Redirect to noai when AI is disabled#8717
Draft
marcosholgado wants to merge 5 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.cominstead ofduckduckgo.comso the server can serve an AI-freeSERP. Gated behind a new remote feature flag.
Rather than change
AppUrl.Url.HOST(referenced in ~20 places — cookies, URLclassification, JS-messaging allowlists, sync, surveys), the host swap is scoped to
search-query URL construction only. A new
DuckDuckGoSerpHostProviderowns thedecision (
noAiSerpHostflag enabled and!duckChat.isEnabled()) and the hoststring, and is consulted at the query-building sites. Because
DuckDuckGoUrlDetectormatches on the registrable domain (
topPrivateDomain()),noai.duckduckgo.comisstill recognised as a DDG URL everywhere downstream, so the other
HOSTusages areuntouched.
Details:
androidBrowserConfig.noAiSerpHost(defaultINTERNALduring rollout).AppUrl.Url.NO_AI_HOST = "noai.duckduckgo.com".DuckDuckGoSerpHostProviderreads the flag + Duck.ai state fresh per query (no caching),so it reflects the user toggling AI mid-session.
QueryUrlConverter(omnibar / navigated queries) and theAutoCompletevisited-SERP suggestion URL.
kbg=-1(HIDE_DUCK_AI) param is no longerappended in
DuckDuckGoRequestRewriter— the host itself signals AI-off, so the twoare 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
noai.duckduckgo.com(check the loaded URL via proxy/web inspector) and that
kbg=-1is NOT in the query.noai.duckduckgo.com.Queries stay on duckduckgo.com when AI is enabled
duckduckgo.com.Flag off = unchanged behaviour
noAiSerpHostflag (feature-flag inventory / dev settings). With Duck.aioff, searches go to
duckduckgo.comandkbg=-1is present, exactly as before.Typed URLs unaffected
example.com) → navigates there unchanged(no host rewrite).
UI changes
No UI changes — the AI-free SERP is rendered server-side by the
noaihost.