Skip to content

SCA-3376: Pace repeated recording custody refusals - #25868

Merged
Git-on-my-level merged 2 commits into
mainfrom
agent/multica-worker-1-codex-sol/80b8f758d0a4
Nov 20, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
agent/multica-worker-1-codex-sol/80b8f758d0a4

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed

The mobile upload gate now paces record_capture_pending across automatic and single-WAL uploads. It uses the existing response body's retry_after_seconds or the scoped Retry-After fallback. The normal 30-second hint yields 30–37 seconds on the first wait, then doubles the base on repeated refusals up to a five-minute total cap. Pacing follows the WAL upload group (conversation, recording session, batch family, and location). Without a session ID, it applies only to the submitted files. The deadline survives restart for the signed-in account. Acceptance clears the wait.

The tagged 1.0.577 iOS and Android clients treat 5xx Retry-After headers as account-wide cooldowns. The server continues using its existing recording-specific response. The change takes effect as the updated mobile builds reach users.

Verification

On multica-worker-1 through bin/omi-heavy, all 117 tests passed across six focused Flutter suites and make preflight passed all 27 checks. The tests cover delay bounds, concurrent admission, restart, unrelated uploads, and accepting the same retained bytes through the existing custody transition. The restart regression reloads the on-disk WAL index and pacing state through fresh instances. It failed on the previous head because both sessions shared a conversation deadline. The revised head accepts one of those sessions while the other stays pending and then retries the retained audio after expiry.

Production readback after mobile rollout

Record the serving iOS and Android builds, rollout percentages, and observed adoption among upload clients. For one matched UTC 24-hour window, sum Cloud Monitoring run.googleapis.com/request_count for backend-sync by response code across revisions, take the maximum of the time-aligned total run.googleapis.com/container/instance_count, and divide service 503s by accepted POST /v2/sync-local-files uploads (HTTP 200/202 from route logs or the route metric). Compare against ~1.93M 503s/day, ~1 per accepted upload, and 40/40 before the cap was raised to 50. Count custody responses separately with omi_pipeline_record_wait_answers_total. Compare acceptance volume and pending age by app build using upload outcomes and Local WAL Stuck observations. Only report refused retries per uploaded audio-hour if repeat refusals and accepted audio duration can both be measured for the same cohort and window.

Product invariants affected

  • INV-CAP-1. A pending custody wait preserves WAL bytes and resumes using the existing acknowledgment path.

UI-Evidence: none
Failure-Class: FC-event-wakes-bypass-request-cadence
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2957 -> 2961 | Check the shared recording gate before selecting or manually retrying pending audio.

View guided diff Turn on auto-fix

@Git-on-my-level
Git-on-my-level merged commit 0d1e1fa into main Nov 20, 2026
52 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/multica-worker-1-codex-sol/80b8f758d0a4 branch November 20, 2026 19:42
Git-on-my-level added a commit that referenced this pull request Nov 26, 2026
## Change

SCA-3376. Completed negative WAL coverage comparisons now memoize for
six hours by default. Redis SET NX sets expiry only on insertion. A
coverage memo hit returns the existing retryable HTTP 503 with
`retry_after_seconds: 1800` in the JSON body. Coverage misses and other
custody waits keep the 30-second hint. The fast hit still wakes the
partial coordinator. Receipt, handoff, and WAL retention behavior is
preserved.

The job snapshot already hashes `audio_uri` with the exact GCS
generation. Audio staging is create-only, and coverage reads pin the
generation. Retained manifests pin source generations and verify decoded
PCM against their authenticated digests. A replacement generation needs
a new job URI to affect coverage, which changes the key. A read or
digest failure cannot populate the memo. The regression test accepts the
same WAL after a repair switches the job to a newer generation at the
same object name, while the old negative remains cached.

## Tuning and rollback

- Coverage memo TTL goes from 300 to 21,600 seconds.
`SYNC_RECORD_COVERAGE_WAIT_TTL_SECONDS` bounds overrides to 30–21,600
seconds and applies on insertion.
- Coverage-hit JSON hint goes from 30 to 1,800 seconds.
`SYNC_RECORD_COVERAGE_WAIT_RETRY_AFTER_SECONDS` bounds overrides to
30–1,800 seconds.
- Roll back with `SYNC_RECORD_COVERAGE_WAIT_MEMO=false` on all serving
upload revisions. It bypasses populated entries as well as writes. The
new Redis prefix keeps long-lived entries isolated from older code
during a mixed-revision rollout or code rollback.

## App behavior

Source checks at tagged iOS 1.0.577+1520 and Android 1.0.577+1516 show
that those builds use the Retry-After header path and ignore this JSON
hint. The macOS 0.12.578+12578 source treats a 503 as a generic
retryable upload failure. The Flutter pacing code from #25868 applies at
most 300 seconds to a 1,800-second hint. Store adoption and actual
retries must be measured by build before estimating fleet savings.

## Verification and production readback

- 187 focused unit tests passed on the M1 Studio through `omi-heavy run
--wait 300 --timeout 300`. Suites covered coverage memo and telemetry,
artifacts, WAL handoff, duplicate settlement and the flag budget.
- All 44 local preflight checks and the repository pre-push verification
passed. The historical failure-class ratchet skipped its 90-day scan in
the shallow checkout.
- After release, compare closed, matched UTC windows with revision,
traffic split and instance cap recorded. Allow the new memo namespace to
warm before scoring. Count coverage hits divided by hits plus misses
from `sync_record_upload` events with `path=coverage`. Sum request
latency in seconds for HTTP 503 on POST `/v2/sync-local-files`. Compare
peak concurrent active backend-sync instances using time-aligned
instance counts across revisions. Report successful uploads and oldest
observed pending WAL age alongside these results, by app build where
available.
- For the service-level ratio, use Cloud Monitoring request counts from
the same revisions and window. The design thread reports about 3.14 HTTP
503s per 202. Report HTTP 503 / (200 + 202) alongside that comparable
503 / 202 series. The targets are >90% coverage hit share, ≥50% fewer
upload 503 request-seconds, and <45 peak active instances. Confirm a
serving revision before scoring.

## Product invariants affected

- INV-CAP-1. The custody wait retains local WAL and the durable
acknowledgment path continues to own audio release.

UI-Evidence: none


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