Skip to content

fix(conversations-v3): keep rotation-sealed recordings out of the reconnect hold - #26762

Merged
kodjima33 merged 1 commit into
mainfrom
t3/v3-rotation-source-not-live-cut
Nov 30, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
t3/v3-rotation-source-not-live-cut

Conversation

@kodjima33

@kodjima33 kodjima33 commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Follow-up to #26749, from its round-5 review. Listen rotation seals a recording at its cap, often mid-speech, and
opens the next one on the same device at once. Such a seal can fall within 90 s of the last line, so _live_cut
counted it as a reconnect cut, and the reconnect hold took over wherever main's rotation check let the recording
go.

Synthetic case: A rotates at 300 s and B opens on the same device. B enters the completed server-batch handoff at
400 s (completed with home_transcription_pending_at) before its transcript lands. With capture continuity off,
and before #26749, A's card locks at 621 s with its notes queued. With continuity on, the reconnect wait kept A open
until B's transcript landed, or until about 1,300 s.

The fix, in backend/database/conversations_v3.py:

  • _live_cut rejects a recording with a valid rotation stamp. Rotation's own hold (policy.awaiting_transcript)
    alone decides it, under either setting.
  • The other recordings in the load are still checked for reconnect cuts.
  • _rotation_cap is the one definition of a valid stamp (an int or float with 0 < cap <= 3600). The rotation
    check and _live_cut both use it, so the two paths cannot disagree about which one owns a recording. The rotation
    check behaves as before.

Expected latency cost

Product invariants affected

none

How it was verified

  • The regression fails on current main. On main's loader (743bd94141), the same-device replay with capture
    continuity on fails as the review found, while the cross-device arms and continuity off pass. The new loader test
    fails there too: the rotation-sealed recording is held. On this head every case passes.
  • Mutation check. Returning early when the latest recording is rotation-sealed, instead of rejecting it in
    _live_cut, passes the replay but fails the loader test, because the earlier reconnect cut loses its hold.
  • Pipeline lab. All 17 committed scenarios, --jobs 4 --repeat 2 --stt replay, passed in both runs (89.6 s).
    reconnect_successor_lands_late passes 9/9 at 367 reads, and every scenario's checks and counts match the fix(conversations-v3): keep a stretch open for the capture after a reconnect #26749
    head.
  • Unit suites. 158 suites under the CI per-test budget (BACKEND_UNIT_TEST_FILE_LIST=... bash test.sh): all
    test_conversations_v3*, test_pipeline_lab*, test_batch_pipeline_projection*, capture-end, record-seal and
    server-batch-completion files. All 158 files passed: 5,113 tests, none failed.
  • Firestore index guard set (7 files): 928 passed, including 644 query-shape tests. Neither query shape changes.
  • Type check: scripts/typecheck.sh reports 0 errors.
  • Preflight: make preflight with this body passed 40 of 41 checks, including the line-count exception, the
    failure class and the index guard. The one failure is feature-flag-registry at today's UTC date: 82 flag entries
    due 2026-11-22 are past their grace, repo-wide, and this PR changes no flag.
    scripts/check_feature_flag_registry.py --as-of 2026-11-29 passes, and metadata-only preflight passes 4 of 4.
  • Not yet seen in production. This is not deployed.

Tests

backend/tests/unit/test_conversations_v3_successor_hold.py (74 cases, 3 new):

  • test_rotation_lets_a_closed_capture_go_as_main_does now runs B on the same phone as well as on another device,
    each with capture continuity on and off. At 621 s A's card is locked with its notes queued in all four.
  • test_a_rotation_seal_is_no_live_cut_while_other_cuts_still_hold: a rotation-sealed latest recording whose
    successor closed into the handoff is not held, while an earlier reconnect cut in the same load still holds on its
    capturing successor.

Each test runs at or under the 1.0 s CPU budget.

UI evidence

UI-Evidence: none -- backend-only change

Failure class (fixes)

Failure-Class: FC-live-settlement-uses-capture-clock

Line-Count-Exception: backend/database/conversations_v3.py | 2667 -> 2675 | one shared rotation-stamp check, used by the rotation check and _live_cut, beside the loader's successor checks that already live here

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…onnect hold

Follow-up to #26749, from its round-5 review. A recording listen rotation
sealed at its cap could also read as a live cut: its seal lands right
after its last line when the speech goes on. Wherever main's rotation
check let it go, the reconnect hold took over. A same-device successor
that closed into the server-batch handoff before its transcript landed
then kept the rotated stretch open for up to 15 minutes after that close,
where main queues its notes.

- _live_cut rejects a recording with a valid rotation stamp; the other
  recordings in the load are still checked for reconnect cuts.
- _rotation_cap is the one definition of a valid stamp, used by the
  rotation check and _live_cut, so the two cannot disagree about which
  owns a recording. The rotation check behaves as before.

Failure-Class: FC-live-settlement-uses-capture-clock
@kodjima33
kodjima33 marked this pull request as ready for review November 30, 2026 04:59
@kodjima33
kodjima33 merged commit 33dfa4c into main Nov 30, 2026
74 of 75 checks passed
@kodjima33
kodjima33 deleted the t3/v3-rotation-source-not-live-cut branch November 30, 2026 05:00
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