Skip to content

Conversation

rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented Oct 14, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1211370814674973?focus=true
Tech Design URL: https://app.asana.com/1/137249556945/project/481882893211075/task/1211397300866537
CC: @diegoreymendez

Description

This is the final PR to add support for clearing chat history from the fire button or delete history dialog.

It adds the integration with the new C-S-S script, launching a headless web view and triggering the script to clear chat history from local storage and indexedDB. It also adds pixels for the feature.

⚠️ Relies on changes in #2201 ⚠️

Testing Steps

  1. Build the app and enable Debug > Feature Flag Overrides > Other > fireDialog.
  2. Visit Duck.ai (so it is set as used before) and ensure you have at least one chat in your chat history. You can create a chat with an image to set data in both local storage (chat) and indexedDB (chat images).
  3. Click the fire button and select “Everything.”
  4. Toggle “Duck.ai chats” on and click “Delete.”
  5. Visit Duck.ai and confirm your chat history is cleared. Then open the dev console, select the Storage tab, and confirm that Local Storage does not include a savedAIChats key and in Indexed Databases the savedAIChatData DB > chat-images store is empty.

Impact and Risks

Medium: Could disrupt specific features or user flows

What could go wrong?

  • Added timeout to user script so the browser doesn’t hang if the script does not respond with a success/failure message (e.g. if it fails to run).
  • Confirmed that web view is loaded with expected URL before the script is triggered, to ensure it’s ready to run.

Quality Considerations

  • New pixels need review

Notes to Reviewer


Internal references:

Definition of Done | Engineering Expectations | Tech Design Template


Note

Adds a headless C‑S‑S user script flow to clear Duck.ai chat history with async Fire integration, introduces duckAiDataClearing flag, and records new pixels for setting, request, success, and failure.

  • AI Chat data clearing (C‑S‑S integration):
    • New AIChatDataClearingUserScript subfeature and headless WKWebView flow in AIChatHistoryCleaner to clear Duck.ai data via ContentScopeUserScript (with timeout, teardown, and error pixeling).
    • AIChatHistoryCleaner.cleanAIChatHistory made async; shows option based on new flag and AI Chat usage; fires success/failure pixels.
  • Fire flow updates:
    • FireProtocol/Fire now await burnChatHistory; calls updated in Fire dialog/popover, main menu, and history delete paths; pixel fired when delete is requested.
  • Feature flags:
    • Replace clearAIChatHistory with duckAiDataClearing across app and privacy config; map to remote development; category updated.
  • Pixels:
    • Add AIChatPixel events: auto‑clear toggled, delete requested/successful/failed; fire from Data Clearing preferences and delete flows; pixel definitions updated.
  • Wiring & project:
    • Inject privacyConfig into AIChatHistoryCleaner; add new source files to Xcode project.
  • Tests:
    • Update unit tests/mocks to use duckAiDataClearing and new initializer; adjust integration mock signatures.

Written by Cursor Bugbot for commit cb05fde. This will update automatically on new commits. Configure here.

Copy link

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

@rachelmcr rachelmcr force-pushed the rachel/chat-history-burn-logic branch from c9a5040 to 9171209 Compare October 14, 2025 16:08
@rachelmcr rachelmcr force-pushed the rachel/chat-history-integrate-css branch from 8c0d513 to 379c319 Compare October 14, 2025 16:15
cursor[bot]

This comment was marked as outdated.

case openFireWindowByDefault
case behaviorMetrics
case dataImport
case duckAiDataClearing
Copy link
Contributor

Choose a reason for hiding this comment

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

The code uses "AI Chat" to refer to duck.ai, since duck.ai is the marketing name (and it did change in the past), it's better to keep using AI Chat to be consistent in the codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. duckAiDataClearing is the C-S-S feature name (already in C-S-S and privacy config). I updated the local feature flag to match it, but I could keep using AI Chat in the local feature flag and only use Duck.ai to refer to the flag already in the privacy config.


/// https://app.asana.com/1/137249556945/project/72649045549333/task/1211185922947392?focus=true
case clearAIChatHistory
case duckAiDataClearing
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as mentioned before. Duck.ai -> AI Chat

Copy link
Contributor

@Bunn Bunn left a comment

Choose a reason for hiding this comment

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

Works as described. Small nit related to a naming convention. Nice work!

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