Repository navigation
fix(backend): a live reconnect resumes its conversation instead of minting an empty stub - #15330
Merged
Merged
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
…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.
… path The reconnect-continuity change now requires source/device/timeout on resume and resolves a durable continuation before a rollover mint. The four skipped tests still protect marker persistence, client-id reads, and the existence-read skip; their hosts and fixtures needed those fields to reach that path. Co-authored-by: Cursor <[email protected]>
#15247 refreshes conversation-scoped speaker profiles on mint. Continuity makes resume the common reconnect path, so that load must happen there too or a reused conversation would start a new socket with empty profiles. Co-authored-by: Cursor <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure-Class
Failure-Class: FC-split-mutation-authority
Summary
Realtime half of the 2026-09-19 conversation-fragmentation incident. The sync
half shipped as #15193 and is live in prod: offline sync no longer adopts live
reconnect stubs. This PR is the remaining half — live listen reconnects inside
the continuity window were still minting a fresh empty conversation because
create_new_in_progress_conversation(rollover=True)had no durable continuation.STT routing is not in this PR. #15222's routing foundation was dropped because
#15234 (
live_chain.py/live_rollout.py/live_session.py/stt_provider_policy.py) supersedes it and already owns provider selection. Thisbranch must not introduce a second authority over that choice.
Changes
database/listen_continuations.py+utils/conversations/live_continuation.py:a terminal or missing original recording binding stays immutable. A transactional
metadata pointer on it names the still-active continuation. Concurrent proposals
converge on the first resumable generation.
and a gap strictly below the shared
utils/conversation_continuity.pythreshold(the same 120 s split sync uses). Exact 120 seconds starts a new generation.
lifecycle's fenced empty-conversation path.
is_locked, tombstones, content, andsync_content_revisionwin. The original recording session is never rebound.recording_sessions.pyalso protects those fences during empty-row cleanup.speakers.refresh_for_conversation, the same conversation-scopedprofile load fix(speakers): make cross-conversation speaker labeling viable on mobile (canonical identity, one manual-assignment owner, live names, summary refresh) #15247 added on mint, so a reused conversation does not start a new
socket with empty speaker profiles.
A fake-clock replay at 0/35/70/105/119 s emits one conversation id; 120 s creates
a new one. Other-device Redis pointers cannot steal a same-device continuation.
Tests
test_listen_reconnect_continuity.py— same-origin reconnect reuse, exact120 s split, other-device isolation, locked/deleted/discarded exclusion,
competing proposals converging without mutating the original binding.
test_listen_process_pending_shutdown.py— custom-STT marker persistence andclient-id existence reads still hold on a continuity-eligible resume; rollover
resolves a continuation first, then skips the guaranteed-miss existence read.
test_recording_sessions.pyandtest_sync_capture_continuity.py.#15234'stest_live_stt_chain.pyremains green; this PR does not touchprovider selection.
Out of scope
Provider ranking, health admission,
STT_ROUTING_MODE, and any second connectchain. Historical distinct explicit WAL targets and anonymous cross-device
discovery remain separate follow-ups.
Verification
with no exception requested.
test:listen-pusher-stack:emulator,test:sync-cloud-tasks-stack:emulator)run sequentially, passed.
f28662cafe: none of the six dropped routing files exist on this branch, andbackend/utils/stt/streaming.py,backend/routers/listen/receiver.pyandbackend/routers/listen/runtime.pyare byte-identical toorigin/main— so the ~116-line languageinventory move that belonged to the dropped routing commit is fully reverted.
Not exercised: physical client reconnect acceptance, real Firestore contention on the
continuation pointer, and deployed reconnect rates. The 2026-09-18 pattern of eleven overlapping
live conversations is not claimed fixed; its cause is still unknown and needs a provider-epoch
replay.
Design by Codex (
gpt-6-astra); routing half dropped and rebased by Cursor Grok; reviewed and splitby Claude.
🤖 Generated with Claude Code