Repository navigation
fix(backend): a live reconnect resumes its conversation instead of minting a stub, plus the health-driven STT routing foundation - #15222
Git-on-my-level wants to merge 4 commits into
Conversation
Keep locks, deletion tombstones and sync revision ownership ahead of empty-live-row cleanup. Content continues to use the existing codec-aware transactional fence. Validation: BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-stt-selected-tests.txt bash backend/test.sh — 340 passed, including 33 recording-session cases. Existing resume assertions stay unchanged; fixtures now include their real source/device/finished-at metadata. Failure-Class: FC-split-mutation-authority
Keep an immutable original recording binding and transactionally adopt its compatible active continuation. Reconnects inside the shared silence boundary reuse the continuation; expired empty and unexposed losing generations use lifecycle-owned fenced cleanup before STT admission. Reject deleted, discarded, locked and other-device rows. Keep existing explicit WAL targets authoritative. Tests reproduce newest-first/interleaved legacy hints, the remaining partial-flap limit, same-origin 35-second reconnects, exact 120-second rollover, protected content and legacy principals. Validation: BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-stt-selected-tests.txt bash backend/test.sh — 340 passed. Hermetic E2E: 120 passed, 3 skipped, 2 xfailed. Sync Cloud Tasks emulator gauntlet passed. Live provider/client acceptance was not run; only hermetic service seams are authorized. Failure-Class: FC-split-mutation-authority
Add a pure capability registry and seeded ordered/weighted policy, a shared Redis admission state with generation-fenced half-open probes, and one ranked session cursor for connection and replacement. Socket acceptance never closes health or proves recovery; nonblank transcript content does. Keep late content with its serving-provider identity. Default legacy mode retains the existing provider path. Ordered/health modes include configured Soniox at connect, count eligibility skips, skip quarantined accounts without vendor retries and fail open on Redis/config failure. Managed health excludes BYOK, custom STT and multichannel. Keep the existing rebuild ownership block intact for the in-flight first-transcript recovery PR. Validation: BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-stt-selected-tests.txt bash backend/test.sh — 340 passed. Includes concurrent receiver failover, seeded selection properties, typed account failures, shared probe admission, transcript settlement and Redis outage. bash backend/testing/e2e/run.sh — 120 passed, 3 skipped, 2 xfailed. No live provider call or rollout was performed.
…policy Move the unchanged resumable-continuation predicate out of database storage and into the shared continuity module. Async callers now depend on the pure rule; transactional metadata access stays on the persistence executor. This addresses the installed pre-push async-boundary guard without an exemption. Validation: BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-stt-selected-tests.txt bash backend/test.sh — 340 passed after the move.
|
Hey @Git-on-my-level 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Failure-Class
Failure-Class: FC-split-mutation-authority
Summary
Follow-on to #15193. That PR stopped offline sync adopting live reconnect stubs. This one fixes
the other half — realtime minting a fresh conversation on every reconnect — and lands the
foundation for choosing STT providers from live health instead of a hardcoded ladder.
The 2026-09-19 incident had two independent authorities over conversation identity. Sync's is now
one transaction (#15193). Realtime's was still
create_new_in_progress_conversation(rollover=True),which minted an unremembered UUID every time the previous client binding was terminal or missing,
so a flapping session produced a new empty conversation about every 35 seconds.
Audit first, then the fix
The change was written against an adversarial audit of what the three landed PRs actually fix.
Verdicts, each tied to the production seam that decides it and to a passing or deliberately-failing
hermetic test:
Three earlier conclusions in this effort are corrected by code inspection, and they change what is
worth building:
ProviderCircuitBreaker.allow_requesthas probeadmission and a multi-success recovery threshold. The "blind 180 s skip" premise was wrong. Its
real weakness is that it measures socket success, not transcript proof, and fallback legs bypass
much of that admission logic.
three payment retries per session. What is missing is a fleet-wide account quarantine.
capture_controller.darthas a 15 skeepalive/reconnect timer and
pure_socket.darta 20 s ping with a 15 s connect timeout; theobserved ~35 s is composed session-failure plus client scheduling, partly server-controlled.
One finding contradicts a stronger claim made earlier in this effort: read-only production logs show
four incident accepts carrying the same client recording ID. A listen request ID and a WAL
conversation ID are different evidence, so #15193's premise stands, but "no client ID was sent" was
too strong. The historical binding state at those instants was not read and remains UNKNOWN.
Changes
Reconnect continuity (the realtime half).
database/listen_continuations.py+utils/conversations/live_continuation.py: a terminal ormissing original binding stays immutable, and a transactional metadata pointer on it names the still
active continuation. Resume requires an exact source/device partition, in-progress status, no
lock/discard/deletion, and a gap strictly below the shared
utils/conversation_continuity.pythreshold — the same predicate sync uses, so exact 120 s splits on both paths. Concurrent proposals
converge on the first resumable generation. A fake-clock replay at 0/35/70/105/119 s emits one
conversation id; 120 s creates a new one.
Fenced cleanup of empty generations.
recording_sessions.py::tombstone_and_delete_empty_conversationnow also protectsis_locked,deletedand nonzerosync_content_revision. Losing proposals are deleted only after a revalidatedwinner is adopted, so late content beats cleanup. No new sweeper job; the final abandoned stub still
goes through existing stale recovery.
Routing foundation, default off.
config/stt_routing.pydeclares each provider's surface, languages, channel limit, features andcost class;
utils/stt/routing.pyranks candidates as a pure seeded function and owns one attemptcursor that connect-time and mid-session failover both consume, so they can no longer disagree.
This is where configured Soniox — absent from the hardcoded connect ladder — becomes a connect-time
leg. An ineligible provider is an explicit counted outcome, never a silent skip.
utils/stt/routing_health.pykeeps closed/open/hard/half-open state in Redis with generation fencesand a 30 s probe lease: three transient failures open for 30 s plus jitter, a typed
budget/payment/quota/auth failure opens immediately for 300 s, and only a non-blank transcript
closes a circuit — a successful socket never does. Redis failure, malformed state or three WATCH
conflicts fail open to configured order.
STT_ROUTING_MODEdefaults tolegacy: byte-for-byte today's behavior.ordereduses the sharedlist,
healthadds shared admission. Rollback is unsetting the variable; in-flight sessions keeptheir snapshot, health keys expire, and the continuation metadata is additive so old code ignores it.
Dependencies
Assumes #15193 (merged,
a7ff0e069a) and #15189 (merged, deployed). It also assumes the in-flightSoniox observability PR, which moves mid-session
recoveredto first transcript and adds typedprovider close reasons; those hunks are deliberately not reimplemented here and the typed
provider_budget_exhaustedreason feeds hard health. A three-waygit merge-fileagainstorigin/mainfor the two overlapping files (receiver.py,streaming.py) exits 0 — textualcompatibility only; combined runtime execution is UNVERIFIED.
Tests
test_listen_reconnect_continuity.py(fake-clock reconnect replay, exact-boundary split, deviceisolation, locked/deleted/discarded exclusion, competing proposals converging),
test_stt_routing_foundation.py(selection as a property test, health transitions includinghalf-open and stale-generation fences, Redis-down fail-open),
test_listen_provider_routing.py,plus additions to
test_recording_sessions.pyandtest_sync_capture_continuity.py. Thepartial-flap limitation has a test that proves the limit rather than asserting it is desired.
Verification
source closure for 15 runtime images, OpenAPI contract, pinned formatting.
BACKEND_UNIT_TEST_FILE_LISTover 14 STT/sync/listen files: 340 passed.npm run test:listen-pusher-stack:emulatorandtest:sync-cloud-tasks-stack:emulator: gauntletspassed, exit 0.
backend/testing/e2e/run.sh: 120 passed, 3 existing skips, 2 existing xfails, 0 failed.origin/mainafter fix(backend): offline sync never adopts live reconnect stubs; assignment is order-independent and shares realtime's boundary #15193 and fix(backend): unbreak Backend Unit Tests on main (merge-train collision) #15219 landed; the inherited line-count exceptions arenow in the merge base and are no longer requested.
Not exercised: live vendor behavior, GPU live/batch contention under real load, physical client
acceptance, deployed first-transcript rates, real prevalence of partial-flap targets, the 09-18 root
cause, and combined execution with the Soniox branch.
Decisions that need David
Provider budgets and weights; whether to reserve dedicated live GPU capacity for Parakeet; and how
ambiguous or already-curated duplicate recordings should be presented before any lineage migration.
Sized follow-up briefs for smaller models are in the design notes: provider epoch clock, the
remaining premature-
recoveredcall sites, hot policy config, routing metrics/TTFT, the clientbackoff protocol, lineage assessment, and the capacity study.
🤖 Generated with Claude Code