Skip to content

Report the toggle's default side on unified input submissions - #9467

Merged
YoussefKeyrouz merged 4 commits into
developfrom
feature/youssef/duckai_default_mode_pixel_param
Aug 18, 2026
Merged

Report the toggle's default side on unified input submissions#9467
YoussefKeyrouz merged 4 commits into
developfrom
feature/youssef/duckai_default_mode_pixel_param

Conversation

@YoussefKeyrouz

@YoussefKeyrouz YoussefKeyrouz commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Task/Issue URL: https://app.asana.com/1/137249556945/task/1217374913029750?focus=true
Tech Design URL (if applicable):
API Proposals URL(s) (if applicable):

Description

Adds default_mode to the prompt and query submission pixels, and toggle_visible to the query pixel, so when the user stays on the default tab and submits, it can be told apart from a switch tab before submission.

Also fixes a bug where the configured default was not applying properly in some cases because the resolver was reading from a cache and not from the repository.

Pixel Added
m_aichat_unified_input_prompt_submitted_count / _daily default_mode
m_aichat_experimental_omnibar_query_submitted_count / _daily default_mode, toggle_visible

default_mode is search or duck_ai, and is omitted when no toggle was offered; toggle_visible=false marks those. Comparing default_mode against which pixel fired gives accepted-versus-switched graph.

DuckChatInternal.resolvedTogglePosition() is the single definition resolved on which side the input opens on. The
pixel layer reads it, and the widget now calls the same method to pick its initial tab.

Steps to test this PR

Enable Search + Duck.ai so the unified input shows both tabs, and watch logcat filtered on
Pixel sent:.

Accepting the default

  • Settings → Ai Features → New Tab Toggle Position → Search.
  • Go back to NTP and submit a search without touching the toggle.
  • m_aichat_experimental_omnibar_query_submitted_count carries default_mode=search, toggle_visible=true
  • Set it to Duck.ai. Submit a prompt without touching the toggle.
  • m_aichat_unified_input_prompt_submitted_count carries default_mode=duck_ai

Switching from the default

  • With the default still Duck.ai, open the native input in a new tab, switch to Search, submit a search
  • The query pixel m_aichat_experimental_omnibar_query_submitted_count must carry default_mode=duck_ai since that was the default
  • With the default Search, open a NTP, switch to Duck.ai and submit a prompt → default_mode=search

Last used

  • Set the default to Last used. Submit from Duck.ai, reopen the native input in a new tab, switch to search and submit
  • That search carries default_mode=duck_ai (It was the last used so the default)

No toggle offered

  • Turn on nativeInputSearchOnly feature flag
  • Got to Ai features -> Select Search only setting so the toggle is hidden
  • Submit a search
  • The query pixel carries toggle_visible=false and no default_mode

Nothing else changed

  • text_length_bucket, selected_tool, model_id and the attachment params are unchanged

UI changes

None


Note

Low Risk
Changes are limited to analytics parameters and toggle-default resolution for UI/pixels; no auth, sync, or submission behavior changes beyond where pixels fire.

Overview
Adds analytics on unified native input submissions so product can see whether users stayed on the Search/Duck.ai default tab or switched before submitting.

Pixels: default_mode (search / duck_ai) is added to omnibar query and unified prompt submission events; omnibar query also gets toggle_visible. Both are omitted when the toggle is hidden (toggle_visible=false); default_mode is only sent for the address-bar surface on prompt submission.

Resolution: DuckChatInternal.resolvedTogglePosition() centralizes resolving user settings (including Last used) to a concrete side. Toggle position observers now expose StateFlow so resolution reads live repository values instead of stale cache. The omnibar widget uses the same resolver for its initial tab instead of duplicating flow logic.

Telemetry routing: Omnibar query pixels fire from the widget/view model path (removed from MetricsNativeInputEventListener.onSearchSubmitted).

Reviewed by Cursor Bugbot for commit 85ce321. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread PixelDefinitions/pixels/definitions/duck_chat.json5
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_default_mode_pixel_param branch from 3b0bb7a to 9990897 Compare August 12, 2026 06:27
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_default_mode_pixel_param branch from 9990897 to 4df9d5e Compare August 12, 2026 06:44
@github-actions

Copy link
Copy Markdown
Contributor

Privacy Review task: https://app.asana.com/0/69071770703008/1217412308253518

@malmstein malmstein left a comment

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.

Reviewed statically, stacked PR so no CI APK and the change is telemetry only.

Clean and well-tested. The Flow to StateFlow narrowing through the datastore and repository is the right enabler for a synchronous read, and resolvedTogglePosition() collapses the default plus last-used resolution that NativeInputModeWidget was duplicating inline. Verified the definitions line up: default_mode and toggle_visible on m_aichat_experimental_omnibar_query_submitted_count, default_mode on both unified input prompt pixels, nothing declared for the daily omnibar pixel which fires without params. Both params are bounded, no PII or high cardinality. Good call gating default_mode to the address bar surface, with a test and a comment saying why.

Two non-blocking things inline, the more interesting one being that toggle_visible is derived from a looser predicate than the toggle's own visibility rule.

Comment thread duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/RealDuckChat.kt Outdated
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_capability_state_pixel branch from 8d8b148 to 43e0447 Compare August 16, 2026 10:43
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_default_mode_pixel_param branch from 4df9d5e to c915451 Compare August 16, 2026 10:43
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_default_mode_pixel_param branch from 5a49c9e to c57bbe5 Compare August 17, 2026 19:00
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_capability_state_pixel branch from 43e0447 to b01daee Compare August 17, 2026 19:00
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_default_mode_pixel_param branch from c57bbe5 to fd1766d Compare August 18, 2026 20:02
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_capability_state_pixel branch from b01daee to 344781c Compare August 18, 2026 20:02
Base automatically changed from feature/youssef/duckai_capability_state_pixel to develop August 18, 2026 22:04
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_default_mode_pixel_param branch from fd1766d to ee8d10a Compare August 18, 2026 22:06

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ee8d10a. Configure here.

@YoussefKeyrouz
YoussefKeyrouz added this pull request to the merge queue Aug 18, 2026
Merged via the queue into develop with commit c5d7392 Aug 18, 2026
21 checks passed
@YoussefKeyrouz
YoussefKeyrouz deleted the feature/youssef/duckai_default_mode_pixel_param branch August 18, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants