Skip to content

SCA-4753: Measure offline sync backlog by build (Phase 0) - #26474

Merged
Git-on-my-level merged 5 commits into
mainfrom
agent/m1-studio-codex-sol/3d04ab915729
Nov 27, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
agent/m1-studio-codex-sol/3d04ab915729

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

Add an Offline sync backlog row to Omi Core Features. The failed upload, backend-sync revision-wide HTTP 503, and upload age panels use request or attempt counts. The v2 handler counts valid upload traces by platform, bounded release build, and whether the oldest recording was sealed more than six hours ago. Upload age buckets extend to seven days. Part of SCA-4753.

The merge with main preserves SCA-4464’s retirement of the poll-backoff experiment. It drops the settlement cohort panel and histogram expansion because the metric producer was removed. The refusal and upload-age queries are unchanged by the repair.

Product invariants affected

none

How it was verified

  • After resolving the merge, 92 tests passed across the sync trace, legacy poll, and dashboard contract suites. The resolution preserves the metrics registry from main and removes the dashboard query for the retired cohort series.
  • Six focused backend test files passed during implementation. After the settlement panel wording revision, 11 dashboard contract tests passed across the Cloud Monitoring query-shape, query-budget, and absence suites.
  • Before the conflict repair, Promtool evaluated the dashboard queries with synthetic counters, including mixed histogram layouts. A scrape check verified the 48-series ceiling per target and the new bucket bounds.
  • On the publication run, 43 local preflight checks and all 40 selected backend test files passed. The initial push timed out during OpenAPI verification. The retry reused the completed preflight and unit-test results, then passed the remaining hook checks, including OpenAPI compatibility. The shallow clone skipped the 90-day failure-class history check. Offline alert lint passed during implementation.
  • Production evidence follows release. Check the Grafana row, confirm the new counter for the current build within one hour of serving, and verify that the upload-age median fits in a finite bucket.

Tests

backend/tests/unit/test_sync_capture_end.py covers the exact six-hour boundary, bounded build/platform labels, and rejection of invalid traces.

UI evidence

UI-Evidence: none -- Internal Grafana dashboard, with production screenshot due in the serving readback.

Failure class (fixes)

Failure-Class: none

Line-Count-Exception: backend/routers/sync.py | 4399 -> 4406 | Pass the existing client headers to the upload trace observer at the pre-admission call site.

View guided diff Turn on auto-fix

@Git-on-my-level
Git-on-my-level merged commit d000e6c into main Nov 27, 2026
71 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/m1-studio-codex-sol/3d04ab915729 branch November 27, 2026 13:49
Git-on-my-level added a commit that referenced this pull request Nov 27, 2026
## What changed and why

Regenerated the GMP query migration inventory after #26474 added the Omi
Core Features upload panels. The stale generated file fails the Backend
Unit Tests on main and also blocks #26306. Tracked in SCA-4753.

## Product invariants affected

none

## How it was verified

- Ran `python3 backend/scripts/monitoring_gmp_shadow.py --inventory
--output backend/charts/monitoring/gmp-query-migration-inventory.json`.
Compared the generated entries with the dashboard at the #26474 merge.
Only the four query consumers for panels 101, 102, and 103 and the total
(326 to 330) changed.
- Ran the 35 tests in `backend/tests/unit/test_monitoring_gmp_shadow.py`
with the local test environment and with pytest on Python 3.11. Both
runs passed.
- Ran `make preflight` and validated the PR metadata. The shallow
checkout skips the history-dependent failure-class ratchet.

## Tests

The existing `test_committed_inventory_is_current` compares the
committed file with the generator output and covers this repair.

UI-Evidence: none -- generated inventory only

Failure-Class: none


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26517?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/26517?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26517&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 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. -->
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