Skip to content

v3: Finish ends the live window when the recording has no in-progress pointer - #26242

Merged
Git-on-my-level merged 4 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/v3-finish-no-pointer
Nov 24, 2026
Merged

Git-on-my-level merged 4 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/v3-finish-no-pointer

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

DESIGN

After both existing recording lookups miss, an authenticated v3 owner can Finish a live derived window. An optional live_conversation_id is checked in the owner's collection against the same liveness and visibility rules, with a transactional recheck before any write. An invalid or stale hint falls back to the existing bounded live lookup. Empty requests keep working.

Finish writes the cut and builder wake on a closed recording with available speech. For server-batch captures, it reads the deterministic native projection ledger under the same transaction. A complete whole-record receipt allows an immediate cut, including on a repeat tap with a deferred marker. An unfinished full recording stores one deferred request. Single-unit admission and projection keep their existing rules. Multi-unit completion consumes the request in the existing ledger transaction only after every unit has a ready receipt. The completion write and durable builder wake commit together. A partial archive or explicitly incomplete ledger cannot authorize the cut.

The route uses the existing owner-scoped native ledger at the deterministic record identity. Its batch protocol, native job ID, binding and completed result are the proof. The writer verifies the binding and every sibling's ready receipt before committing that result, so older ledgers work without a separate processed-segment list. Whole-record completion also resolves terminal silence. It cuts a matching live window that still has speech, or clears the request and retains its window ID for a terminal acknowledgement on repeat. Terminal silence can add one recording read if the output snapshot is absent and one masked window read for a pending request.

A stored request is reusable only while its request flag is true and its window ID matches. A different pending request is retargeted only when the recording's stored claims prove the requested window owns the unique latest end and the previous window has an earlier claim. If that proof is missing or ambiguous, the endpoint returns 404 and preserves the pending request. A resolved marker can be rearmed for pending batch work and does not count as a consumed request on a fresh cut.

A lookup miss adds the existing live query (usually a few documents, capped at 200), or one by-ID read for a usable hint. It adds at most two transaction document reads per attempt for the live row and its source, plus one ledger read for server-batch recordings. A stale hint can add one attempted lookup and transactional recheck before fallback. Each Finish writes at most one recording. Whole-record completion uses the projection's existing output snapshot and adds at most one recording update and one named builder wake for a pending request. No request-side provider calls are added.

Compare unique acceptances (cut plus requested) with first successful settlements (settled) for the accepted window IDs in omi_conversations_v3_finish_no_pointer_total, allowing for the projection and summary drain time. Track consumed for deferred requests converted to a cut by a repeat tap or whole-record completion. Track resolved_empty separately for accepted requests that found no remaining speech. Repeated acknowledgement outcomes are excluded from the denominator. Also compare HTTP 404 share for POST /v1/conversations with the supplied 10:45 UTC baseline of 18/30, and check 5xx and end-to-summary latency.

What changed and why

Mobile Finish and v3 End can reach the backend after quiet rotation closed the source recording. The existing in-progress Firestore lookup excludes derived windows and could return a 404 while a v3 window was still live. Finish now uses the authenticated owner's live window and persists its manual end. App PR #26241 can optionally send that window's ID.

SCA-4084 identified a race where a multi-unit request could arrive after the admission snapshot. The native projection completion transaction now consumes it after all sibling receipts are ready, including terminal silence. The route recognizes the completed ledger the native writer already persists. Single-unit projection keeps its existing whole-native-record guard. The response-only processing status is declared in the lifecycle writer inventory.

Cost

The request adds a bounded owner-scoped lookup and at most one small write. Only native server-batch cases add a ledger read. Multi-unit completion reuses its existing output snapshot and adds at most one write and one reconcile wake. No request-side STT or LLM calls are added.

Rollout and rollback

Default on for v3 owners. Set CONVERSATIONS_V3_FINISH_NO_POINTER=off on the serving API to restore lookup-miss 404s. Accepted intents continue through the normal builder and batch pipeline. Both serving GMP profiles export omi_conversations_v3_finish_no_pointer_total.

How it was verified

The registered FastAPI route is exercised with synthetic owner data and strict Firestore transaction fixtures. Tests cover the optional ID and empty-body requests, owner isolation, the kill switch, the late multi-unit request, whole-record completion, post-projection retries, silent whole-record completion, both kill switches, native-ledger readback, and first-settlement counting. All 2,331 tests across the six focused files passed through omi-heavy, including 1,993 lifecycle writer guard cases. The generated app-client OpenAPI and TypeScript contracts were refreshed and the directional compatibility check passed.

Tests

  • backend/tests/unit/test_lifecycle_state_table_writers.py
  • backend/tests/unit/test_episodes_finalize_paths.py
  • backend/tests/unit/test_batch_pipeline_projection.py
  • backend/tests/unit/test_batch_pipeline_live.py
  • backend/tests/unit/test_conversations_v3_created_delivery.py
  • backend/tests/unit/test_conversations_v3_live_capture.py

Product invariants affected

none

UI evidence

UI-Evidence: none -- backend contract and projection changes

Failure class (fixes)

Failure-Class: none

Line-Count-Exception: backend/routers/conversations.py | 3168 -> 3172 | The existing Finish route calls the isolated v3 fallback on its lookup miss.
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1944 -> 1947 | The batch binding proves the projection carries the whole native recording before a marker is promoted.
Line-Count-Exception: backend/database/batch_pipeline_projection.py | 1427 -> 1508 | Deferred Finish uses the existing whole-record completion transaction and shares its sibling receipt and write fences.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T13:00:39.618921Z
We couldn’t complete this review. Comment @codex review to try again.
89e1be9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@mintlify

mintlify Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 75bf32c.

Approve preview

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