Skip to content

fix: retain exception types at recovery stage boundaries - #24161

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/recoverycause
Oct 31, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/recoverycause

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Recovery failures currently retain a bounded stage/reason but erase the original exception type. Add a WARNING containing only stage, reason and exception type before raising the same RecoveryFailure with from None. Logging failures cannot replace the recovery failure. Typed recovery/privacy exceptions still pass through unchanged.

Scope and diagnosis:

  • Intermediate at_stage warnings use event=batch_recovery_stage_failure; terminal log_failure() output remains event=batch_recovery_failure stage=... reason=.... A stage warning does not imply terminal failure: a later provider may succeed.

  • Both at_stage and the async Soniox boundary reuse stage_failure for the warning. The async boundary retains its existing provider/provider_failed failure and suppresses private exception context even if logging fails.

  • This is diagnostics only. The rollback's proposed self-gate cause remains inferred, not proven; the new warning is needed to establish the next wrapped failure's actual type.

  • Source trace: backend/main.py starts serving maintenance; serving.py constructs QuarantineRecovery and dispatches recovery; routers/batch_pipeline.py runs recover_async. Recovery executes in backend serving, not the GPU batch worker. Lead owns review, merge and serving deployment.

  • Unknown-language recovery reaches _self_gate only on the legacy route: recovery_recognizers.transcribe(multilingual=False) → prerecorded_from_bytes → resolve_language. The default-on empty-ASR safety net, multilingual recovery policy, or an unsupported_language worker hold selects direct Modulate and bypasses the gate. language_gate.self_detect already catches transport exceptions internally. Per lead ruling 9839b1, no speculative fallback change is included.

  • On the direct route, the first Modulate bytes_len log is inside modulate_prerecorded_from_bytes. Before it, transcribe imports the deferred STT modules, calls inspect_audio (decode, PCM allocation and strict VAD), constructs another WAV via canonical_wav, evaluates RecoveryPolicy, enters parakeet_caller, and invokes the dispatch lambda through the @timeit wrapper. MemoryError during buffer allocation/copying for a roughly 115 MB unit, decode/VAD errors, deferred import or caller-context setup errors remain hypotheses. canonical_wav, imports and context entry are outside the provider at_stage wrapper, so this PR does not newly instrument them; if they escape, the outer recovery boundary records provider/operation_failed, rather than the wrapper's provider/provider_failed. The dispatch/decorator entry and initial log formatting/handler can fail inside that wrapper before the bytes_len line is emitted; missing or filtered INFO logging is another possibility. A missing bytes_len log alone does not establish where execution stopped. No live incident policy/account data was inspected.

  • No timeout, chunking, T2, observer, language-routing, workflow or flag changes. Keep the diagnostic patch small before widening fault coverage.

Validation (local unit layer only):

  • Async follow-up publication: normal pre-push gates passed under the isolated heavy-slot environment at d5e32f80da56, including selected backend tests and type checking. GitHub CI and lead Luna re-review remain separate gates.

  • Async follow-up preflight: make preflight passed all 36 checks with OMI_PR_BODY_FILE supplied, under the same isolated heavy-slot environment.

  • Async Soniox follow-up: 287 tests passed in the four-file disposition/quarantine/language/async recovery shard, including async warning privacy and broken-logging coverage. A source AST audit found both exception-to-RecoveryFailure conversions now use the shared helper. The primary language route selects Modulate or Parakeet, never Soniox; independent Soniox errors are consumed as second-provider error outcomes.

  • Previous stage-event follow-up: 143 tests passed in the selected disposition/quarantine-recovery two-file shard, including the renamed stage warning and exact unchanged terminal log_failure() output.

  • Original diagnostic patch: 284 tests passed in the targeted four-file backend shard through backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST, BACKEND_PYTEST_WORKERS=1, nice -n 19, and /Users/dazheng/workspace/omi/bin/omi-heavy run --.

  • Tests use the worktree-local Python 3.11 environment under env -i, with empty scratch HOME, XDG_CONFIG_HOME and CLOUDSDK_CONFIG. No ambient GCP/provider credentials; the harness supplies synthetic keys and blocks outbound network.

  • Regression coverage checks every bounded stage, exception type without message/traceback disclosure, from None, typed-failure passthrough, and logging failure resilience. Neighbouring language-recovery, async-recovery and quarantine-recovery tests exercise the existing recovery contracts.

  • Follow-up validation: make preflight passed ten checks and failed only failure-class metadata when invoked without a PR-body file. Supplying the updated body to scripts/pr-preflight --metadata-only --pr-body-file passed all four metadata checks. Normal pre-push gates then passed at the final head, including the automatically selected 19-file backend shard and type checking with zero errors. These are local checks; GitHub CI and lead Luna re-review are separate gates.

  • This does not prove the incident cause, deployed behavior, or vendor connectivity.

Failure-Class: none

Classification: diagnostic-only change; reviewed FC-empty-asr-without-evidenced-disposition, whose accounting and terminal-disposition semantics are unchanged.

View guided diff Turn on auto-fix

Log bounded recovery stage, reason and exception type before suppressing the
original exception context. Cover every bounded recovery stage and preserve
typed privacy/recovery failures even when logging itself fails.

Failure-Class: none
Use a separate event for intermediate at_stage failures so a later provider
success does not look like a terminal held recovery. Preserve terminal
log_failure output and cover both event contracts.
Share content-free stage-failure logging across sync and async recovery
boundaries while preserving the existing failure and logging resilience.

Failure-Class: none
@Git-on-my-level
Git-on-my-level merged commit 787f867 into main Oct 31, 2026
60 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/recoverycause branch October 31, 2026 12:35
Git-on-my-level added a commit that referenced this pull request Oct 31, 2026
… 5xx re-escalation, WQ31) (#24194)

## Summary

Firestore read lever config — guard flag-off: 7 levers 100 -> 0
(`singleton_loops`, `usage_month_cache`, `backfill_task_reads`,
`historical_scan_memo`, `ledger_purge_coalesce`,
`queue_age_sample_budget`, `usage_month_total`). Complete 20-key
literal, delta vs main only in those 7 keys; `finjob_candidate_queries`
stays 5 (its own gate). The `usage_month_total` Cloud Run-only override
in `prod.overlay.yaml` goes 100 -> 0 with this flag-off — umt is itself
guard-flagged; #23739 (4f7e485) set the precedent of flagging umt to
0 and removing the wanted-line CR term while keeping
`FSR_USAGE_MONTH_TOTAL_EPOCH` recorded.

Reason: backend-sync 5xx guard re-escalation fired per the armed WQ30
plan. verify graded the flagged levers UNSAFE on 5 consecutive ticks
(17Z-21Z 2026-10-31: rate 0.0035-0.0036, 1550-1600 err/h excl
audio-merge, vs ref 0.0014). The 17:15Z run disposed the first raise as
exogenous (route attribution: /v2/sync-jobs/run + audio-merge retry
noise under 2x WoW traffic) and armed re-escalation: "flag off next run
if verify still FAIL post-fix-serve with 2h train-quiet tail, or on any
lever-specific why". The lead's fix train (14d7e31 carrying #24161,
#24164, #24175) went live 15:18Z on backend / backend-sync /
backend-integration (lead bus post); no train since (5h+ quiet tail);
verify still FAILs with a FLAT rate and unchanged error counts. No
lever-specific why (finjob at 5% carries the same service-scope why).
Per the runbook judgment rule, flag-off is the discriminating
experiment: if the 5xx rate persists at levers 0, the cohort is
exonerated (cause exogenous) and re-enables at 5%; if it drops, the
cohort is implicated.

## Product invariants affected

- INV-FSR-LEVERS — replace-mode literal rule respected; all 20 keys
present; absent keys remain off by default; KNOWN_LEVERS unchanged.
- INV-MEM-4 — required by the `backend/deploy/runtime_env.yaml`
generated-manifest lock; the change is the rendered
FIRESTORE_READ_LEVERS literal only.
- INV-DATA-1 — lever-off restores legacy un-memoized paths (safe
defaults, all previously serving pre-ramp).

Failure-Class: none

## Verification

- `set_levers.py` REPLACE-mode with the complete 20-key umt:0 literal (6
keys 100 -> 0 in base/charts/pins); `prod.overlay.yaml` hand-patched umt
100 -> 0 plus the same 6 keys (4 sites, set_levers does not match its
inline literal form); `compose_runtime_env.py` +
`render_feature_flag_registry.py` re-run.
- Contract-pinned expected dict in `test_render_backend_runtime_env.py`
updated per #24134/#23739 convention (6 keys 100 -> 0; the `wanted`
CR-override term removed while umt is off, epoch assertion unchanged).
- Diff audit: 43 changed-literal sites, every `+` side equals the new
20-key literal exactly; zero residual sites with any flagged lever > 0;
`finjob_candidate_queries` = 5 everywhere.
- Contract tests: `test_render_backend_runtime_env.py` 91 passed +
`test_verify_pusher_config_references.py` 28 passed (lane venv).
- Full CI: on this head.

## Lead-owned ship plan

URGENT: deploy needed listen -> pusher -> Cloud Run
(FIRESTORE_READ_LEVERS train order). Bus handoff posted to the lead;
ride the next train rather than batching.


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