Skip to content

NTP: keep the Duck.ai model pick per tab - #3253

Open
jaceklyp wants to merge 8 commits into
mainfrom
jacek/ntp-omnibar-default-model-refresh
Open

jaceklyp wants to merge 8 commits into
mainfrom
jacek/ntp-omnibar-default-model-refresh

Conversation

@jaceklyp

@jaceklyp jaceklyp commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Asana Task/Github Issue: https://app.asana.com/0/0/1220714550200174/f
CC: @aataraxiaa

Description

Keeps the NTP omnibar's Duck.ai model and reasoning-effort pick per tab, like the mode. Native opts in with a new config capability, so older native builds keep the shared pick.

  • OmnibarConfig.enablePerTabModelPick: when true, selectedModelId / selectedReasoningEffort are the new-chat default. A tab without a pick shows them and follows default changes. The page never writes picks through omnibar_setConfig.
  • New notifications omnibar_selectModel (modelId, previousModelId) and omnibar_selectReasoningEffort (reasoningEffort) report picks so native can count them and settle usage-limits messages without keeping them.
  • New subscription omnibar_onUserDefaultModelChange (no params): native sends it when the user changes their default model in Duck.ai settings, and every tab drops its pick.
  • A tab keeps its pick until it leaves the New Tab Page, e.g. after sending a prompt; the existing per-tab store drops it then. A usage-limits model switch applies to the current tab.
  • Create Image (updated flow): while on, a tab whose model can't create images uses OmnibarConfig.imageGenerationModelId. omnibar_setImageGenerationActive now carries modelId (the tab's model) so native can build the notice.

Testing Steps

  • npm run test-unit and npx playwright test omnibar-model-pick.spec.js --project=integration in special-pages.

Checklist

  • I have tested this change locally
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config

🤖 Generated with Claude Code

https://claude.ai/code/session_01JfpYVVoQJdeXThNQa1JWGP

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions github-actions Bot added the semver-minor New feature — triggers minor version bump label Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Build Branch

Branch pr-releases/jacek/ntp-omnibar-default-model-refresh
Commit e08835c0bd
Updated November 30, 2026 at 11:41:34 AM UTC

Static preview entry points

QR codes (mobile preview)
Entry point QR code
Docs QR for docs preview
Static pages QR for static pages preview
Integration pages QR for integration pages preview

Integration commands

npm (Android / Extension):

npm i github:duckduckgo/content-scope-scripts#pr-releases/jacek/ntp-omnibar-default-model-refresh

Swift Package Manager (Apple):

.package(url: "https://github.com/duckduckgo/content-scope-scripts.git", branch: "pr-releases/jacek/ntp-omnibar-default-model-refresh")

git submodule (Windows):

git -C submodules/content-scope-scripts fetch origin pr-releases/jacek/ntp-omnibar-default-model-refresh
git -C submodules/content-scope-scripts checkout origin/pr-releases/jacek/ntp-omnibar-default-model-refresh
Pin to exact commit

npm (Android / Extension):

npm i github:duckduckgo/content-scope-scripts#e08835c0bdca6835d882565078eabff55c1661f6

Swift Package Manager (Apple):

.package(url: "https://github.com/duckduckgo/content-scope-scripts.git", revision: "e08835c0bdca6835d882565078eabff55c1661f6")

git submodule (Windows):

git -C submodules/content-scope-scripts fetch origin pr-releases/jacek/ntp-omnibar-default-model-refresh
git -C submodules/content-scope-scripts checkout e08835c0bdca6835d882565078eabff55c1661f6

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

[Beta] Generated file diff

Time updated: Mon, 30 Nov 2026 11:42:02 GMT

Apple
    - apple/pages/new-tab/dist/index.js

File has changed

Chrome-mv3
    - chrome-mv3/pages/new-tab/dist/index.js

File has changed

Integration
    - integration/pages/new-tab/dist/index.js

File has changed

Windows
    - windows/pages/new-tab/dist/index.js

File has changed

@jaceklyp
jaceklyp requested a review from moon0326 November 26, 2026 14:29
@jaceklyp

Copy link
Copy Markdown
Contributor Author

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Findings marked 🟡 are optional suggestions and need no follow-up push.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🔴 special-pages/pages/new-tab/app/omnibar/components/suggested-prompts/SuggestedPrompts.js — With per-tab picks, a tab that turns on Create Image from the image-edit chip gets a notice based on the default model, not its own. enableImageGeneration still calls setImageGenerationActive(true) without the tab's model, and only Omnibar.js:413 was updated. Fix: pass selectedModel?.id here when keptPerTab is true, exactly as Omnibar.js does. Better still, move that argument into one shared helper so every activation path sends the tab's model. Without modelId, native can only fall back to the shared selectedModelId.

    Why this was flagged

    Trigger: enablePerTabModelPick and enableUpdatedCreateImage are both on, and the tab has a pick that differs from the default. The user takes the image chip's file-picker path (SuggestedPrompts.js:155), which calls enableImageGeneration(). That sends omnibar_setImageGenerationActive as { active: true } with no modelId. The new contract (omnibar.md and setImageGenerationActive.notify.json) says native builds the model-switch notice from modelId when the page keeps the pick. Native therefore builds the notice from the default selectedModelId; the mock does the same with msg.params.modelId ?? config.selectedModelId. Example: the tab is on gpt-5-mini, which can create images, and the default is Haiku. The page does not switch models, yet native shows a spurious "Now using ..." notice. Or the notice names the wrong previous model. The Omnibar.js toggle path was updated but this sibling call site was not.

    Verification: The mechanism is in SuggestedPrompts.js. Line 155 (handleFileChange) calls enableImageGeneration(), and line 98 does if (updatedCreateImageEnabled) setImageGenerationActive(true); with no modelId. This PR updated only the tools-menu path, Omnibar.js:413. Without modelId, native can only fall back to its stored default.

@moon0326 moon0326 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.

Great work! Claude found a few issues that should be addressed, but most of the changes work as expected. It would have been helpful to include a link to the native PR and instructions on how to test it in the Testing Steps, since this branch requires native changes to be fully tested.

In addition to the issues Claude found, I think the following is worth looking into:

https://github.com/duckduckgo/content-scope-scripts/blob/main/special-pages/pages/new-tab/app/omnibar/components/suggested-prompts/SuggestedPrompts.js#L98

Suggestion: We should also send the current tab's model ID.

@jaceklyp

Copy link
Copy Markdown
Contributor Author

@moon0326 thanks for the review! Addressed everything in 81c543d..70cc9d8:

  • Edit Photo and every other Create Image path now send the tab's model through one shared helper, and native hears it again when the shown tab's model changes while Create Image stays on.
  • Create Image falls back to the first available image model when the preferred one isn't usable.
  • "Default changed" now clears picks even while the omnibar is hidden.
  • Ask Duck.ai from search carries the tab's own pick (only when the tab has one).
  • Picking the model/effort already shown no longer sends duplicate events.

Native PR: duckduckgo/apple-browsers#8583. Could you take another look?

@moon0326
moon0326 self-requested a review November 30, 2026 16:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minor New feature — triggers minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants