Skip to content

fix: enforce cloud analytics consent from TOS - #79

Merged
malhotra5 merged 5 commits into
mainfrom
port-tos-analytics-consent
Jul 27, 2026
Merged

malhotra5 merged 5 commits into
mainfrom
port-tos-analytics-consent

Conversation

@malhotra5

@malhotra5 malhotra5 commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

I've confirmed that rest apis to override the consent field are denied, users are auto consented in after tos page, and toggle for consent is disabled. Attached below is how the UI appears, where we have a transparent auto opt in policy but the user is unable to override the selection.

image
  • A human has tested these changes.

AGENT:


Why

In cloud mode, accepting the Terms of Service is the consent signal for analytics. The analytics setting should therefore appear enabled after the TOS page, and users should not be able to disable it through cloud UI or API paths.

This ports the changes from OpenHands/OpenHands#15376 to the OpenHands/enterprise repository.

Summary

  • Immediately set analytics consent when normal users accept TOS and when users are provisioned as already TOS-accepted.
  • Eventually normalize user.user_consents_to_analytics from accepted_tos at central SaaS user lookup and the user app settings store direct path, then use the flag for analytics contexts and events.
  • Prevent cloud settings APIs from persisting or accepting analytics consent overrides, while keeping OSS explicit consent behavior unchanged.
  • Render the cloud app-settings analytics switch as checked/disabled and skip legacy localStorage consent migration in SaaS.
  • Add backend and frontend coverage for TOS-derived consent and UI/API override prevention.

Issue Number

N/A

How to Test

  • poetry run pytest tests/unit/test_analytics_context.py tests/unit/app_server/test_settings_api.py
  • PYTHONPATH=enterprise poetry run --project=enterprise pytest --confcutdir=enterprise/tests/unit enterprise/tests/unit/test_saas_settings_store.py enterprise/tests/unit/server/routes/test_user_app_settings.py enterprise/tests/unit/server/services/test_user_app_settings_service.py enterprise/tests/unit/storage/test_user_app_settings_store.py enterprise/tests/unit/test_user_store.py::test_get_user_by_id_existing_user
  • cd frontend && npm run test -- __tests__/routes/app-settings.test.tsx
  • cd frontend && npm run lint:fix && npm run build
  • poetry run pre-commit run --config ./dev_config/python/.pre-commit-config.yaml
  • poetry run --project=enterprise pre-commit run --all-files --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml

Video/Screenshots

Not applicable; behavior is covered by automated UI tests for the disabled cloud analytics switch.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

This PR was created by an AI agent (OpenHands) on behalf of the user.

Cloud users retain analytics consent through TOS acceptance. OSS users still use the explicit analytics preference.


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-b0da8e9

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions github-actions Bot added the type: fix A bug fix label Jul 27, 2026
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

github-actions Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  enterprise/server/routes
  user_app_settings_models.py
  enterprise/storage
  saas_settings_store.py 412-425, 678-684
  user.py 68
  user_app_settings_store.py 29-35, 62-68
  user_store.py 742-745, 763-768, 789-793
  openhands/app_server/settings
  settings_router.py 71-84, 286-292
Project Total  

This report was generated by python-coverage-comment-action

@lilagrc
lilagrc requested review from a team and saurya and removed request for a team July 27, 2026 17:28
@linear

linear Bot commented Jul 27, 2026

Copy link
Copy Markdown
OSS-5714 Align Agent Canvas telemetry UI with Cloud-required and local opt-in policy

Problem

Canvas capture policy differs by deployment, but the settings UI can misrepresent it: Cloud telemetry is required while local/API-key deployments are explicit opt-in.

Acceptance criteria

  • Cloud shows a locked/accurate analytics state; local remains default-off explicit opt-in, including null or unresolved consent.
  • Tests and documentation cover unrelated settings saves, revocation, Do Not Track, and the pre-consent anonymous canvas_install event.

@malhotra5
malhotra5 requested review from a team and removed request for a team July 27, 2026 17:58
@malhotra5
malhotra5 marked this pull request as ready for review July 27, 2026 18:07
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for opening this PR!

Before review, please add a short note in the HUMAN: section at the top of the PR description telling maintainers, in your own words, what this PR does.

Please put that note between HUMAN: and the - [ ] A human has tested these changes. checkbox.

Co-authored-by: openhands <openhands@all-hands.dev>
@malhotra5
malhotra5 merged commit 9f43900 into main Jul 27, 2026
20 checks passed
@malhotra5
malhotra5 deleted the port-tos-analytics-consent branch July 27, 2026 21:44
@openhands-release-bot openhands-release-bot Bot added the released: 1.49.0 Shipped in 1.49.0 label Jul 30, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.49.0.

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

Labels

released: 1.49.0 Shipped in 1.49.0 type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants