Repository navigation
test(listen): verify legacy drop finalization across reconnect flag states - #25607
Merged
Merged
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
What changed
The exact requested runtime fix is already on the freshly fetched base: PR #25599, merged as
0ff616e7dfd23b14a1ff6da30019040aa445f665. This follow-up strengthens its regression test rather than adding a duplicate gate. No serving code changes.The test now runs real
ListenSessionRuntime._teardown_components,LiveConversationController.disconnect_batch_producer,process_conversation, and the archive-close helper. It retains the sibling test's mocked socket/cleanup harness, fakes persistence side effects, and mocks theschedule_finalizationadmission boundary. The same mobile batch capture is tested withLISTEN_BATCH_RECONNECT_ENABLEDunset,false, andtrue, for iOS/Android andomi/phonesources. Unset/false must close the archive and schedule finalization once; true must flush the tail and skip scheduling.Mechanism and scope verification
backend/routers/listen/runtime.pytook thebatch_disconnect == 'legacy'/resumable_after_drop(...)arm without consulting the flag. That arm only flushed speaker assignments; it did not callprocess_conversationorschedule_finalization. It is anelifbranch, not an immediate function return: later teardown cleanup still runs.runtime.py:1503-1505already gates that arm with the realconfig.listen_reconnect.enabled()accessor (backend/config/listen_reconnect.py:16). The accessor defaults to false and enables only the normalized valuetrue.backend/routers/listen/batch_close.py:12-38requires quiet ownership, mobile platform, server-batch ownership, no explicit finalization reason, and a freshin_progressrow withhas_audio(...). That audio predicate requireshas_contentand finite, increasing audio bounds;server_batch_audio_received=Truealone is insufficient.evaluate_quiet_checkchecks those conditions (backend/database/conversation_quiet_checks.py:210-223,270-294);quiet_finalization.runrequestsSERVER_RECOVERYfinalization with an expired-lease requirement (backend/utils/conversations/quiet_finalization.py:184-194). The existingtest_quiet_check_finalizes_an_open_phone_batch_capture_with_committed_audioexercises actual admission and job creation with no producer metadata or close barrier. A renewed live lease defers admission. The quiet evaluator publishes the batch close barrier only whenlisten_reconnect.end_due(...)is true, which a producer-less row cannot satisfy.Validation
From the task lane root, each test file in its own pytest process:
Mutation proof: temporarily removed only
and listen_reconnect.enabled()from the runtime branch and ran:/Users/dazheng/workspace/omi/bin/omi-heavy run -- backend/.venv/bin/python -m pytest backend/tests/unit/test_mobile_batch_disconnect.py -q --tb=short --disable-warnings -k 'schedules_finalization_only_with_reconnect_off and false'All four explicit-false mobile/source combinations failed at
schedule_finalization.assert_awaited_once_with: zero calls. Original runtime bytes were restored infinally; there is no runtime diff.make preflight: passed, 37 checks. PR metadata preflight: passed. The complete bounded pre-push hook also passed at commit3a695d5c58b709d69a413b8385f4be93444bcb20(including selected backend tests and pinned formatting).Local hermetic validation only. No production reads or writes, no GCP tier used, no deployment or merge. The supplied production metrics, flag state, and rollout timestamp were not independently remeasured. The scoping was stale about the missing gate: it is already fixed on current main. It also described the skip as a return; the actual branch continues with cleanup. Quiet admission is conditional, not structurally impossible for every row matching the hold predicate.
Rollback
Revert this test-only commit; serving behavior remains the #25599 gate. To restore the original runtime defect, reverting #25599's
and listen_reconnect.enabled()line would re-enable the ungated hold; that is not part of this PR.