Repository navigation
SCA-4753: Add the offline sync backlog fleet pilot - #26677
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1777cde0bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| static bool get cached => AnalyticsManager().isBooleanFeatureEnabledCached(enabledFlag); | ||
|
|
||
| static Future<bool> refresh() => AnalyticsManager().refreshBooleanFeatureFlag(enabledFlag); |
There was a problem hiding this comment.
Require a successful flag reload before admitting a snapshot
When the pilot flag was previously enabled but a subsequent flag fetch fails, this method still returns true: AnalyticsManager.refreshBooleanFeatureFlag() ignores the boolean returned by reloadFeatureFlags(), while PosthogAnalyticsAdapter._reloadOmiFlags() deliberately retains the previous cached answer on failure. Consequently, _tick() can transmit another snapshot without a fresh positive flag response, contrary to the pilot's fail-closed admission contract, including when a remote stop cannot be fetched. Require the reload itself to succeed before consulting the cached flag.
Useful? React with 👍 / 👎.
…26689) ## What changed and why SCA-4753 prerequisite for the fleet backlog pilot (#26677). Two backend-only changes. **1. Backend GMP sample cap 15,000 → 25,000** (`backend/deploy/cloud_run_gmp_sidecar.yaml`). Backend Cloud Run peaked at **14,397** post-relabel samples per instance on 2026-11-28 (ro-prod GMP, `max_over_time(scrape_samples_post_metric_relabeling{namespace="backend"}[1d])`). Over the limit GMP drops the instance's **whole** scrape, so every backend metric goes dark for that instance. #26677 raises the fleet exporter's worst case from 3,842 to 8,218 samples (+4,376), which would put a busy instance over 15,000. Ingestion is billed per sample emitted, not by this ceiling; the change only moves the drop point. The sync profile (`cloud_run_gmp_sync.yaml`, peak 5,346) stays at 15,000. **2. Phase 0 upload-trace build bands by floor** (`backend/utils/sync/capture_end.py`, `backend/utils/product_metrics.py`). The #26474 allowlist (1367, 1504, 1514, 1515, 1516, 1520) matched none of the builds phones sent on 2026-11-28 (ro-prod GMP `omi_listen_accepted_total` by `app_build`: iOS 1597–1650, Android 1500 and 1651), so the "Upload age over 6 h by build" panel shows only `older`. `release_build_band` keeps an exact build at or above a per-platform floor (iOS 1620, Android 1500) until a process has seen 8 exact builds, then `other`; below the floor `older`; otherwise `unknown`. A stale floor degrades to `other`, never to a list that matches nothing. Label set unchanged (`age`, `platform`, `build_band`); worst case 2 × 3 × 11 = 66 series per target. **Order:** this must be serving on backend before #26677's `sync-backlog-fleet-snapshot` flag is turned on. **Rollback:** revert this PR. Both changes are config/label-only; no data path, Firestore, or client change. ## Verification - m1 lane worktree via `omi-heavy`, `bash backend/test.sh` one process per file: `test_product_metrics.py` (new `test_release_build_band_floors_cap_and_unknowns`), `test_sync_capture_end.py`, `test_firestore_attribution_export.py` (cap pinned per profile), `test_desktop_message_quota_router.py`, `test_attach_cloud_run_gmp_sidecar.py`, `test_fleet_deployment.py`, `test_monitoring_telemetry_contract.py`, and the chat-router harness users: 15 files, all passed. - CI's changed-file selection is 2,246 files (`product_metrics` is widely imported); that full run is CI's. - Not yet measured: per-instance scrape size after the pilot flag; that is the SCA-4753 pilot readback. UI-Evidence: none -- backend config and metric labels only 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/26689?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26689?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26689&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Backend GMP sample cap 15,000 -> 25,000. Backend peaked at 14,397 post-relabel samples per instance on 2026-11-28, and the fleet pilot (BasedHardware#26677) adds up to 4,376 worst-case samples. Over the cap GMP drops the instance's whole scrape. Ingestion is billed per sample emitted. Phase 0 upload-trace build bands use per-platform floors and a per-process cap. The allowlist (1367-1520) matched none of the builds phones sent on 2026-11-28 (iOS 1597-1650, Android 1500/1651). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pilot behavior
POST /v1/telemetry/fleetfor one content-free snapshot per installation per UTC hour. A durable local reservation precedes the one-shot request. The existing analytics consent and a fresh positivesync-backlog-fleet-snapshotflag gate delivery.Release and validation
The initial exact pins cover observed iOS builds 1597 and 1650 and Android builds 1500 and 1651. Verify the exact beta and stable builds before admission and adjust the pins within the six-build budget as needed. Release owns the backend and dashboard serving receipts and the same-build mobile holdout. Use the deny cohort in the ring drain gate for the three-day comparison. Ring comparisons use passive INFO, so the two scheduler cohorts can yield different eligible counts. The dashboard remains observational during the seven-day baseline before thresholds, provisioning, and drift verification.
Product invariants affected
Failure-Class: none
UI-Evidence: none
Line-Count-Exception: app/lib/utils/analytics/analytics_manager.dart | 3168 -> 3170 | Add strict reload handling inside the existing identity and timeout fence for this pilot.
Line-Count-Exception: app/lib/services/devices/connectors/omi_connection.dart | 1622 -> 1632 | Capture fresh INFO and the known codec at the existing connection boundary. The observer implementation lives in a separate file.
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 3442 -> 3444 | Expose the existing initial inventory admission state so the reporter can distinguish an empty queue from an unloaded one.
Line-Count-Exception: app/lib/services/wals/ring_storage_sync.dart | 1731 -> 1745 | Tap existing pass and reader lifecycle events at their sources for both scheduler cohorts. Aggregation lives outside the custody implementation.