Skip to content

SCA-1994: move flaky backend timing files to the main-only slow lane - #25221

Merged
Git-on-my-level merged 4 commits into
mainfrom
agent/m1-studio-codex-sol/39fe4041162f
Nov 14, 2026
Merged

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

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

SCA-1994: use the existing slow pytest marker for the two flaky timing files, keeping their coverage in an independent Backend slow timing tests workflow on every main push. The normal PR shards exclude them; the blocking slow-guardrail manifest remains unchanged. Each file runs in its own job, failures remain red, and JUnit results are retained. No path filter or concurrency coalescing can skip an intermediate main commit.

The file-level boundary keeps first-call CPU initialization from simply shifting to the next Soniox case and preserves isolated provider-pair coverage. Deterministic rewrites and PR-lane restoration are tracked separately in SCA-1998 and SCA-1999. No product code, other tests' lane, or real-clock budget thresholds change.

Product invariants affected

none

How it was verified

  • Normal backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST limited to the two files: success; 35 Soniox and 31 replay tests deselected.
  • Per-file .venv/bin/python -m pytest -q -p no:cacheprovider -m 'slow and not integration': 35 and 31 passed, respectively.
  • actionlint .github/workflows/backend-slow-timing-tests.yml: passed.
  • git diff --check: passed.
  • OMI_PR_BODY_FILE=../pr-body.md make preflight: all 46 checks passed.
  • scripts/pr-preflight --metadata-only --pr-body-file ../pr-body.md: all 4 metadata checks passed.
  • Workflow package-network guard: all 18 tests passed.

Tests

The actual runner verifies exclusion and the workflow's exact pytest commands verify execution. Existing assertions remain unchanged. Main-push execution and the next 20 PR runs require post-merge observation; this PR does not claim that acceptance yet.

UI evidence

UI-Evidence: none -- CI-only change.

Failure class (fixes)

Failure-Class: none

This change isolates known flaky coverage using the existing slow-test category; it does not repair the underlying provider behavior. Soniox's logged failure is the first-call CPU gate despite its existing clock injection; replay's logged failure is TimeoutError despite its virtual clock. The rewrite issues preserve that distinction.

Historical baseline

Read logs for all 99 failed PR runs among 334 in 2026-11-10 17:00Z through 2026-11-13 17:00Z. Nine runs reported one of these files failing: three Soniox CPU-budget failures and six replay timeouts (9.1% of red runs). Only three of those runs reported no other failed test file, so this does not claim nine runs would become green. Runner failure verdicts were used instead of interleaved pytest progress lines.

Release boundary

Review only: do not add to the release queue while SCA-1894 remains open. No deployment or production writes are part of this change.

View guided diff Turn on auto-fix

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 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-13T17:20:04.442600Z b852dfd PR opened
ℹ️ 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.

Git-on-my-level added a commit that referenced this pull request Nov 14, 2026
…sync scrape (SCA-2067) (#25240)

## What changed and why

Retain the enrichment LLM cost/usage families on the
`backend-integration` GMP scrape (SCA-2067).

`backend-integration` runs the enrichment consumer, but the sync
collector's `__name__` keep rule in
`backend/deploy/cloud_run_gmp_sync.yaml` dropped the in-process families
a release owner needs to measure the SCA-1960 guardrail regression.
SCA-2057 verified the blind spot at 20:56Z 2026-11-13:
`omi_conversation_llm_calls_total`,
`omi_shaped_agent_input_tokens_total`, `omi_notes_agent_*` and
`omi_episode_moment_cost_usd_total` were all absent from the integration
scrape while `enrichment_early_abort_total` and
`enrichment_supersede_streak.*` survived.

The keep rule now names, explicitly:

- `omi_conversation_llm_calls_total` — attributable calls by bounded
`feature`/`outcome`
- `omi_shaped_agent_input_tokens_total` — shaped input tokens by
`feature`/`kind`
- `omi_notes_agent_*` — runs, forced runs, decisions, tool use,
refused/duplicate lookups, repairs, tokens, transport skips, and the
tool-calls/turns/estimated-cost/cache-ratio/latency histograms
- `omi_episode_moment_{cost_usd_total,tokens_total,updates_total}` —
per-moment cost and its attribution denominators

Explicit names, not a `notes_agent_.*` catch-all, so a new family still
needs its own consumer before it is scraped. Episode-moment latency and
the skipped-no-client counter stay out: they are not part of the cost
readout.

The cost families remain **estimates** — the gateway ledger is
authoritative — and an empty vector means "not scraped", never "zero
spend".

## Product invariants affected

none

## CI repair (bookkeeping only, separate commit)

`Backend Unit Tests` is red on `main` itself, so this PR inherited three
stale bookkeeping values. They are repaired in one droppable commit
(`chore(ci): refresh stale flag-budget count and usage-month
bookkeeping`); no flag, budget allowance, runtime lever or product
default changes.

| File | Repair | Why it drifted |
| --- | --- | --- |
| `backend/config/flag_budget.json` | `count` 277 → 278 to match the
existing `names` list. `budget` stays 161. | The merge in `6262a2b82e`
(SCA-2012) added names without bumping the count. |
| `backend/tests/unit/fixtures/usage_month_served_defaults.json` |
Refresh the eight stale `all_levers_sha256` values to the current
`FIRESTORE_READ_LEVERS` maps. | `9daefbfefd` (SCA-1993) moved
`bpp_decision_cache` 0 → 100. `usage_month_cache`/`usage_month_total`
stay 0/0 (100/100 on backend-sync). |
| `backend/deploy/runtime_env/pending/usage-month-enable-5.patch` |
Refresh the patch context to the current `prod.overlay.yaml`. | Same
SCA-1993 lever change moved the hunk context. |

The pending patch's proposal is unchanged and verified mechanically: its
`-`/`+` pairs differ only in `usage_month_cache`/`usage_month_total` 0 →
5 for `backend`, `backend-integration` and `backend-sync-backfill`.
`test_qualify_usage_month.py` asserts exactly that, plus that composing
the patched tree changes nothing else.

The unrelated wall-clock flake in `test_live_replay_provider_pairs.py`
is owned by SCA-1994 / PR #25221; no threshold or workflow change here.

## How it was verified

- `backend/.venv/bin/python -m pytest tests/unit/test_flag_budget.py
tests/unit/test_qualify_usage_month.py
tests/unit/test_enrichment_llm_cost_metrics_are_scraped.py
tests/unit/test_attach_cloud_run_gmp_sidecar.py
tests/unit/test_monitoring_telemetry_contract.py
tests/unit/test_timeliness_metrics_are_scraped.py
tests/unit/test_enrichment_route.py
tests/unit/test_backend_unit_selector_output.py` — 486 passed, 1
skipped.
- `backend/.venv/bin/python -m pytest
tests/unit/test_render_backend_runtime_env.py
tests/unit/test_backend_runtime_env_validator.py
tests/unit/test_rendered_deployment_contract.py
tests/unit/test_cross_service_deploy_contract.py` — 409 passed, 3
skipped.
- The new guard derives every sample name from the producer
registrations (`utils.sync.repeat_work_metrics`,
`utils.llm.shaped_agent`, `utils.llm.notes_agent`,
`utils.llm.notes_agent_serving`, `utils.episodes.metrics`), expands
Counter/Histogram suffixes, and asserts each name matches the sync keep
rule. It also pins that existing retained families still match, that
near-miss and unrelated names stay dropped, that `targetLabels.metadata:
[service]` and the 15000-sample ceiling are unchanged, and that the
added families' worst-case series bound stays under 500.
- `python scripts/failure-class validate --pr-body-file <body>` passes.

Not verified here: no production read, deploy or scrape. Merged is not
live completion — SCA-2026 must include this config in the next real
backend-integration release and read nonempty service-attributed vectors
for the retained names.

## Tests

`backend/tests/unit/test_enrichment_llm_cost_metrics_are_scraped.py` is
the regression test: it fails if any required family is renamed in the
emitter or dropped by the keep rule.
`test_attach_cloud_run_gmp_sidecar.py` coverage and
`scripts/select_backend_unit_tests.py` selection are updated so a future
config-only edit re-runs the guard.

## UI evidence

UI-Evidence: none -- monitoring config only.

## Cardinality estimate and assumptions

Worst-case bound for the added families, from the emitters' closed
enums:

| Family | Bound | Assumption |
| --- | --- | --- |
| `omi_conversation_llm_calls_total` | 120 | `LLM_FEATURES` (40) x
{completed, failed, other} |
| `omi_shaped_agent_input_tokens_total` | 40 | low-cardinality
`Mount.feature` literals (measured ~10, capped at 20) x {cached,
uncached} |
| `omi_notes_agent_*` counters | 108 | 9 counters x closed label enum
capped at 12 |
| `omi_notes_agent_*` histograms | 70 | bucket count + 2 per histogram |
| `omi_episode_moment_*` | 63 | `MOMENT_TRIGGERS` (6) x
`MOMENT_OUTCOMES` (10) + tokens (2) + cost (1) |
| **Total** | **~400** | realistic ~250 series per instance |

Against the existing 15000-sample ceiling this is ~2.7% worst case, so
no ceiling change is needed. No per-user, task or content labels are
added; every label is a closed enum already emitted in-process.

## Rollback

Revert this PR. Allowlist-only change; no runtime behavior, no product
state, no flag.

Failure-Class: FC-metric-dropped-by-scrape-allowlist

Closes SCA-2067
@Git-on-my-level
Git-on-my-level merged commit 5c0bd5a into main Nov 14, 2026
67 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/m1-studio-codex-sol/39fe4041162f branch November 14, 2026 07:37
Git-on-my-level added a commit that referenced this pull request Nov 14, 2026
)

## What changed and why

SCA-1994: the six served-provider age-boundary cases each parsed the
entire deployment YAML during their measured call. Run 43481408115
attempt 2 crossed the 1.00 s CPU cap on a slow runner even though all
assertions passed. Read that immutable config once in a module-scoped
fixture, then run the existing boundary assertions against its actual
value. This removes five redundant parses and keeps fixture preparation
outside the policy calls being measured.

This is a separate, one-file test correction from quarantine PR #25221.
All sweep-age tests stay in the fast lane. Product code, assertions, CPU
thresholds, allowlists, and deployed settings are unchanged. The
explicit `now` remains deterministic; a fake clock would not remove YAML
parsing cost.

## Product invariants affected

none

## How it was verified

- Before: all 56 tests passed locally in 2.01 s, with the six affected
call phases taking 0.24–0.28 s and exceeding the 0.10 s advisory target.
- After: all 56 tests passed locally in 0.68 s with the existing 0.10 s
advisory / 1.00 s hard CPU thresholds. One config fixture setup took
0.26 s; affected call phases were below 0.005 s.
- All six affected cases also passed with a temporary stricter
`BACKEND_FAST_UNIT_FAIL_SECONDS=0.1` and
`BACKEND_FAST_UNIT_WARN_SECONDS=0.05`. No threshold configuration is
changed by this PR.
- `OMI_PR_BODY_FILE=../sweep-age-pr-body.md make preflight`: all 36
checks passed.
- `scripts/pr-preflight --metadata-only --pr-body-file
../sweep-age-pr-body.md`: all four checks passed.

## Tests

The existing six age-boundary cases and full 56-test file exercise the
change. The fixture still reads the checked-in deployment manifest and
enforces the unique-setting assertion; policy boundary assertions are
unchanged.

## UI evidence

UI-Evidence: none -- test-only correction.

## Failure class (fixes)

Failure-Class: none

This corrects redundant test preparation rather than production timing
or policy behavior.

## Release boundary

Review-ready test correction only. No production writes, deployment, or
release-queue entry while SCA-1894 remains open. This PR does not grant
a waiver for #25226.


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