Skip to content

Add pixel for max tab reuse distance - #9755

Merged
catalinradoiu merged 3 commits into
developfrom
feature/cradoiu/add-pixel-for-tabs-scroll
Sep 11, 2026
Merged

catalinradoiu merged 3 commits into
developfrom
feature/cradoiu/add-pixel-for-tabs-scroll

Conversation

@catalinradoiu

@catalinradoiu catalinradoiu commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1211724162604201/task/1214069186174646
Tech Design URL (if applicable):
API Proposals URL(s) (if applicable): None

Description

Adds a pixel that reports, once per foreground session, the furthest a user went back in the tab activation order (the tab reuse distance), bucketed, alongside a bucketed count of currently open tabs. This distance is the condition that decides whether a given tab would still be retained if the fragment retention limit (MAX_ACTIVE_TABS) were lowered, so the pixel sizes the UX cost of doing that before the limit is actually changed.

The pixel is gated behind the tabManager.tabMaxReuseDistancePixel sub-feature, off by default, with the parent tabManager toggle checked explicitly at the call site.

Steps to test this PR

Feature 1: Tab reuse distance pixel fires once per foreground session

  • Enable the tabManager.tabMaxReuseDistancePixel sub-feature (and ensure the parent tabManager feature is enabled)
  • Open several tabs and switch between them so some tabs are reused further back in the activation order
  • Background and foreground the app
  • Confirm the pixel fires with bucketed reuse-distance and open-tab-count values, and only once per foreground session

Feature 2: Pixel stays off when the sub-feature is disabled

  • Leave tabManager.tabMaxReuseDistancePixel disabled (default)
  • Repeat the tab-switching steps above
  • Confirm no pixel fires

UI changes

Before After
No UI changes No UI changes

Note

Low Risk
Analytics-only path behind feature flags; tab pager wiring adds hooks on activation/pause with no user-facing behavior changes.

Overview
Adds tab_max_reuse_distance telemetry to measure how far users jump back in tab activation order before revisiting a tab—aligned with the same “distinct other tabs since last active” notion used for fragment retention under MAX_ACTIVE_TABS.

A new activity-scoped TabReuseDistanceReporter tracks activations (via onItemPlaced on the tab pager adapter), tab closes, and open-tab count; on BrowserActivity.onPause it fires one bucketed pixel per foreground stretch (distance_bucket, tab_count_bucket) when the user actually returned to an earlier tab. Reporting is gated by tabManager and the new tabMaxReuseDistancePixel sub-toggle (default off). Pixel schema, AppPixelName, and unit tests cover bucketing, session reset on pause, removals, and toggle behavior.

Reviewed by Cursor Bugbot for commit 6763e10. Bugbot is set up for automated code reviews on this repo. Configure here.

Reports, once per foreground session, the furthest a user went back in the
tab activation order, bucketed, alongside a bucketed open tab count. That
distance is the condition that decides whether a tab would still be retained
at a given fragment limit, so it sizes the UX cost of lowering
MAX_ACTIVE_TABS before the limit is changed.

Gated behind the tabManager.tabMaxReuseDistancePixel sub-feature, off by
default, with the parent toggle checked explicitly.

https://app.asana.com/1/137249556945/project/1211724162604201/task/1214069186174646

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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

@0nko 0nko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Things worked as expected when testing, but I did notice that opening any activity constitutes an "end of session" and the pixel is sent. There's an implication to this because the max distance counter is reset to 0, so if you keep moving between screens like the settings or the tab switcher, you're technically in the same "session" but the reported data is artificially lower.

However, I guess it really comes down to what a "session" means and if we accept this behavior then I guess it's fine, so I'll approve. Maybe we should update the pixel definition description to capture that, though.

@catalinradoiu
catalinradoiu added this pull request to the merge queue Sep 11, 2026
Merged via the queue into develop with commit 09b081c Sep 11, 2026
20 of 21 checks passed
@catalinradoiu
catalinradoiu deleted the feature/cradoiu/add-pixel-for-tabs-scroll branch September 11, 2026 12:08
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