feat: duck.ai native storage bridge and debugging tools#8222
Merged
feat: duck.ai native storage bridge and debugging tools#8222
Conversation
275c12e to
e13a162
Compare
e13a162 to
ebde480
Compare
karlenDimla
reviewed
Apr 10, 2026
karlenDimla
reviewed
Apr 10, 2026
karlenDimla
reviewed
Apr 10, 2026
ebde480 to
896f368
Compare
karlenDimla
reviewed
Apr 10, 2026
896f368 to
96810c2
Compare
karlenDimla
approved these changes
Apr 10, 2026
…e is separate from migration
87e0d09 to
eb823a7
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
There are 7 total unresolved issues (including 5 from previous reviews).
❌ 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 19cf900. Configure here.
19cf900 to
8bd82b6
Compare
karlenDimla
approved these changes
Apr 13, 2026
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/1213883846466540
Description
Duck.ai currently stores all its data — chat history, settings, and uploaded images — in the browser's WebView storage (localStorage and IndexedDB). This means the fire button can't clear duck.ai data, and there's no way to inspect or manage it from the native side.
This PR introduces a native Android storage bridge that duck.ai can use instead of WebView storage:
doUpdateVisitedHistoryDuck.ai is a single-page app. When the user navigates within it (e.g. opening a chat, switching models), the URL changes via
history.pushStateorhistory.replaceState— not a full page load. Previously, these navigations were invisible to the browser's URL bar.This PR overrides
doUpdateVisitedHistoryin the WebView client to detect these SPA-style navigations and update the omnibar URL accordingly, so the address bar always reflects where the user actually is.eTLD+1 normalization for fire button domain protection
The fire button has an allowlist of DuckDuckGo domains that are preserved when the user clears browsing data. Previously this used exact hostname matching, which missed subdomains.
The allowlist now normalizes every hostname to its eTLD+1 (public suffix + one label) at runtime before matching. This means any subdomain of a protected domain is correctly recognized, regardless of how the hostname was stored.
Steps to test this PR
Test Migration
NativeStorage...overflow menu -> duck.aichats.generateChats({ count: 50, imagesPerChat: 1, imageSize: '1mb', target: 'indexeddb' })Test Autocomplete -- after migration is complete
Test fire button -- after migration is complete
Test clear chat -- after migration is complete
...in one of the chats and then "clear"Note
Medium Risk
Introduces a new native storage layer (Room DB + on-disk files) and switches deletion/suggestions to route through a new delegation layer behind feature flags, which can affect chat history integrity and data clearing behavior. Also adds a local debug HTTP server in internal builds and new WebView history URL handling, both of which need careful verification for correctness and unintended exposure.
Overview
Adds a new
duckchat-storemodule implementing a native Duck.ai storage bridge (Room tables for settings/chats + on-disk file storage with metadata) and aduckAiNativeStorageJS message handler to let Duck.ai read/write/migrate data outside WebView storage.Updates Duck.ai chat suggestions and deletion to delegate between WebView-backed and native-backed implementations based on migration state and a new
useNativeStorageChatDatatoggle, and adds new pixels for reader/deletion path selection plus migration completion.Introduces internal-only Duck.ai developer tooling, including a new internal-feature entry and a local NanoHTTPD debug server to inspect/edit/reset native settings/chats/files and migration flags; removes the old Duck.ai URL override from the general Dev Settings screen.
Improves Duck.ai SPA navigation handling by wiring
WebViewClient.doUpdateVisitedHistoryinto the tab/omnibar state viaonHistoryUrlChanged, and hardens fire-button domain protection by normalizing preserved domains to eTLD+1 before matching.Reviewed by Cursor Bugbot for commit 8bd82b6. Bugbot is set up for automated code reviews on this repo. Configure here.