Skip to content

SCA-4753: Add the offline sync backlog fleet pilot - #26677

Merged
Git-on-my-level merged 4 commits into
mainfrom
agent/m1-studio-codex-sol/313d6f4ce20a
Nov 29, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
agent/m1-studio-codex-sol/313d6f4ce20a

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Pilot behavior

  • Reuse POST /v1/telemetry/fleet for 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 positive sync-backlog-fleet-snapshot flag gate delivery.
  • Report amount waiting at the pendant, phone, and settlement stages. Phone seal and upload clocks define the age measurements. Known empty queues contribute zero and unavailable observations are omitted. Fresh INFO supplies pendant counts and packet size. The oldest pendant age is unavailable from INFO.
  • Show accepted installation-hours by build and the eligible counts behind the Omi Core Features distributions, age shares, and pendant holdout comparisons. Accepted installation-hours use a dedicated counter, including snapshots with unavailable audio durations. The four checked-in build numbers have a 7,658-sample maximum including 3,842 legacy samples. Keeping up to six exact builds bounds the total at 8,282. Backend peaked at 14,397 post-relabel samples per instance against the existing 15,000 cap. Release must verify prerequisite #26689 is serving the 25,000-sample profile on Backend before enabling the pilot flag. Record total scrape size and headroom during the pilot.

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.

  • 84 focused backend tests and 54 focused Flutter tests passed.
  • Focused Dart analysis and generated fleet schema, monitoring inventory, and flag registry checks passed. The fail-closed follow-up passed 15 focused Flutter tests, including enabled cache with a failed reload, and focused Dart analysis.
  • Review follow-up: 87 focused backend tests, 16 Flutter tests, and focused Dart analysis passed. The fleet schema and dashboard query inventory were regenerated.
  • The production dashboard and the remote stop still require readback on the pilot.

Product invariants affected

  • INV-CAP-1 — the beacon observes inventory and existing BLE signals. It has no authority to start a read, advance the ring, settle a recording, or change custody.

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.

View guided diff Turn on auto-fix

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T05:14:12.872264Z d3da0ce New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Git-on-my-level added a commit that referenced this pull request Nov 29, 2026
…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. -->
@Git-on-my-level
Git-on-my-level merged commit 4cd0b65 into main Nov 29, 2026
75 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/m1-studio-codex-sol/313d6f4ce20a branch November 29, 2026 07:12
naufalfx805-source pushed a commit to naufalfx805-source/omi that referenced this pull request Nov 29, 2026
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]>
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.

1 participant