Skip to content

Add FXIOS-15343 [AI Kill Switch] Add nimbus context value for disabling AI#32929

Open
Cramsden wants to merge 2 commits intomainfrom
cr/fxios-15343_add-nimbus-ping-for-ai-features
Open

Add FXIOS-15343 [AI Kill Switch] Add nimbus context value for disabling AI#32929
Cramsden wants to merge 2 commits intomainfrom
cr/fxios-15343_add-nimbus-ping-for-ai-features

Conversation

@Cramsden
Copy link
Copy Markdown
Contributor

@Cramsden Cramsden commented Apr 6, 2026

📜 Tickets

Jira ticket

💡 Description

Add userDisabledAI to RecordedNimbusContext. So that users are excluded from additional AI feature experiments. Similar android PR https://phabricator.services.mozilla.com/D291861

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

@Cramsden Cramsden requested a review from a team as a code owner April 6, 2026 19:22
@Cramsden Cramsden requested review from adudenamedruby, ih-codes and razvanlitianu and removed request for razvanlitianu April 6, 2026 19:22
- 'https://github.com/mozilla-mobile/firefox-ios/issues/23736'
- 'https://mozilla-hub.atlassian.net/browse/FXIOS-15343'
data_reviews:
- 'https://github.com/mozilla-mobile/firefox-ios/pull/23737#issuecomment-2541639916'
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.

Please add a data-review request to this ticket and flag a data steward c.f. https://wiki.mozilla.org/Data_Collection

Please add the completed data-review to the data_reviews section (following the format of the existing link, i.e., link to the comment where the data review is granted.)

@mobiletest-ci-bot
Copy link
Copy Markdown

mobiletest-ci-bot commented Apr 6, 2026

Warnings
⚠️ Detected telemetry changes in: firefox-ios/Client/Glean/probes/metrics.yaml (cc @ih-codes @adudenamedruby)
Messages
📖 Project coverage: 41.05%

💪 Quality guardian

1 tests files modified. You're a champion of test coverage! 🚀

🧹 Tidy commit

Just 5 file(s) touched. Thanks for keeping it clean and review-friendly!

📊 Telemetry changes detected

Changes with additions detected in Glean telemetry files:
firefox-ios/Client/Glean/probes/metrics.yaml

Any additions to telemetry will require a data review. Please fill out a data review form (found in the data review repo) as necessary, and tag @adudenamedruby for data review.

✅ New file code coverage

No new file detected so code coverage gate wasn't ran.

Client.app: Coverage: 39.39

File Coverage
Experiments.swift 79.34%
ProfilePrefsReader.swift 93.75%
RecordedNimbusContext.swift 94.96%

Generated by 🚫 Danger Swift against 426f94f

@Cramsden
Copy link
Copy Markdown
Contributor Author

Cramsden commented Apr 7, 2026

Request for data collection review form

All questions are mandatory. You must receive review from a data steward peer on your responses to these questions before shipping new data collection.

  1. What questions will you answer with this data?
    We want to be able to track if a user has opted out of AI features so that they are not enrolled in any new AI Feature experiments.

  2. Why does Mozilla need to answer these questions? Are there benefits for users? Do we need this information to address product or business requirements? Some example responses:

  • Provides information essential for making sure our users have the Firefox iOS experience they configured, even without an fxa account and as new features roll out.
  1. What alternative methods did you consider to answer these questions? Why were they not sufficient?
    You could tie this information to an fxa account but that requires login which would greatly decrease the experience for folks who don't have an fxa account.

  2. Can current instrumentation answer these questions?
    yes

  3. List all proposed measurements and indicate the category of data collection for each measurement, using the Firefox data collection categories found on the Mozilla wiki.

Note that the data steward reviewing your request will characterize your data collection based on the highest (and most sensitive) category.

Measurement Description Data Collection Category Tracking Bug #
recorded_nimbus_context.user_disabled_ai 2 https://mozilla-hub.atlassian.net/browse/FXIOS-15343
  1. Please provide a link to the documentation for this data collection which describes the ultimate data set in a public, complete, and accurate way.
    This collection is documented in the Glean Dictionary at https://dictionary.telemetry.mozilla.org/

  2. How long will this data be collected? Choose one of the following:

  • for the life of the AI Kill Switch Feature, probably permanently
  1. What populations will you measure?
  • New users and existing users
  1. If this data collection is default on, what is the opt-out mechanism for users?
    User has the general option of disable telemetry or/and studies. They could also turn the AI Kill Switch feature off.

  2. Please provide a general description of how you will analyze this data.

  3. Where do you intend to share the results of your analysis?
    This is more of a configuration to make sure that the user choice is persisted for new features. There isn't anything to analyze.

  4. Is there a third-party tool (i.e. not Glean or Telemetry) that you are proposing to use for this data collection? If so:

No

@Cramsden
Copy link
Copy Markdown
Contributor Author

Cramsden commented Apr 7, 2026

@freshstrangemusic data review added

- 'https://mozilla-hub.atlassian.net/browse/FXIOS-15343'
data_reviews:
- 'https://github.com/mozilla-mobile/firefox-ios/pull/23737#issuecomment-2541639916'
- 'https://github.com/mozilla-mobile/firefox-ios/pull/32929'
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.

We still need the actual data review to be granted. This is just the request

When a data steward signs off on this, please update the URL here to point to the comment they leave.

github-merge-queue bot pushed a commit to mozilla/experimenter that referenced this pull request Apr 7, 2026
Because

* The risk_ai flag on experiments currently only generates targeting
  for Desktop using the `browser.ai.control.default` preference
* Fenix ([Bug
2028993](https://bugzilla.mozilla.org/show_bug.cgi?id=2028993) /
[D291861](https://phabricator.services.mozilla.com/D291861)) and iOS
(mozilla-mobile/firefox-ios#32929) have added
  `user_disabled_ai` to their RecordedNimbusContext, shipping in v151
* Experiments using AI features need to exclude mobile users who have
  opted out of AI functionality

This commit

* Adds `user_disabled_ai == false` targeting expression when `risk_ai`
is
  true and the application is Fenix or iOS
* Adds version validation requiring >= v151 for mobile apps with
  `risk_ai` enabled
* Adds model and serializer tests for both Fenix and iOS

Fixes #15160
@adudenamedruby
Copy link
Copy Markdown
Contributor

adudenamedruby commented Apr 8, 2026

r+

Data Review Form

1) Is there or will there be documentation that describes the schema for the ultimate data set in a public, complete, and accurate way?

Yes, telemetry is documented at https://dictionary.telemetry.mozilla.org/apps/firefox_ios

2) Is there a control mechanism that allows the user to turn the data collection on and off?

Yes, Firefox iOS provides data controls in the app settings

3) If the request is for permanent data collection, is there someone who will monitor the data over time?

This will be reviewed by a data-steward on the Firefox iOS team (@adudenamedruby) yearly.

4) Using the category system of data types on the Mozilla wiki, what collection type of data do the requested measurements fall under?

Type 2

5) Is the data collection request for default-on or default-off?

Default on

6) Does the instrumentation include the addition of any new identifiers (whether anonymous or otherwise; e.g., username, random IDs, etc. See the appendix for more details)?

No

7) Is the data collection covered by the existing Firefox privacy notice?

Yes

8) Does the data collection use a third-party collection tool?

No

Copy link
Copy Markdown
Collaborator

@ih-codes ih-codes left a comment

Choose a reason for hiding this comment

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

Might also be useful to add a unit test for the false case if you think it makes sense!

I'll approve from a telemetry naming perspective.

type: boolean
has_accepted_terms_of_use:
type: boolean
user_disabled_ai:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe we should continue with the has/is boolean naming pattern? 🤔 has_user_disabled_ai ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I went back and forth on this one... I wasn't sure if it mattered at all if our naming patterns were consistent with Android's implementation https://phabricator.services.mozilla.com/D291861

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ahh... well, the probe wasn't named by us anyway, so even though we prefer iOS naming consistency, I don't feel strongly on this. If every single other field here already matches between iOS and Android let's keep with that.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 9, 2026

This pull request has conflicts when rebasing. Could you fix it @Cramsden? 🙏

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants