Skip to content

SCA-1619: preserve held Android hides and page on missing token - #25131

Merged
Git-on-my-level merged 31 commits into
mainfrom
lane/sca-1619-app-review-followups
Nov 15, 2026
Merged

Git-on-my-level merged 31 commits into
mainfrom
lane/sca-1619-app-review-followups

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

UI-Evidence: none -- backend lifecycle, monitoring, release operator docs; no UI changed.

Summary

  • Held Android manual promotions write production releases as draft; the sweep only clears a hide after a genuinely completed rollout. Fresh receipts renew an expired lease, and first-sight reconciliation repairs missing receipts without reviving expired tombstones.
  • Page on missing and rejected submission tokens after three lifecycle failures within three hours; the reasons reach the real alert rule and generated export.
  • Close the remaining lifecycle, Play edit contention, metrics inventory, route-policy, rollout-brake, and operator-runbook gaps from the independent audit. The brake authenticates the scheduler pause read with the existing read-only identity and fails closed on missing or denied access.

R1 decision

Use the write-side fix. When changesNotSentForReview is enabled, an omitted Android release status defaults to draft; otherwise it remains completed. A held draft cannot be mistaken for a live rollout by the sweep, while a genuinely completed rollout remains the approval signal. This avoids exposing a staged fraction before review.

Audit coverage

  • Android reconciliation creates a 14-day hide on first sight of a non-completed production code, repairs active hides without extending a same-build lease, and preserves expired tombstones. A fresh authenticated receipt for a replacement build receives a new full lease, and completing an older build cannot clear a same-version replacement build's hide while it remains pending.
  • The parent lifecycle uses a call-time Firestore resolver, a valid module-scope Credentials import, TTL-only cleanup on store failure, and semantic/build-aware hide matching. Credential, store, and submission-token failures page through the wired alert path.
  • Sweep and promotion paths retry Play edit conflicts with bounded exponential backoff. Failed validation, track reads, updates, or commits abandon the uncommitted Play edit so retries are not blocked; committed edits are never deleted. The rollout brake verifies both manually disabled/drained GitHub writers and the paused scheduler; its fresh-runner path uses the existing google_play service-account credentials and the API-supported cloud-scheduler OAuth scope, with read-only access enforced by IAM. Missing or denied cloudscheduler.jobs.get access fails before a Play edit.
  • Declared the wired submission limiter as fail_open in the route manifest. Added the sweep counter and outcome label to the metric contract.
  • Regenerated the combined alert export and GMP inventory after resolving parent/child generated-file conflicts. The inventory reports combined_equals_split: true and retains all 326 query consumers.
  • Expanded parent and child runbooks with the freeze, credential/deploy order, pre-activation probes, first-tick snapshot and checks, deadman verification, receipt authentication, rotation, and rollback. Activation requires parent SCA-1606 Reconcile temporary app review visibility #25123 first and the final repaired child code merged and deployed; the scheduler remains planned and paused until separately authorized.

Branch and merge order

Parent PR #25123 merged to main at bc7e79190a84 (2026-11-15 06:40Z). This PR targets main, currently based on 18a774e84662; child head 05e5df7b4c79 includes a normal merge of that current base. The child retains its lifecycle and operational changes, including the d1c77ea6 hermetic Play SDK test fix. The prior origin/lane/sca-1606 event failed before tests because the parent branch had been deleted; that stale-base event is resolved by the current main integration. The alternative branch lane/sca-1619-studio remains untouched.

Product invariants affected

Verification

  • Parent SCA-1606 Reconcile temporary app review visibility #25123 passed its normal bounded pre-push gate at 8e767d02812d169e90e1ab75a5e2c07a5ba2f2c5; the targeted lifecycle/alert/GMP suite passed 116 tests. The previously timing-sensitive shard-6 scope passed a 50-test local rerun.
  • On the merged review head, the targeted lifecycle, brake, boundary, route-policy, scheduler, monitoring telemetry, and strict-transaction suites passed 251 tests. backend/.venv/bin/python app/scripts/mobile_store_promote_test.py passed 37 tests, backend/.venv/bin/python app/scripts/mobile_daily_train_test.py passed 105 tests, and backend/.venv/bin/python .github/scripts/check-release-process-guards.py passed. git diff --check passed.
  • The brake tests use fake GitHub/Scheduler responses and fail closed on denied scheduler reads. No live scheduler/IAM/store read or additional grant was made. API routes run on backend-sync under backend-runtime; this stack does not request backend-listen access.
  • New-head GitHub required checks and current-head author approval must be refreshed after publication. Keep SCA-1619 blocked until the required checks and approval gate pass; do not retarget or bypass the gate.
  • No production writes, credential creation, scheduler operations, PR merge, deployment, or activation were performed.
    Failure-Class: new
    Line-Count-Exception: backend/utils/metrics.py | 1765 -> 1817 | the integrated stack carries the app-review lifecycle metrics and their reason labels without splitting the existing metric module

Failure-Class: FC-app-review-visibility-diverges-from-held-store-state
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 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-15T03:05:09.070742Z df54e39 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: 1d1d34663a

ℹ️ 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".

Comment thread app/scripts/mobile_rollout_brake.py Outdated
Comment on lines +43 to +47
result = subprocess.run(
[
"gcloud",
"scheduler",
"jobs",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Authenticate the scheduler check in the Codemagic brake lane

On a fresh Codemagic runner, this new mandatory check has no authenticated Google Cloud CLI identity. The android-rollout-brake workflow in codemagic.yaml:2958–2977 only loads the Play credential group and invokes Python; it never activates credentials for gcloud. The existing promote.play_edit() consumes GCLOUD_SERVICE_ACCOUNT_CREDENTIALS directly through the Python SDK, which does not authenticate this subprocess. Google's CLI documentation requires importing credentials and activating them “for use in gcloud.” Consequently, even after operators pause all writers, both status reads and brake operations stop before opening a Play edit. Provision an authenticated scheduler-read identity in this lane, or perform the check through an explicitly authenticated API client.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Resolved on the current head: the scheduler check uses the existing service-account JSON through authenticated google.auth AuthorizedSession, not an unauthenticated gcloud subprocess.

@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: df54e390bc

ℹ️ 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".

Comment thread app/scripts/mobile_rollout_brake.py Outdated

credentials = service_account.Credentials.from_service_account_info(
json.loads(credentials_raw),
scopes=["https://www.googleapis.com/auth/cloud-platform.read-only"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Request a supported OAuth scope for the scheduler check

Even with valid Codemagic credentials and cloudscheduler.jobs.get permission, this check requests an unsupported OAuth scope. The new AuthorizedSession fixes the previous unauthenticated-CLI path, but Google's jobs.get documentation requires either cloud-platform or cloud-scheduler, not cloud-platform.read-only. Consequently, the scheduler read is rejected and every brake action, including status, fails before opening a Play edit. Request a supported scope and enforce read-only access through the identity's IAM permissions.

Useful? React with 👍 / 👎.

@Git-on-my-level Git-on-my-level Nov 15, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Resolved by using the documented cloud-scheduler OAuth scope (one of only two accepted by jobs.get); IAM still enforces read-only access. This exact scope now has request and negative-response regression coverage on the publication candidate.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

/approve-ui a962a4f

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Head e849962 adds same-marketing-version build rollover coverage, a full lease for a new build code, preservation of pending hides when an older build completes, supported scheduler auth scope, and cleanup of uncommitted Play edits after failed reads/validation/commits. Focused verification: 251 selected backend tests, 37 promotion tests, 105 daily-train tests, release-process guards, and diff whitespace checks all pass locally. No live production, store, or scheduler writes were used. Parent #25123 still needs to merge before this child; GitHub required checks and fresh-head approval remain merge gates.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

/approve-ui 24ef80c

Git-on-my-level added a commit that referenced this pull request Nov 15, 2026
## What changed and why

Adds a bounded review-visibility lifecycle: successful store submissions
are reported by Codemagic, then an internal sweep reconciles App Store
Connect and Google Play state and expires temporary hides after 14 days.
The app-review read path and its parity behavior remain unchanged.

## Current-main repair (2026-11-14)

- Integrated current `main` at `3980a409cb9b` with a normal merge. The
GMP inventory now contains 326 consumers, preserving main’s batch-census
and newer metric consumers alongside both app-review consumers.
- Resolve Firestore through `get_firestore_client()` at each lifecycle
access. Store read failures still run TTL cleanup and emit bounded
`omi_fallback_total` telemetry for the `ttl_only` path.
- Declared and explicitly kept all four app-review metrics in the
backend-sync scrape while retaining main’s free-allowance metric family;
both critical app-review alerts use the unmuted human Telegram paging
tier. The sweep-silent rule remains paused until its first successful
tick.
- Added semantic-versus-build regressions: a semantic-only hide applies
across builds, while clearing one build-qualified hide preserves another
build.
- After the current-main conflict resolution, the app-review
lifecycle/boundary/storefront, monitoring/GMP, scrape, batch-census, and
scheduler-reconcile suites passed: 444 passed, 2 skipped. Alert backtest
lint passed with 3 pre-existing legacy-debt notices and no failures. The
child rollout-brake suite passed 30 tests after parent integration. No
store account, live scheduler, or production Firestore access was used.

## Product invariants affected

- INV-DATA-1

Line-Count-Exception: backend/utils/metrics.py | 1765 -> 1816 | add
pre-zeroed app-review lifecycle alert and sweep metrics.

## How it was verified

- Focused lifecycle, monitoring/export, closed-reason, scheduler, and
route-policy tests: 259 passed.
- `python3 app/scripts/mobile_store_promote_test.py`: 32 passed.
- `python3 .github/scripts/check-release-process-guards.py`: passed.
- `PYTHON=./.venv/bin/python bash test-preflight.sh` from `backend/`: 17
passed, 9 optional environment warnings, 0 failed.
- Pyright on changed backend modules: 0 errors, 33 dynamic SDK/response
typing warnings.
- After adding submission-token reasons to the paging rule, regenerated
the canonical combined alert export and GMP inventory. The focused
app-review, monitoring-GMP, and monitoring-provisioner suites pass: 116
passed.
- On parent head `0f7b038d4c5b`, hosted shards exposed the stale
inventory and split/combined alert mismatch; both artifacts are
regenerated on this follow-up. Two separate timing-guard files were
rerun with the prescribed `backend/test.sh` runner through `omi-heavy`:
50 passed, with CPU-time warnings below the 1.0-second failure limit.
The refreshed head still needs GitHub checks.
- The full local `backend/test.sh` run reported timing/load failures in
`test_live_recovery_matrix.py`, `test_qualify_parakeet_route.py`, and
`test_backend_test_runner.py`. Each file passed its prescribed isolated
rerun (103 passed/3 deselected, 34 passed, and 16 passed respectively);
no reproducible failure remained.
- No store accounts, production APIs, Firestore writes, deployments,
credentials, or scheduler activation were used during validation.

## Tests

Coverage includes held/draft Play releases remaining hidden until a
completed rollout, clearing legacy iOS hides when ASC is live or
terminal, adoption and expiry of pre-existing hides, build-qualified iOS
version matching, tombstone persistence, bounded and rate-limited
submission receipts, Codemagic hook failure handling and staging
override, Play edit-conflict retry, workflow environment-group scope,
and alert paging policy.

## UI evidence

UI-Evidence: none -- backend and release automation only.

## Failure class

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

## Operational notes and deviations

- The hourly worker combines store reconciliation and TTL cleanup. Its
scheduler declaration remains `planned` and `PAUSED`; it runs at minute
17 to avoid the rollout-watch and daily-train Play edit windows, and
retries one edit-creation conflict.
- Activation is gated on parent #25123 landing before child #25131, then
the child’s final repaired code being merged and deployed. Verify
held/draft Android writes, expired-receipt renewal, missing-receipt
reconciliation, token-error paging, and brake scheduler quiescence from
child regressions and deployment receipts. Parent-only checks do not
satisfy these gates; merge alone is not activation permission.
- Only a Play production release with `status == "completed"` counts as
live. Draft, in-progress, and held releases remain hidden. The 14-day
lease is the staged-rollout backstop. When a lease expires, the hide
stays off for that version until a new submission is recorded; its
tombstone prevents reconciliation from re-hiding it.
- The iOS reconciler adopts existing matching hides and clears them on
live or terminal ASC state, including build-qualified entries such as
`1.0.547+20` when ASC reports `1.0.547`. The current poller does not
query the separate `macos` document; its existing `1.0.80+501` entry
remains a manual cleanup decision after checking store state. Unmatched
legacy iOS entries also require a separate manual decision.
- Before merge, create the Codemagic `app_review_config` environment
group empty. It is referenced only by `mobile-store-promote` and
`mobile-daily-train`; Codemagic rejects missing groups. The hook is
best-effort after a successful store submission. Do not add the token
until the scheduler is enabled and one successful sweep tick is
confirmed.
- The path-based invariant checker also selects `INV-AUTH-1` and
`INV-BETA-1` because `codemagic.yaml` changed. Those desktop auth and
beta contracts are untouched; only the two mobile workflow group
bindings changed here, so the affected-invariant list above
intentionally cites `INV-DATA-1` alone.
- After the stacked merge and under separate authorization, provision
only the documented scoped store credentials and Secret Manager bindings
to `backend-runtime`. The submission and sweep routes run on
`backend-sync`; do not grant `backend-listen` access for them. Probe the
narrowest ASC read role and verify on a staging app that the Play role
can create/read/delete an uncommitted edit before production activation;
a view-only Play role has not been verified to allow this.
- The submission endpoint caches the token in-process for 60 seconds,
compares UTF-8 bytes in constant time, returns the same 401 for missing
or incorrect tokens, and limits requests to 10 per IP per minute.
Receipts must be no more than 15 minutes old (five minutes future skew);
repeated receipts do not extend an active lease. Rotate the Secret
Manager value and Codemagic group together, wait 60 seconds or restart
all instances, verify in staging, then revoke the old value.
- The real paging rule covers unavailable store credentials, store API
errors, unavailable submission tokens, and rejected submission tokens;
routine repairs and live clears are success paths. Missing store
credentials still allow TTL cleanup. The silent-sweep alert stays paused
until its first successful tick.
- The Play reader opens a temporary edit, reads only `production`, and
deletes it without committing. Internal and alpha tracks are not
queried.
- No credential creation, production write, deployment, or scheduler
activation is part of this PR. Merge alone cannot activate the paused
scheduler.
Base automatically changed from lane/sca-1606 to main November 15, 2026 06:40
Git-on-my-level and others added 5 commits November 15, 2026 02:03
The Hygiene job runs mobile_store_promote_test.py on system Python without
google-auth, so patching google.oauth2.service_account failed to resolve the
target. Inject stub modules through sys.modules instead.

Failure-Class: new

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ps' into lane/sca-1619-app-review-followups

# Conflicts:
#	app/scripts/mobile_store_promote_test.py
Git-on-my-level added a commit that referenced this pull request Nov 15, 2026
…es (#25372)

Two slow-suite guards are red on main since #25340 and #25368 merged.
This repairs both with test and inventory changes only; no production
code changes.

Failure-Class: none

## What was wrong

-
`test_llm_gateway_coverage_guardrails.py::test_direct_provider_usage_stays_inside_approved_boundaries`
reports `DirectUse(utils/llm/summary_embeddings.py, AsyncOpenAI)`: the
file added by #25340 was not in the direct-provider inventory.
-
`test_real_clock_budget_ratchet.py::test_no_new_tiny_real_clock_budgets`
rejects two tests that set `COMPOSER_CONTEXT_TIMEOUT_SECONDS` to 0.1 s
(#25340) and 0.04 s (#25368), real-clock budgets under the 0.5 s limit.

Both guards are marked slow and are selected by path, so the two pull
requests' own CI did not run them; other pull requests (#25314, #25131)
inherited the failures.

## The repair

- Inventory: `utils/llm/summary_embeddings.py` is registered with its
policy stated beside the entry. It is the composer's single bounded
embedding request for owner-memory retrieval. It enforces the
generated-compute budget and resolves the BYOK key before any IO, and
routes through the LLM gateway whenever gateway feature mode is on,
which is the production setting on backend, backend-sync and
backend-sync-backfill (`OMI_LLM_GATEWAY_FEATURE_MODE=gateway`, read from
the serving specs). The direct client is the non-gateway branch only:
same provider, key custody and model as `clients.py` `OpenAIEmbeddings`,
with SDK retries off and the caller's absolute deadline. It lives
outside `clients.py` so the notes routing digest and paid checkpoints
stay unchanged. Both branches are exercised with the real SDK in
`test_episode_summary_provider_bounds.py`. No gateway, BYOK or quota
path is bypassed.
- Tests: both context-budget tests now inject the clock and the
completion event of `composer_context_budget`, so the caller's whole
budget elapses deterministically while the provider call is still
running. They still assert the properties the originals covered: the
caller returns at the deadline and not when the non-cooperative provider
finishes, partial context is discarded, completed sections survive, late
results are never published, and the timeout fallback is recorded once.
The ratchet and its allowlist are unchanged.

## Verification

Both guards, the ratchet's stale-entry checks, the provider-bounds tests
and the two edited test files: 89 passed locally with slow tests
selected (`-m "slow or not slow"`). No tuning value, flag, state or
schema changes.

Rollback: revert this commit; main returns to the two red guards.

Author: Claude Fable 5.2.

🤖 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/25372?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>
<!-- End of auto-generated description by cubic. -->
@Git-on-my-level
Git-on-my-level merged commit b23851a into main Nov 15, 2026
71 of 73 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/sca-1619-app-review-followups branch November 15, 2026 11:17
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